Skip to content

Commit c46e035

Browse files
yafiahaYafiaha
authored andcommitted
feat: adds Yafiah's quiz (code-differently#97)
Co-authored-by: Yafiaha <[email protected]>
1 parent f3637e5 commit c46e035

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

lesson_03/quiz/quiz.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ quiz:
99
yetanotherone:
1010
- $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK
1111
- $2y$10$dGB0CGv7.XQC5OqfyY6iXOiJsdVyxU3ve5YE0gt4m2I8P8H13lNXa
12+
yafiahAbdullah:
13+
- $2y$10$XcsVuO66KZiUiN75NtssdOkKvHKhuBo91JgE/TJEnSrrzbhjxuql.
14+
- $2y$10$9fZs867NHxoPQ/VWMeLyj.us5Kg3SLPcbt9O5ki/FdJ37TbhgFMFC
15+
- $2y$10$GfjcKvtzr6n8553Mdr1RJOOYDfzOudlW.3i8otsH0HiW52CU7tUAW

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Module } from '@nestjs/common';
22
import { AnotherQuiz } from './another_quiz.js';
33
import { AnthonyMaysQuiz } from './anthony_mays_quiz.js';
4+
import { YafiahAbdullahQuiz } from './yafiah_abdullah_quiz.js';
45
import { YetAnotherQuiz } from './yet_another_quiz.js';
56

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

89
// Add your quiz provider here.
9-
const QUIZ_PROVIDERS = [AnthonyMaysQuiz, AnotherQuiz, YetAnotherQuiz];
10+
const QUIZ_PROVIDERS = [
11+
AnthonyMaysQuiz,
12+
YafiahAbdullahQuiz,
13+
AnotherQuiz,
14+
YetAnotherQuiz,
15+
];
1016

1117
@Module({
1218
providers: [
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {
2+
AnswerChoice,
3+
MultipleChoiceQuizQuestion,
4+
QuizQuestion,
5+
QuizQuestionProvider,
6+
} from 'codedifferently-instructional';
7+
8+
export class YafiahAbdullahQuiz implements QuizQuestionProvider {
9+
getProviderName(): string {
10+
return 'yafiahAbdullah';
11+
}
12+
13+
makeQuizQuestions(): QuizQuestion[] {
14+
return [YafiahAbdullahQuiz.makeQuestion0(), YafiahAbdullahQuiz.makeQuestion1(),YafiahAbdullahQuiz.makeQuestion2()];
15+
}
16+
17+
private static makeQuestion0(): QuizQuestion {
18+
return new MultipleChoiceQuizQuestion(
19+
0,
20+
'What is a CPU?',
21+
new Map<AnswerChoice, string>([
22+
[AnswerChoice.A, 'Central Processing Unit'],
23+
[AnswerChoice.B, 'Computer Performance Unit'],
24+
[
25+
AnswerChoice.C,
26+
'Core Processing Unit',
27+
],
28+
[AnswerChoice.D, 'Central Program Unit'],
29+
]),
30+
AnswerChoice.UNANSWERED,
31+
); // Replace `UNANSWERED` with the correct answer.
32+
}
33+
34+
private static makeQuestion1(): QuizQuestion {
35+
return new MultipleChoiceQuizQuestion(
36+
1,
37+
'Which of the following best describes the main function of a CPU?',
38+
new Map<AnswerChoice, string>([
39+
[AnswerChoice.A, 'To store data'],
40+
[AnswerChoice.B, 'To execute instructions and process data'],
41+
[
42+
AnswerChoice.C,
43+
'To manage peripheral devices',
44+
],
45+
[AnswerChoice.D, 'To connect to the internet'],
46+
]),
47+
AnswerChoice.UNANSWERED,
48+
); // Replace `UNANSWERED` with the correct answer.
49+
}
50+
51+
private static makeQuestion2(): QuizQuestion {
52+
return new MultipleChoiceQuizQuestion(
53+
2,
54+
'What is the unit of measurement commonly used to describe CPU speed?',
55+
new Map<AnswerChoice, string>([
56+
[AnswerChoice.A, 'Megabytes (MB)'],
57+
[AnswerChoice.B, 'Gigahertz (GHz)'],
58+
[
59+
AnswerChoice.C,
60+
'Kilobytes (KB)',
61+
],
62+
[AnswerChoice.D, 'Terabits (Tb)'],
63+
]),
64+
AnswerChoice.UNANSWERED,
65+
); // Replace `UNANSWERED` with the correct answer.
66+
}
67+
}

0 commit comments

Comments
 (0)