mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
feat(curriculum): add node and express quiz (#56638)
Co-authored-by: Naomi <accounts+github@nhcarrigan.com>
This commit is contained in:
+100
-100
@@ -17,439 +17,439 @@ Answer all of the questions below correctly to pass the quiz.
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which command initializes a new `package.json` file in `npm`?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`npm create`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`npm add`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`npm start`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`npm init`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the primary purpose of `npm`?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
To run a web server.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
To bundle code for production.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
To compile JavaScript.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
To manage packages for Node.js.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which JavaScript engine is used by Node.js?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
JavaScriptCore.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
SpiderMonkey.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Chakra.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
V8.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
In Express.js, what middleware function is used to parse incoming JSON payloads?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`app.useJSON()`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`app.parseJSON()`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`express.bodyParser()`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`express.json()`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is Express.js primarily used for?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Creating mobile applications.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Creating desktop applications.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Database management.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Building web applications and APIs.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is a major feature of Deno compared to Node.js?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
JavaScript syntax only.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Support for CommonJS modules.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Requires a browser to run.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Built-in TypeScript support.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is Bun primarily designed for?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Compiling C++ code.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Compiling Java applications.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Managing databases.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Building and running JavaScript applications efficiently.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What does the Express method `app.use()` do?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Handles GET requests.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Starts the server.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Sends a response to the client.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Mounts middleware functions.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the default port for an Express application?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
4000
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
8080
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
4001
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
3000
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the purpose of the `cors` package in an Express application?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
To compress response data.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
To manage session storage.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
To log HTTP requests.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
To enable Cross-Origin Resource Sharing.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which `npm` package is used to connect a Node.js application to a MySQL database?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`mongoose`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`sqlite`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`pg`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`mysql`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which of the following is a popular ODM for Node.js?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Bun.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
PostgreSQL.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
V8.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Mongoose.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the purpose of the `dotenv` package in a Node.js application?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
To manage sessions.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
To optimize performance.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
To compile TypeScript.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
To load environment variables from a `.env` file.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
How can you retrieve query parameters in an Express route?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`req.body`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`req.data`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`req.params`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`req.query`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which command is used to run scripts defined in the `package.json` file?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`npm execute`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`npm run-script`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`npm launch`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`npm run`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which JavaScript runtime is designed to be lightweight and optimized for performance?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Node.js.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Rhino.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Deno.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Bun.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What middleware is commonly used for handling file uploads in Express?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`express-fileupload`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`body-parser`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`compression`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`multer`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which of the following methods are used to start an `express` server?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`app.use`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`app.render`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`app.path`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`app.listen`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the purpose of the `package-lock.json` file?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
To manually specify package versions.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
To lock the `npm` version used in the project.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
To store `npm` authentication tokens.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
To ensure consistent installs across environments.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
In a Node.js application, how do you create a connection to a MySQL database using the `mysql` package?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`connection.run(sql, params, callback);`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`connection.execute(sql, params);`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`connection.perform(sql);`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`connection.query(sql, params, callback);`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user