1. Which design pattern is commonly used in Node.js to implement encapsulation and data hiding?
A. Factory Method
B. Singleton
C. Facade
D. Observer
Target Skill: Design Patterns
Correct Answer: C. Facade
Explanation: The Facade pattern provides a unified interface to a set of interfaces in a subsystem. It simplifies the interaction with the subsystem by hiding the complexities of the underlying components.
2. When developing RESTful APIs in Node.js using Express, which HTTP status code is appropriate for indicating that a resource was created successfully?
A. 200 OK
B. 201 Created
C. 202 Accepted
D. 204 No Content
Target Skill: RESTful API Development
Correct Answer: B. 201 Created
Explanation: The 201 Created status code is used to indicate that a new resource was successfully created on the server. It is commonly used in REST APIs for POST requests that result in the creation of a new resource.
3. In microservices architecture, which communication mechanism is often used for lightweight and asynchronous communication between services?
A. Remote Procedure Call (RPC)
B. Message Queuing
C. Shared Memory
D. Sockets
Target Skill: Microservices Architecture
Correct Answer: B. Message Queuing
Explanation: Message queuing is a common communication mechanism used in microservices architecture. It involves sending messages between services through a message broker, which ensures reliable and asynchronous communication.
4. Which database management system is widely used for storing structured data in Node.js applications?
A. MongoDB
B. Redis
C. MySQL
D. ElasticSearch
Target Skill: Database Management
Correct Answer: C. MySQL
Explanation: MySQL is a popular relational database management system (RDBMS) that is commonly used with Node.js applications for storing and managing structured data. It provides features such as ACID transactions, SQL support, and scalability.
5. Which Node.js module is commonly used for performing data validation and sanitization?
A. Joi
B. Express
C. Mongoose
D. Passport
Target Skill: Node.js Modules
Correct Answer: A. Joi
Explanation: Joi is a popular Node.js module used for data validation and sanitization. It provides a variety of built-in validation rules and allows for custom validation logic to ensure the integrity and security of data.