Skip to content

Commit 1867548

Browse files
committed
Add Lesson 2 quiz / Lesson 5 quiz / User Stories
1 parent 33090f9 commit 1867548

File tree

4 files changed

+387
-21
lines changed

4 files changed

+387
-21
lines changed

lesson_02/quiz/cdbluejr/lesson2.ts

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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
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, // Replace `UNANSWERED` with the correct answer.
186+
);
187+
}
188+
}
189+
190+
if (!process.env.JEST_WORKER_ID) {
191+
new Lesson2().run();
192+
}

lesson_02/quiz/src/lesson2.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class Lesson2 {
3939
[AnswerChoice.C, "To delete unnecessary files"],
4040
[AnswerChoice.D, "To run code more efficiently"],
4141
]),
42-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
42+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
4343
);
4444
}
4545

@@ -56,7 +56,7 @@ export class Lesson2 {
5656
[AnswerChoice.C, "A tool for merging branches"],
5757
[AnswerChoice.D, "A way to delete a repository"],
5858
]),
59-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
59+
AnswerChoice.A, // Replace `UNANSWERED` with the correct answer.
6060
);
6161
}
6262

@@ -70,7 +70,7 @@ export class Lesson2 {
7070
[AnswerChoice.C, "Push changes to the server"],
7171
[AnswerChoice.D, "Write code directly in GitHub"],
7272
]),
73-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
73+
AnswerChoice.D, // Replace `UNANSWERED` with the correct answer.
7474
);
7575
}
7676

@@ -84,7 +84,7 @@ export class Lesson2 {
8484
[AnswerChoice.C, "git branch"],
8585
[AnswerChoice.D, "git pull"],
8686
]),
87-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
87+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
8888
);
8989
}
9090

@@ -98,7 +98,7 @@ export class Lesson2 {
9898
[AnswerChoice.C, "NetBeans"],
9999
[AnswerChoice.D, "VS Code"],
100100
]),
101-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
101+
AnswerChoice.D, // Replace `UNANSWERED` with the correct answer.
102102
);
103103
}
104104

@@ -112,7 +112,7 @@ export class Lesson2 {
112112
[AnswerChoice.C, "Dev Containers"],
113113
[AnswerChoice.D, "Source Control"],
114114
]),
115-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
115+
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
116116
);
117117
}
118118

@@ -126,7 +126,7 @@ export class Lesson2 {
126126
[AnswerChoice.C, "Playing music"],
127127
[AnswerChoice.D, "Managing source control"],
128128
]),
129-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
129+
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
130130
);
131131
}
132132

@@ -140,7 +140,7 @@ export class Lesson2 {
140140
[AnswerChoice.C, "cd"],
141141
[AnswerChoice.D, "mkdir"],
142142
]),
143-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
143+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
144144
);
145145
}
146146

@@ -154,7 +154,7 @@ export class Lesson2 {
154154
[AnswerChoice.C, "cd"],
155155
[AnswerChoice.D, "mkdir"],
156156
]),
157-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
157+
AnswerChoice.C, // Replace `UNANSWERED` with the correct answer.
158158
);
159159
}
160160

@@ -168,7 +168,7 @@ export class Lesson2 {
168168
[AnswerChoice.C, "Remove a file or directory"],
169169
[AnswerChoice.D, "Copy a file or directory"],
170170
]),
171-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
171+
AnswerChoice.A, // Replace `UNANSWERED` with the correct answer.
172172
);
173173
}
174174

@@ -182,7 +182,7 @@ export class Lesson2 {
182182
[AnswerChoice.C, "⌘ + Q"],
183183
[AnswerChoice.D, '⌘ + S, then type "terminal"'],
184184
]),
185-
AnswerChoice.UNANSWERED, // Replace `UNANSWERED` with the correct answer.
185+
AnswerChoice.B, // Replace `UNANSWERED` with the correct answer.
186186
);
187187
}
188188
}

0 commit comments

Comments
 (0)