From 39194f5496b9f1edf4be452d5fbbbfcc73e85517 Mon Sep 17 00:00:00 2001 From: Zaira <33151350+zairahira@users.noreply.github.com> Date: Mon, 22 Dec 2025 19:21:01 +0500 Subject: [PATCH] feat(curriculum): NodeJS core modules quiz (#64105) Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> --- client/i18n/locales/english/intro.json | 6 + .../quiz-node-js-core-modules/index.md | 9 + .../692487767b6b728454f53f29.md | 454 ++++++++++++++++++ .../blocks/quiz-node-js-core-modules.json | 14 + .../back-end-development-and-apis-v9.json | 2 +- 5 files changed, 484 insertions(+), 1 deletion(-) create mode 100644 client/src/pages/learn/back-end-development-and-apis-v9/quiz-node-js-core-modules/index.md create mode 100644 curriculum/challenges/english/blocks/quiz-node-js-core-modules/692487767b6b728454f53f29.md create mode 100644 curriculum/structure/blocks/quiz-node-js-core-modules.json diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 0924f55394a..093b89c82b2 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -7317,6 +7317,12 @@ "Review relational databases concepts to prepare for the exam." ] }, + "quiz-node-js-core-modules": { + "title": "NodeJS Core Modules Quiz", + "intro": [ + "Test what you've learned about Node.js core modules with this quiz." + ] + }, "exam-relational-databases-certification": { "title": "Relational Databases Certification Exam", "intro": [ diff --git a/client/src/pages/learn/back-end-development-and-apis-v9/quiz-node-js-core-modules/index.md b/client/src/pages/learn/back-end-development-and-apis-v9/quiz-node-js-core-modules/index.md new file mode 100644 index 00000000000..c41c634b3e8 --- /dev/null +++ b/client/src/pages/learn/back-end-development-and-apis-v9/quiz-node-js-core-modules/index.md @@ -0,0 +1,9 @@ +--- +title: Introduction to the NodeJS Core Modules Quiz +block: quiz-node-js-core-modules +superBlock: back-end-development-and-apis-v9 +--- + +## Introduction to the NodeJS Core Modules Quiz + +This page is for the NodeJS Core Modules Quiz diff --git a/curriculum/challenges/english/blocks/quiz-node-js-core-modules/692487767b6b728454f53f29.md b/curriculum/challenges/english/blocks/quiz-node-js-core-modules/692487767b6b728454f53f29.md new file mode 100644 index 00000000000..2c301f191a5 --- /dev/null +++ b/curriculum/challenges/english/blocks/quiz-node-js-core-modules/692487767b6b728454f53f29.md @@ -0,0 +1,454 @@ +--- +id: 692487767b6b728454f53f29 +title: NodeJS Core Modules Quiz +challengeType: 8 +dashedName: quiz-node-js-core-modules +--- + +# --description-- + +To pass the quiz, you must correctly answer at least 18 of the 20 questions below. + +# --quizzes-- + +## --quiz-- + +### --question-- + +#### --text-- + +Which `fs` method adds content to an existing file without overwriting it? + +#### --distractors-- + +`writeFile()` + +--- + +`readFile()` + +--- + +`unlink()` + +#### --answer-- + +`appendFile()` + +### --question-- + +#### --text-- + +What happens when you use synchronous methods from the `fs` module? + +#### --distractors-- + +They delete existing files automatically. + +--- + +They run faster than asynchronous ones in all cases. + +--- + +They return Promises by default. + +#### --answer-- + +They block the program until the operation finishes. + +### --question-- + +#### --text-- + +What does the `utf8` parameter do in `fs.readFile()`? + +#### --distractors-- + +It prevents errors from being thrown. + +--- + +It changes the file’s extension. + +--- + +It compresses large files. + +#### --answer-- + +It tells Node to return a readable string instead of a buffer. + +### --question-- + +#### --text-- + +Which `Buffer` method creates a new buffer filled with zeros? + +#### --distractors-- + +`Buffer.from()` + +--- + +`Buffer.concat()` + +--- + +`Buffer.byteLength()` + +#### --answer-- + +`Buffer.alloc()` + +### --question-- + +#### --text-- + +What does `Buffer.toString()` do? + +#### --distractors-- + +Converts a buffer into binary code. + +--- + +Clears the contents of a buffer. + +--- + +Shows buffer byte length. + +#### --answer-- + +Converts buffer contents into a readable string. + +### --question-- + +#### --text-- + +Which `crypto` feature requires a private key to generate a signature? + +#### --distractors-- + +`createHash()` + +--- + +`createCipheriv()` + +--- + +`randomBytes()` + +#### --answer-- + +`sign()` + +### --question-- + +#### --text-- + +Why should you avoid writing your own crypto algorithms directly? + +#### --distractors-- + +It is illegal in Node.js applications. + +--- + +Node.js does not support encryption. + +--- + +JavaScript cannot compute hashes. + +#### --answer-- + +It can be unsafe without well-tested libraries. + +### --question-- + +#### --text-- + +What `crypto` method is recommended for generating secure random tokens instead of `Math.random()`? + +#### --distractors-- + +`randomInt()` + +--- + +`createHmac()` + +--- + +`createCipheriv()` + +#### --answer-- + +`randomBytes()` + +### --question-- + +#### --text-- + +Which OS module method returns the CPU architecture? + +#### --distractors-- + +`os.cpus()` + +--- + +`os.platform()` + +--- + +`os.version()` + +#### --answer-- + +`os.arch()` + +### --question-- + +#### --text-- + +What does `os.userInfo()` return? + +#### --distractors-- + +Only the username. + +--- + +Only the device IP address. + +--- + +Only the logged-in user’s ID. + +#### --answer-- + +Information about the current system user. + +### --question-- + +#### --text-- + +Which `path` method joins segments and normalizes extra slashes? + +#### --distractors-- + +`path.resolve()` + +--- + +`path.extname()` + +--- + +`path.dirname()` + +#### --answer-- + +`path.join()` + +### --question-- + +#### --text-- + +Which `path` method produces an absolute path based on the current working directory? + +#### --distractors-- + +`path.extname()` + +--- + +`path.format()` + +--- + +`path.parse()` + +#### --answer-- + +`path.resolve()` + +### --question-- + +#### --text-- + +What does the global variable `__dirname` represent? + +#### --distractors-- + +The name of the user running Node. + +--- + +The current file’s extension. + +--- + +A relative folder path starting with `./`. + +#### --answer-- + +The absolute path of the directory containing the current file. + +### --question-- + +#### --text-- + +Which process property contains environment variables like `NODE_ENV`? + +#### --distractors-- + +`process.cwd` + +--- + +`process.version` + +--- + +`process.platform` + +#### --answer-- + +`process.env` + +### --question-- + +#### --text-- + +What does the `process.on("exit")` event do? + +#### --distractors-- + +It restarts the Node application. + +--- + +It sends an `exit` signal to child processes. + +--- + +It clears the event loop queue. + +#### --answer-- + +Executes code right before the Node process finishes. + +### --question-- + +#### --text-- + +Which stream type can both read and write data but does not transform it? + +#### --distractors-- + +Readable stream + +--- + +Transform stream + +--- + +Writable stream + +#### --answer-- + +Duplex stream + +### --question-- + +#### --text-- + +What is required to implement reading and writing of large files efficiently? + +#### --distractors-- + +Using only `Buffer.alloc()` + +--- + +Importing the `crypto` module + +--- + +Saving the entire file in memory first + +#### --answer-- + +Using streams to process data in chunks + +### --question-- + +#### --text-- + +Which method links a readable stream to a writable stream? + +#### --distractors-- + +`pipeTo()` + +--- + +`connect()` + +--- + +`streamWrite()` + +#### --answer-- + +`pipe()` + +### --question-- + +#### --text-- + +What stream event indicates there is no more data to write? + +#### --distractors-- + +`close` + +--- + +`drain` + +--- + +`end` + +#### --answer-- + +`finish` + +### --question-- + +#### --text-- + +What is logged if you print a chunk from a readable stream without `toString()`? + +#### --distractors-- + +Plain text content + +--- + +The process PID + +--- + +Operating system name + +#### --answer-- + +A buffer object with binary data diff --git a/curriculum/structure/blocks/quiz-node-js-core-modules.json b/curriculum/structure/blocks/quiz-node-js-core-modules.json new file mode 100644 index 00000000000..bec8e4e87da --- /dev/null +++ b/curriculum/structure/blocks/quiz-node-js-core-modules.json @@ -0,0 +1,14 @@ +{ + "name": "NodeJS Core Modules Quiz", + "isUpcomingChange": true, + "dashedName": "quiz-node-js-core-modules", + "helpCategory": "Backend Development", + "challengeOrder": [ + { + "id": "692487767b6b728454f53f29", + "title": "NodeJS Core Modules Quiz" + } + ], + "blockLabel": "quiz", + "blockLayout": "link" +} diff --git a/curriculum/structure/superblocks/back-end-development-and-apis-v9.json b/curriculum/structure/superblocks/back-end-development-and-apis-v9.json index 0d3ce0600ee..3fd292b8908 100644 --- a/curriculum/structure/superblocks/back-end-development-and-apis-v9.json +++ b/curriculum/structure/superblocks/back-end-development-and-apis-v9.json @@ -16,7 +16,7 @@ { "dashedName": "nodejs-core-modules", "comingSoon": true, - "blocks": [] + "blocks": ["quiz-node-js-core-modules"] }, { "dashedName": "node-package-manager",