diff --git a/lesson_03/quiz/quiz.yaml b/lesson_03/quiz/quiz.yaml index c016c60e5..54633579f 100644 --- a/lesson_03/quiz/quiz.yaml +++ b/lesson_03/quiz/quiz.yaml @@ -6,3 +6,7 @@ quiz: anotherone: - $2y$10$8eHSzy3aCu4Ry3LzO9nWCeGpofSxsNVbnF.wCfn3ZADwQ6MEtN/KK - $2y$10$dGB0CGv7.XQC5OqfyY6iXOiJsdVyxU3ve5YE0gt4m2I8P8H13lNXa + yafiahAbdullah: + - $2y$10$XcsVuO66KZiUiN75NtssdOkKvHKhuBo91JgE/TJEnSrrzbhjxuql. + - $2y$10$9fZs867NHxoPQ/VWMeLyj.us5Kg3SLPcbt9O5ki/FdJ37TbhgFMFC + - $2y$10$GfjcKvtzr6n8553Mdr1RJOOYDfzOudlW.3i8otsH0HiW52CU7tUAW diff --git a/lesson_03/quiz/src/quizzes/quizzes.module.ts b/lesson_03/quiz/src/quizzes/quizzes.module.ts index ac82f4600..44a7197a2 100644 --- a/lesson_03/quiz/src/quizzes/quizzes.module.ts +++ b/lesson_03/quiz/src/quizzes/quizzes.module.ts @@ -1,11 +1,13 @@ import { Module } from '@nestjs/common'; import { AnotherQuiz } from './another_quiz.js'; import { AnthonyMaysQuiz } from './anthony_mays_quiz.js'; +import { YafiahAbdullahQuiz } from './yafiah_abdullah_quiz.js'; + export const Quizzes = Symbol.for('Quizzes'); // Add your quiz provider here. -const QUIZ_PROVIDERS = [AnthonyMaysQuiz, AnotherQuiz]; +const QUIZ_PROVIDERS = [AnthonyMaysQuiz,YafiahAbdullahQuiz, AnotherQuiz]; @Module({ providers: [ diff --git a/lesson_03/quiz/src/quizzes/yafiah_abdullah_quiz.ts b/lesson_03/quiz/src/quizzes/yafiah_abdullah_quiz.ts new file mode 100644 index 000000000..e80ed2de7 --- /dev/null +++ b/lesson_03/quiz/src/quizzes/yafiah_abdullah_quiz.ts @@ -0,0 +1,67 @@ +import { + AnswerChoice, + MultipleChoiceQuizQuestion, + QuizQuestion, + QuizQuestionProvider, +} from 'codedifferently-instructional'; + +export class YafiahAbdullahQuiz implements QuizQuestionProvider { + getProviderName(): string { + return 'yafiahAbdullah'; + } + + makeQuizQuestions(): QuizQuestion[] { + return [YafiahAbdullahQuiz.makeQuestion0(), YafiahAbdullahQuiz.makeQuestion1(),YafiahAbdullahQuiz.makeQuestion2()]; + } + + private static makeQuestion0(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 0, + 'What is a CPU?', + new Map([ + [AnswerChoice.A, 'Central Processing Unit'], + [AnswerChoice.B, 'Computer Performance Unit'], + [ + AnswerChoice.C, + 'Core Processing Unit', + ], + [AnswerChoice.D, 'Central Program Unit'], + ]), + AnswerChoice.UNANSWERED, + ); // Replace `UNANSWERED` with the correct answer. + } + + private static makeQuestion1(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 1, + 'Which of the following best describes the main function of a CPU?', + new Map([ + [AnswerChoice.A, 'To store data'], + [AnswerChoice.B, 'To execute instructions and process data'], + [ + AnswerChoice.C, + 'To manage peripheral devices', + ], + [AnswerChoice.D, 'To connect to the internet'], + ]), + AnswerChoice.UNANSWERED, + ); // Replace `UNANSWERED` with the correct answer. + } + + private static makeQuestion2(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 2, + 'What is the unit of measurement commonly used to describe CPU speed?', + new Map([ + [AnswerChoice.A, 'Megabytes (MB)'], + [AnswerChoice.B, 'Gigahertz (GHz)'], + [ + AnswerChoice.C, + 'Kilobytes (KB)', + ], + [AnswerChoice.D, 'Terabits (Tb)'], + ]), + AnswerChoice.UNANSWERED, + ); // Replace `UNANSWERED` with the correct answer. + } +}