From 787922295fb880873884bbdeb40fb1b4476cfe71 Mon Sep 17 00:00:00 2001 From: Kolade Chris <65571316+Ksound22@users.noreply.github.com> Date: Sun, 1 Mar 2026 18:39:40 +0100 Subject: [PATCH] feat(curriculum): add dynamic programming quiz to js v9 cert (#65995) --- client/i18n/locales/english/intro.json | 6 + .../699a068cfe9bb7bccf2b7ec0.md | 234 ++++++++++++++++++ .../blocks/quiz-dynamic-programming-js.json | 11 + .../structure/superblocks/javascript-v9.json | 2 +- 4 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 curriculum/challenges/english/blocks/quiz-dynamic-programming-js/699a068cfe9bb7bccf2b7ec0.md create mode 100644 curriculum/structure/blocks/quiz-dynamic-programming-js.json diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index fe31baa2ca1..17254b52c39 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -3329,6 +3329,12 @@ "In this lab, you will implement a function that converts an adjacency list representation of a graph into an adjacency matrix representation." ] }, + "quiz-dynamic-programming-js": { + "title": "Dynamic Programming Quiz", + "intro": [ + "Test what you've learned about dynamic programming in JavaScript with this quiz." + ] + }, "lecture-understanding-functional-programming": { "title": "Understanding Functional Programming", "intro": [ diff --git a/curriculum/challenges/english/blocks/quiz-dynamic-programming-js/699a068cfe9bb7bccf2b7ec0.md b/curriculum/challenges/english/blocks/quiz-dynamic-programming-js/699a068cfe9bb7bccf2b7ec0.md new file mode 100644 index 00000000000..bbc5d2e7339 --- /dev/null +++ b/curriculum/challenges/english/blocks/quiz-dynamic-programming-js/699a068cfe9bb7bccf2b7ec0.md @@ -0,0 +1,234 @@ +--- +id: 699a068cfe9bb7bccf2b7ec0 +title: Dynamic Programming Quiz +challengeType: 8 +dashedName: quiz-dynamic-programming-js +--- + +# --description-- + +To pass the quiz, you must correctly answer at least 9 of the 10 questions below. + +# --quizzes-- + +## --quiz-- + +### --question-- + +#### --text-- + +What are the two essential properties that must be present in a problem for dynamic programming to be an effective solution approach? + +#### --distractors-- + +Fast execution time and minimal memory usage + +--- + +Recursion capability and iterative loops + +--- + +Sequential processing and parallel computation + +#### --answer-- + +Overlapping subproblems and optimal substructure + +### --question-- + +#### --text-- + +What is the primary difference between the memoization and tabulation approaches in dynamic programming? + +#### --distractors-- + +Memoization uses hash tables while tabulation uses arrays, making it more efficient. + +--- + +Memoization is faster but uses more memory and CPU cycles than tabulation. + +--- + +Memoization can only solve simpler problems than tabulation. + +#### --answer-- + +Memoization is a top-down approach using recursion, while tabulation is a bottom-up approach using iteration. + +### --question-- + +#### --text-- + +Why do naive recursive solutions to dynamic programming problems typically have exponential time complexity? + +#### --distractors-- + +Because they use exponential amounts of memory to store variables. + +--- + +Because they require sorting data in exponential time. + +--- + +Because they must check all possible permutations of the input. + +#### --answer-- + +Because each recursive call branches multiple times, causing the same subproblems to be recalculated repeatedly. + +### --question-- + +#### --text-- + +What does optimal substructure mean in the context of dynamic programming? + +#### --distractors-- + +The algorithm must use the most efficient data structure available. + +--- + +The solution must minimize both time and space complexity simultaneously. + +--- + +The problem must have a unique, single optimal solution. + +#### --answer-- + +The optimal solution can be constructed from optimal solutions to its subproblems. + +### --question-- + +#### --text-- + +When implementing memoization, what happens when a function is called with arguments that have already been computed? + +#### --distractors-- + +The function recalculates the result to ensure accuracy. + +--- + +The function averages the old and new results for better precision. + +--- + +An error is thrown because duplicate calculations are not allowed. + +#### --answer-- + +The cached result is returned immediately without recomputation. + +### --question-- + +#### --text-- + +What is a key advantage of using tabulation instead of memoization? + +#### --distractors-- + +Tabulation always requires less memory than memoization. + +--- + +Tabulation can solve a broader class of problems. + +--- + +Tabulation is always easier to implement and understand. + +#### --answer-- + +Tabulation avoids recursion overhead and provides predictable sequential execution. + +### --question-- + +#### --text-- + +In a bottom-up dynamic programming solution, why are base cases initialized first? + +#### --distractors-- + +To allocate memory for the data structure efficiently. + +--- + +To prevent infinite loops in the algorithm. + +--- + +To improve the time complexity of the algorithm. + +#### --answer-- + +To provide foundational values upon which all larger subproblems are built. + +### --question-- + +#### --text-- + +How does dynamic programming transform the time complexity of problems that exhibit overlapping subproblems? + +#### --distractors-- + +From polynomial to logarithmic by dividing the problem efficiently. + +--- + +From quadratic to linear by optimizing loop structures. + +--- + +From linear to constant by using hash tables. + +#### --answer-- + +From exponential to polynomial by storing and reusing subproblem solutions. + +### --question-- + +#### --text-- + +What trade-off does dynamic programming typically make to achieve better time complexity? + +#### --distractors-- + +It sacrifices code readability for faster execution. + +--- + +It requires more complex algorithms that are harder to maintain. + +--- + +It limits the size of problems that can be solved. + +#### --answer-- + +It uses additional space to store intermediate results. + +### --question-- + +#### --text-- + +In which scenario would dynamic programming NOT be the appropriate algorithmic approach? + +#### --distractors-- + +When the problem requires finding an optimal solution. + +--- + +When the problem can be broken into smaller subproblems. + +--- + +When space complexity must be minimized. + +#### --answer-- + +When subproblems are independent and don't overlap. diff --git a/curriculum/structure/blocks/quiz-dynamic-programming-js.json b/curriculum/structure/blocks/quiz-dynamic-programming-js.json new file mode 100644 index 00000000000..34caef46617 --- /dev/null +++ b/curriculum/structure/blocks/quiz-dynamic-programming-js.json @@ -0,0 +1,11 @@ +{ + "name": "Dynamic Programming Quiz", + "isUpcomingChange": true, + "blockLabel": "quiz", + "blockLayout": "link", + "dashedName": "quiz-dynamic-programming-js", + "helpCategory": "JavaScript", + "challengeOrder": [ + { "id": "699a068cfe9bb7bccf2b7ec0", "title": "Dynamic Programming Quiz" } + ] +} diff --git a/curriculum/structure/superblocks/javascript-v9.json b/curriculum/structure/superblocks/javascript-v9.json index 7c014d38840..19bcc75b6b3 100644 --- a/curriculum/structure/superblocks/javascript-v9.json +++ b/curriculum/structure/superblocks/javascript-v9.json @@ -318,7 +318,7 @@ { "dashedName": "dynamic-programming", "comingSoon": true, - "blocks": [] + "blocks": ["quiz-dynamic-programming-js"] }, { "dashedName": "functional-programming",