Skip to content

Commit 0c008a9

Browse files
feat: added some quiz questions
1 parent 7659ee8 commit 0c008a9

File tree

3 files changed

+83
-1
lines changed

3 files changed

+83
-1
lines changed

lesson_03/quiz/quiz.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ quiz:
66
anotherone:
77
- $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK
88
- $2y$10$dGB0CGv7.XQC5OqfyY6iXOiJsdVyxU3ve5YE0gt4m2I8P8H13lNXa
9+
xaviercruz:
10+
- $2y$10$1WMmkMjazP78KVns1l85zOC5r8cwgTnxLLs/scOzIkgCQ8HP28Y.q
11+
- $2y$10$9D.oRC8h/PD/10NMSR6MMOzjVAJKm.vfw4te8Rxgw1M1.0Q9x8pjK
12+
- $2y$10$ypLhtfxJikRhLaQdW0Y8GOEqO/X1uoBD8w.kSSSUPggBa9wHLkw0i
13+
- $2y$10$cYuji5D0xOEFAV2fyMaJAuaODeWEwIYu.X3089qnojdx3nQljil5G

lesson_03/quiz/src/quizzes/quizzes.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { Module } from '@nestjs/common';
22
import { AnotherQuiz } from './another_quiz.js';
33
import { AnthonyMaysQuiz } from './anthony_mays_quiz.js';
4+
import { XavierCruzQuiz } from './xavier_cruz_quiz.js';
45

56
export const Quizzes = Symbol.for('Quizzes');
67

78
// Add your quiz provider here.
8-
const QUIZ_PROVIDERS = [AnthonyMaysQuiz, AnotherQuiz];
9+
const QUIZ_PROVIDERS = [AnthonyMaysQuiz, AnotherQuiz, XavierCruzQuiz];
910

1011
@Module({
1112
providers: [
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import {
2+
AnswerChoice,
3+
MultipleChoiceQuizQuestion,
4+
QuizQuestion,
5+
QuizQuestionProvider,
6+
} from 'codedifferently-instructional';
7+
8+
export class XavierCruzQuiz implements QuizQuestionProvider {
9+
getProviderName(): string {
10+
return 'xaviercruz';
11+
}
12+
13+
makeQuizQuestions(): QuizQuestion[] {
14+
return [
15+
XavierCruzQuiz.makeQuestion0(),
16+
XavierCruzQuiz.makeQuestion1(),
17+
XavierCruzQuiz.makeQuestion2(),
18+
XavierCruzQuiz.makeQuestion3(),
19+
];
20+
}
21+
22+
private static makeQuestion0(): QuizQuestion {
23+
return new MultipleChoiceQuizQuestion(
24+
0,
25+
'What programming language supports the "struct" data type?',
26+
new Map<AnswerChoice, string>([
27+
[AnswerChoice.A, 'C'],
28+
[AnswerChoice.B, 'PHP'],
29+
[AnswerChoice.C, 'JSP'],
30+
[AnswerChoice.D, 'HTML'],
31+
]),
32+
AnswerChoice.UNANSWERED,
33+
); // Replace `UNANSWERED` with the correct answer.
34+
}
35+
36+
private static makeQuestion1(): QuizQuestion {
37+
return new MultipleChoiceQuizQuestion(
38+
1,
39+
'What is another name for an app?',
40+
new Map<AnswerChoice, string>([
41+
[AnswerChoice.A, 'Program'],
42+
[AnswerChoice.B, 'Field'],
43+
[AnswerChoice.C, 'Record'],
44+
[AnswerChoice.D, 'Library'],
45+
]),
46+
AnswerChoice.UNANSWERED,
47+
); // Provide an answer.
48+
}
49+
50+
private static makeQuestion2(): QuizQuestion {
51+
return new MultipleChoiceQuizQuestion(
52+
2,
53+
'A virtual machine is an example of what?',
54+
new Map<AnswerChoice, string>([
55+
[AnswerChoice.A, 'Presentation'],
56+
[AnswerChoice.B, 'Fabrication'],
57+
[AnswerChoice.C, 'Deprecation'],
58+
[AnswerChoice.D, 'Emulation'],
59+
]),
60+
AnswerChoice.UNANSWERED,
61+
); // Provide an answer.
62+
}
63+
private static makeQuestion3(): QuizQuestion {
64+
return new MultipleChoiceQuizQuestion(
65+
3,
66+
'What data type closely resembles a queue?',
67+
new Map<AnswerChoice, string>([
68+
[AnswerChoice.A, 'String'],
69+
[AnswerChoice.B, 'Character'],
70+
[AnswerChoice.C, 'Integer'],
71+
[AnswerChoice.D, 'Array'],
72+
]),
73+
AnswerChoice.UNANSWERED,
74+
); // Provide an answer.
75+
}
76+
}

0 commit comments

Comments
 (0)