diff --git a/lesson_03/quiz/quiz.yaml b/lesson_03/quiz/quiz.yaml index 35272f9dd..9fef51358 100644 --- a/lesson_03/quiz/quiz.yaml +++ b/lesson_03/quiz/quiz.yaml @@ -68,7 +68,11 @@ quiz: - $2y$10$dkWnar/ZXMr9ndtRDcbTbe/HN3DhuULPoZhTx/xATi.UYQ0DUIx1W - $2y$10$.Cw9Sjf6Pf9K8EsThegQ5e8BMoJdLl40CCuJ2FKHLar1k8hVfR9fu - $2y$10$.pmOuTs0Oqjfhn9mMIQCQu7Fbe1ZOZmZIbTGqqul.hnVLqIV6bn/W + hummadtanweer: + - $2y$10$r.JmLYmaAWLZPwv6LLFWB.W823BWj7CsDaPdi5hxv4ExQyCjDq.l. + - $2y$10$DcSjwFSOP.120fEp1zJgEe9J3qZiWPa0i/ofYQS6p3sG93jwCi3ci + - $2y$10$O0Xy3FSVwWM3Tqeh3dP.tuv6E3OHN10siHbgJ4.iPIaZLJ1kVheC6 pablolimonparedes: - $2y$10$Oj.VjaxLuCk3H3XGRLH99.y5LnVkVqEAS30eopxFsNfL6FQ0RRdbC - $2y$10$cs9lhS.nLe6Ym1nkgvr89Oa6Se5DafERs6MJm0t6plQ76zGlTj9JC - - $2y$10$ftCSIQi1kpbWf9CYsrmjCe1H/i/NWzqTX3Jfuqi0TAPcqoCdxrk3O + - $2y$10$ftCSIQi1kpbWf9CYsrmjCe1H/i/NWzqTX3Jfuqi0TAPcqoCdxrk3O \ No newline at end of file diff --git a/lesson_03/quiz/src/quizzes/hummad_tanweer_quiz.ts b/lesson_03/quiz/src/quizzes/hummad_tanweer_quiz.ts new file mode 100644 index 000000000..d3ae0c395 --- /dev/null +++ b/lesson_03/quiz/src/quizzes/hummad_tanweer_quiz.ts @@ -0,0 +1,62 @@ +import { + AnswerChoice, + MultipleChoiceQuizQuestion, + QuizQuestion, + QuizQuestionProvider, +} from 'codedifferently-instructional'; + +export class HummadTanweerQuiz implements QuizQuestionProvider { + getProviderName(): string { + return 'hummadtanweer'; + } + + makeQuizQuestions(): QuizQuestion[] { + return [ + HummadTanweerQuiz.makeQuestion0(), + HummadTanweerQuiz.makeQuestion1(), + HummadTanweerQuiz.makeQuestion2(), + ]; + } + + private static makeQuestion0(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 0, + 'Who is attributed with inventing GIT?', + new Map([ + [AnswerChoice.A, 'Linus Torvalds'], + [AnswerChoice.B, 'James Gosling'], + [AnswerChoice.C, 'Koska Kawaguchi'], + [AnswerChoice.D, 'Junio C. Hamano'], + ]), + AnswerChoice.UNANSWERED, + ); // Replace `UNANSWERED` with the correct answer. + } + + private static makeQuestion1(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 1, + 'What is the opposite of a GIT clone?', + new Map([ + [AnswerChoice.A, 'GIT add'], + [AnswerChoice.B, 'GIT push'], + [AnswerChoice.C, 'GIT upload'], + [AnswerChoice.D, 'GIT status'], + ]), + AnswerChoice.UNANSWERED, + ); // Replace `UNANSWERED` with the correct answer. + } + + private static makeQuestion2(): QuizQuestion { + return new MultipleChoiceQuizQuestion( + 2, + 'How do you check the state of your local git repository since your last commit?', + new Map([ + [AnswerChoice.A, 'GIT diff'], + [AnswerChoice.B, 'GIT commit'], + [AnswerChoice.C, 'GIT status'], + [AnswerChoice.D, 'GIT check'], + ]), + AnswerChoice.UNANSWERED, + ); // Replace `UNANSWERED` with the correct answer. + } +} diff --git a/lesson_03/quiz/src/quizzes/quizzes.module.ts b/lesson_03/quiz/src/quizzes/quizzes.module.ts index 084507eae..a10d38484 100644 --- a/lesson_03/quiz/src/quizzes/quizzes.module.ts +++ b/lesson_03/quiz/src/quizzes/quizzes.module.ts @@ -6,6 +6,7 @@ import { AnthonyMaysQuiz } from './anthony_mays_quiz.js'; import { ChelseaOgbonniaQuiz } from './chelsea_ogbonnia_quiz.js'; import { ChigazoGrahamsQuiz } from './chigazo_graham_quiz.js'; import { DasiaEnglishQuiz } from './dasia_english_quiz.js'; +import { HummadTanweerQuiz } from './hummad_tanweer_quiz.js'; import { JamesCapparellQuiz } from './james_capparell_quiz.js'; import { JosephCaballeroQuiz } from './joseph_caballero_quiz.js'; import { KimberleeHaldaneQuiz } from './kimberlee_haldane_quiz.js'; @@ -39,6 +40,7 @@ const QUIZ_PROVIDERS = [ ZionBuchananQuiz, ChelseaOgbonniaQuiz, TommyTranQuiz, + HummadTanweerQuiz, PabloLimonParedesQuiz, ]; diff --git a/lesson_04/anthonydmays/README.md b/lesson_04/anthonydmays/README.md index 0e0a3b4b2..b3c2e833c 100644 --- a/lesson_04/anthonydmays/README.md +++ b/lesson_04/anthonydmays/README.md @@ -31,7 +31,7 @@ The JavaScript implementation uses a function named `isEven` that also takes a s 1. **Syntax**: - In Python, functions are defined using the `def` keyword, whereas in JavaScript, the `function` keyword is used. - - Python uses `True` and `False` for boolean values, while JavaScript uses `true` and `false`. + - Java uses `True` and `False` for boolean values, while JavaScript uses `true` and `false`. 2. **Type Coercion**: - JavaScript has type coercion, which can sometimes lead to unexpected results if the input is not properly handled. In contrast, Python is more strict with types. diff --git a/lesson_04/hummadtanweer/README.md b/lesson_04/hummadtanweer/README.md new file mode 100644 index 000000000..fcd30981d --- /dev/null +++ b/lesson_04/hummadtanweer/README.md @@ -0,0 +1,57 @@ + + +```Java +static boolean checkPrime(int num) { + boolean prime = false; + if (num == 0 || num == 1) { + prime = true; + } + for (int i = 2; i <= num / 2; i++) { + if (num % i == 0) { + prime = true; + break; + } + } + return !prime; + } + +# Example usage: +print(checkPrime(4)) # Output: false +print(checkPrime(7)) # Output: true + +## JavaScript implementation + +```javascript +function checkPrime(num) { + let prime = false; + if (num === 0 || num === 1) { + prime = true; + } + for (let i = 2; i <= num / 2; i++) { + if (num % i === 0) { + prime = true; + break; + } + } + return !prime; +} +// Example usage: +console.log(checkPrime(4)); // Output: false +console.log(checkPrime(7)); // Output: true + + +## Explanation + +The Javascript implementation uses a function named `checkPrime` that takes a single argument `number`. It returns `True` if the number is prime, otherwise, it returns `False`. + +The Java implementation uses a function named `checkPrime` that also takes a single argument `int number`. It returns `true` if the number is Prime and `false` otherwise. + +Java uses `true` and `talse` for boolean values and JavaScript uses `true` and `false`. + +### Differences + + **Function Calls**: + - The syntax for calling functions and printing to the console/output is slightly different. Java uses `print()`, while JavaScript uses `console.log()`. + +**Citation +https://www.programiz.com/java-programming/online-compiler/?ref=8039b165 \ No newline at end of file