









































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This exam tests expertise in the MEAN stack (MongoDB, Express.js, Angular, Node.js) for developing full-stack web applications. Topics include backend development, frontend development, database management, API integration, and deployment.
Typology: Exams
1 / 81
This page cannot be seen from the preview
Don't miss anything!










































































Question 1. What is the primary format for storing documents in MongoDB? A) XML B) BSON C) YAML D) CSV Answer: B Explanation: MongoDB stores documents in BSON (Binary JSON), which allows for rich data types and efficient storage. Question 2. Which MongoDB operator allows you to match documents where a field matches any value in a specified array? A) $or B) $in C) $all D) $eq Answer: B Explanation: The $in operator matches documents where the field’s value equals any value in the specified array. Question 3. In MongoDB, what is the equivalent of a table in relational databases? A) Row B) Column C) Collection D) Index Answer: C Explanation: A collection in MongoDB is analogous to a table in relational databases.
Question 4. Which write concern ensures that a write operation is acknowledged only after the data is written to the journal? A) "majority" B) "journaled" C) "acknowledged" D) "unacknowledged" Answer: B Explanation: The "journaled" write concern waits for the operation to be written to the journal for durability. Question 5. What is the main advantage of using embedded documents in MongoDB data modeling? A) Simplifies schema validation B) Improves read performance C) Reduces disk usage D) Eliminates need for indexes Answer: B Explanation: Embedded documents can improve read performance by storing related data together. Question 6. What does the $push operator do in a MongoDB update operation? A) Removes an item from an array B) Adds an item to an array C) Increments a numeric field D) Sets a field to a new value Answer: B Explanation: $push appends a value to an array field in a document.
Question 10. In a replica set, what is the role of the secondary members? A) Handle write operations B) Store backup data only C) Replicate data from the primary D) Manage sharding Answer: C Explanation: Secondary members replicate data from the primary for redundancy and failover. Question 11. What is the default port for MongoDB? A) 27015 B) 27017 C) 27018 D) 3306 Answer: B Explanation: MongoDB uses port 27017 by default. Question 12. Which MongoDB command is used to remove multiple documents matching a query? A) deleteOne B) removeMany C) deleteMany D) drop Answer: C Explanation: deleteMany removes all documents that match the query criteria.
Question 13. What does a sparse index do in MongoDB? A) Indexes all fields B) Indexes only documents where the indexed field exists C) Indexes only null values D) Indexes only unique values Answer: B Explanation: Sparse indexes only include documents where the indexed field exists, reducing index size. Question 14. What is the main benefit of sharding in MongoDB? A) Improved security B) Horizontal scaling C) Reduced write concern D) Easier schema migration Answer: B Explanation: Sharding enables horizontal scaling by distributing data across multiple servers. Question 15. Which Express.js method is used to define a route that responds to HTTP GET requests? A) app.get() B) app.post() C) app.put() D) app.delete() Answer: A Explanation: app.get() handles HTTP GET requests in Express.js. Question 16. What is middleware in Express.js?
B) Enables CORS C) Sets security-related HTTP headers D) Handles static files Answer: C Explanation: Helmet helps secure Express apps by setting various HTTP headers. Question 20. Which HTTP status code indicates a resource was not found? A) 200 B) 404 C) 401 D) 500 Answer: B Explanation: 404 means "Not Found" and is used when a resource is unavailable. Question 21. What is the purpose of the express-validator library? A) Logging requests B) Validating and sanitizing user input C) Managing sessions D) Parsing cookies Answer: B Explanation: express-validator helps validate and sanitize incoming request data. Question 22. Which Express method is used to serve static files? A) app.static() B) app.use(express.static())
C) app.serve() D) app.files() Answer: B Explanation: express.static() serves static files like HTML, CSS, and JS. Question 23. What does CORS middleware allow in Express.js? A) Custom error handling B) Cross-origin requests C) File uploads D) Request logging Answer: B Explanation: CORS enables cross-origin resource sharing, allowing requests from different origins. Question 24. Which method would you use to parse URL-encoded data in Express.js? A) express.json() B) express.urlencoded() C) express.text() D) express.raw() Answer: B Explanation: express.urlencoded() parses incoming request bodies with URL-encoded data. Question 25. What is the default behavior of Express.js for unknown routes? A) Returns 200 OK B) Returns 404 Not Found C) Redirects to home
Answer: A Explanation: Error handling middleware in Express.js has four parameters: (err, req, res, next). Question 29. What does the status code 401 indicate in RESTful APIs? A) Resource not found B) Unauthorized access C) Server error D) Request timeout Answer: B Explanation: 401 means "Unauthorized" and is sent when authentication is required. Question 30. Which express method is used to handle POST requests? A) app.get() B) app.post() C) app.put() D) app.delete() Answer: B Explanation: app.post() is used for handling HTTP POST requests. Question 31. What are Angular modules primarily used for? A) Styling components B) Organizing code into cohesive blocks C) Handling HTTP requests D) Managing data persistence Answer: B
Explanation: Angular modules organize related code into functional blocks for better maintainability. Question 32. What CLI command generates a new component in Angular? A) ng create component B) ng new C) ng generate component D) ng build Answer: C Explanation: ng generate component creates a new Angular component. Question 33. Which Angular lifecycle hook is called after the component's view has been initialized? A) ngOnInit B) ngOnDestroy C) ngAfterViewInit D) ngAfterContentInit Answer: C Explanation: ngAfterViewInit runs after the component’s view is initialized. Question 34. What is the main benefit of using Angular services? A) Encapsulate business logic and data sharing B) Manage routing C) Style components D) Render templates Answer: A Explanation: Services encapsulate reusable logic and facilitate data sharing across components.
Question 38. Which Angular CLI command builds the application for production? A) ng start B) ng serve C) ng build --prod D) ng deploy Answer: C Explanation: ng build --prod compiles the app for production with optimizations. Question 39. What is the purpose of Angular’s Dependency Injection system? A) To create new components B) To inject services and dependencies into classes C) To manage routes D) To handle events Answer: B Explanation: Dependency Injection provides required services to Angular components and modules. Question 40. What does the async pipe do in Angular templates? A) Formats numbers B) Handles asynchronous data streams C) Binds styles D) Validates forms Answer: B Explanation: The async pipe subscribes to Observables and displays emitted values in the template. Question 41. Which Angular form type uses FormControl and FormGroup for programmatic control?
A) Template-driven forms B) Reactive forms C) HTML forms D) Inline forms Answer: B Explanation: Reactive forms use FormControl and FormGroup for advanced validation and control. Question 42. What is the main purpose of route guards in Angular? A) Prevent navigation to unauthorized routes B) Format route parameters C) Load modules lazily D) Bind data Answer: A Explanation: Route guards restrict access based on authentication or authorization logic. Question 43. Which decorator is used to make a class an Angular component? A) @Injectable B) @NgModule C) @Component D) @Pipe Answer: C Explanation: @Component marks a class as an Angular component. Question 44. What does *ngFor do in an Angular template? A) Applies styles
C) Executing JavaScript code D) Managing NoSQL databases Answer: C Explanation: V8 is Google’s JavaScript engine that executes JS code in Node.js. Question 48. What is the difference between blocking and non-blocking I/O in Node.js? A) Blocking I/O waits for operations to complete B) Non-blocking I/O waits for operations C) Blocking I/O does not wait D) Non-blocking I/O is synchronous Answer: A Explanation: Blocking I/O halts further code execution until the operation finishes; non-blocking I/O does not. Question 49. Which Node.js module is used for working with the filesystem? A) http B) fs C) path D) events Answer: B Explanation: The fs module provides functions to read, write, and manage files. Question 50. What does require() do in Node.js? A) Imports modules B) Executes shell commands
C) Creates HTTP servers D) Listens for events Answer: A Explanation: require() loads and imports modules in Node.js. Question 51. What is the purpose of the package.json file in Node.js? A) To store application data B) To define project dependencies and configuration C) To serve static files D) To manage HTTP requests Answer: B Explanation: package.json lists dependencies, scripts, and metadata for Node.js applications. Question 52. Which Node.js feature allows handling multiple requests concurrently? A) Blocking I/O B) Event Loop C) Global variables D) Synchronous functions Answer: B Explanation: The Event Loop manages asynchronous operations, allowing concurrent handling. Question 53. What is a Promise in JavaScript? A) A synchronous function B) An object representing eventual completion or failure of an asynchronous operation C) A callback handler
Answer: B Explanation: The http module is used to create HTTP servers and handle requests. Question 57. What does npm stand for? A) Node Package Module B) Node Project Manager C) Node Package Manager D) Node Program Manager Answer: C Explanation: npm is the Node Package Manager for managing dependencies. Question 58. How do you export functions from a Node.js module using CommonJS? A) import { func } B) module.exports = func C) require('func') D) exports: func Answer: B Explanation: module.exports is used to export functions and objects in CommonJS. Question 59. What does process.env provide in Node.js? A) Network configuration B) Access to environment variables C) Database connection strings D) File system access Answer: B
Explanation: process.env gives access to environment variables. Question 60. Which command installs a package as a development dependency in npm? A) npm install package B) npm install package --save C) npm install package --save-dev D) npm install package - g Answer: C Explanation: --save-dev adds the package to devDependencies. Question 61. What is Mongoose primarily used for in MEAN stack applications? A) Styling Angular components B) ODM for MongoDB C) Parsing JSON D) Managing HTTP requests Answer: B Explanation: Mongoose is an Object Data Modeling library for MongoDB. Question 62. How do you define a schema in Mongoose? A) new mongoose.Schema({ ... }) B) mongoose.createSchema({ ... }) C) mongoose.define({ ... }) D) new Schema({ ... }) Answer: A Explanation: Schemas are defined using new mongoose.Schema().