Skip to content

Commit 60126d4

Browse files
committed
turning my quiz in
1 parent 3d65265 commit 60126d4

File tree

1 file changed

+192
-0
lines changed

1 file changed

+192
-0
lines changed
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
import {
2+
AnswerChoice,
3+
MultipleChoiceQuizQuestion,
4+
QuizPrinter,
5+
QuizQuestion,
6+
} from "codedifferently-instructional";
7+
8+
export class Lesson2 {
9+
run(): void {
10+
const quizQuestions = Lesson2.makeQuizQuestions();
11+
if (!quizQuestions) throw new Error("Quiz questions cannot be null");
12+
const printer = new QuizPrinter();
13+
printer.printQuiz(quizQuestions);
14+
}
15+
16+
static makeQuizQuestions(): QuizQuestion[] {
17+
return [
18+
Lesson2.makeQuestion0(),
19+
Lesson2.makeQuestion1(),
20+
Lesson2.makeQuestion2(),
21+
Lesson2.makeQuestion3(),
22+
Lesson2.makeQuestion4(),
23+
Lesson2.makeQuestion5(),
24+
Lesson2.makeQuestion6(),
25+
Lesson2.makeQuestion7(),
26+
Lesson2.makeQuestion8(),
27+
Lesson2.makeQuestion9(),
28+
Lesson2.makeQuestion10(),
29+
];
30+
}
31+
32+
private static makeQuestion0(): QuizQuestion {
33+
return new MultipleChoiceQuizQuestion(
34+
0,
35+
"What is the main purpose of version control?",
36+
new Map([
37+
[AnswerChoice.A, "To make backups of files"],
38+
[AnswerChoice.B, "To keep a record of changes over time"],
39+
[AnswerChoice.C, "To delete unnecessary files"],
40+
[AnswerChoice.D, "To run code more efficiently"],
41+
]),
42+
AnswerChoice.B,
43+
);
44+
}
45+
46+
private static makeQuestion1(): QuizQuestion {
47+
return new MultipleChoiceQuizQuestion(
48+
1,
49+
"What is a fork in Git?",
50+
new Map([
51+
[
52+
AnswerChoice.A,
53+
"A duplicate copy of a repository that you own and modify",
54+
],
55+
[AnswerChoice.B, "A temporary backup of the code"],
56+
[AnswerChoice.C, "A tool for merging branches"],
57+
[AnswerChoice.D, "A way to delete a repository"],
58+
]),
59+
AnswerChoice.A,
60+
);
61+
}
62+
63+
private static makeQuestion2(): QuizQuestion {
64+
return new MultipleChoiceQuizQuestion(
65+
2,
66+
"Which of the following is NOT part of the basic Git workflow?",
67+
new Map([
68+
[AnswerChoice.A, "Pull the latest changes"],
69+
[AnswerChoice.B, "Commit changes locally"],
70+
[AnswerChoice.C, "Push changes to the server"],
71+
[AnswerChoice.D, "Write code directly in GitHub"],
72+
]),
73+
AnswerChoice.D,
74+
);
75+
}
76+
77+
private static makeQuestion3(): QuizQuestion {
78+
return new MultipleChoiceQuizQuestion(
79+
3,
80+
"What command is used to combine changes from different branches?",
81+
new Map([
82+
[AnswerChoice.A, "git commit"],
83+
[AnswerChoice.B, "git merge"],
84+
[AnswerChoice.C, "git branch"],
85+
[AnswerChoice.D, "git pull"],
86+
]),
87+
AnswerChoice.B,
88+
);
89+
}
90+
91+
private static makeQuestion4(): QuizQuestion {
92+
return new MultipleChoiceQuizQuestion(
93+
4,
94+
"Which IDE is being used in the class?",
95+
new Map([
96+
[AnswerChoice.A, "Eclipse"],
97+
[AnswerChoice.B, "IntelliJ IDEA"],
98+
[AnswerChoice.C, "NetBeans"],
99+
[AnswerChoice.D, "VS Code"],
100+
]),
101+
AnswerChoice.D,
102+
);
103+
}
104+
105+
private static makeQuestion5(): QuizQuestion {
106+
return new MultipleChoiceQuizQuestion(
107+
5,
108+
"What feature allows developers to work from the same pre-configured environment in VS Code?",
109+
new Map([
110+
[AnswerChoice.A, "Extensions"],
111+
[AnswerChoice.B, "Debugger"],
112+
[AnswerChoice.C, "Dev Containers"],
113+
[AnswerChoice.D, "Source Control"],
114+
]),
115+
AnswerChoice.C,
116+
);
117+
}
118+
119+
private static makeQuestion6(): QuizQuestion {
120+
return new MultipleChoiceQuizQuestion(
121+
6,
122+
"What is NOT a reason for using an IDE?",
123+
new Map([
124+
[AnswerChoice.A, "Editing and refactoring code"],
125+
[AnswerChoice.B, "Browsing code"],
126+
[AnswerChoice.C, "Playing music"],
127+
[AnswerChoice.D, "Managing source control"],
128+
]),
129+
AnswerChoice.C,
130+
);
131+
}
132+
133+
private static makeQuestion7(): QuizQuestion {
134+
return new MultipleChoiceQuizQuestion(
135+
7,
136+
"What is the command to list files in the current directory?",
137+
new Map([
138+
[AnswerChoice.A, "pwd"],
139+
[AnswerChoice.B, "ls"],
140+
[AnswerChoice.C, "cd"],
141+
[AnswerChoice.D, "mkdir"],
142+
]),
143+
AnswerChoice.B,
144+
);
145+
}
146+
147+
private static makeQuestion8(): QuizQuestion {
148+
return new MultipleChoiceQuizQuestion(
149+
8,
150+
"Which command is used to change directories in the terminal?",
151+
new Map([
152+
[AnswerChoice.A, "pwd"],
153+
[AnswerChoice.B, "ls"],
154+
[AnswerChoice.C, "cd"],
155+
[AnswerChoice.D, "mkdir"],
156+
]),
157+
AnswerChoice.C,
158+
);
159+
}
160+
161+
private static makeQuestion9(): QuizQuestion {
162+
return new MultipleChoiceQuizQuestion(
163+
9,
164+
"What does the command `chmod` do?",
165+
new Map([
166+
[AnswerChoice.A, "Change file or directory permissions"],
167+
[AnswerChoice.B, "List files in a directory"],
168+
[AnswerChoice.C, "Remove a file or directory"],
169+
[AnswerChoice.D, "Copy a file or directory"],
170+
]),
171+
AnswerChoice.A,
172+
);
173+
}
174+
175+
private static makeQuestion10(): QuizQuestion {
176+
return new MultipleChoiceQuizQuestion(
177+
10,
178+
"What is the shortcut for getting to the Mac terminal?",
179+
new Map([
180+
[AnswerChoice.A, "⌘ + Shift + T"],
181+
[AnswerChoice.B, '⌘ + Spacebar, then type "terminal"'],
182+
[AnswerChoice.C, "⌘ + Q"],
183+
[AnswerChoice.D, '⌘ + S, then type "terminal"'],
184+
]),
185+
AnswerChoice.B,
186+
);
187+
}
188+
}
189+
190+
if (!process.env.JEST_WORKER_ID) {
191+
new Lesson2().run();
192+
}

0 commit comments

Comments
 (0)