MEAN Stack Quiz (Intermediate) - All Questions
This intermediate MEAN Stack quiz focuses on applied concepts such as REST APIs, Angular architecture, MongoDB queries, Express middleware, and Node.js internals. Ideal for developers with basic knowledge preparing for interviews and real-world MEAN stack projects.
Question 1: Which MEAN stack layer is responsible for handling REST APIs?
- Angular
- MongoDB
- Express with Node.js
- Browser
Explanation: Express and Node.js together handle REST APIs and business logic.
Question 2: What is the main role of Angular services?
- UI styling
- Data sharing and business logic
- Routing only
- DOM manipulation
Explanation: Services handle shared logic and data across components.
Question 3: Which HTTP status code represents forbidden access?
Explanation: 403 means the server understood the request but refuses access.
Question 4: Which MongoDB method updates multiple documents?
- update()
- updateOne()
- updateMany()
- replaceOne()
Explanation: updateMany() modifies multiple matching documents.
Question 5: Which Angular lifecycle hook is used for component initialization?
- ngOnChanges
- ngAfterViewInit
- ngOnInit
- ngOnDestroy
Explanation: ngOnInit runs after component initialization.
Question 6: What is middleware in Express.js?
- Database connector
- Request-response processing layer
- UI renderer
- Routing library
Explanation: Middleware processes requests before reaching routes.
Question 7: Which MongoDB feature improves query performance?
- Collections
- Indexes
- Documents
- Schemas
Explanation: Indexes significantly improve query performance.
Question 8: Which Angular feature avoids redundant API calls?
- Pipes
- Services
- Directives
- Modules
Explanation: Services can cache data and reuse API results.
Question 9: Which Node.js feature allows handling many requests efficiently?
- Multithreading
- Event loop
- Worker threads
- Promises
Explanation: The event loop enables non-blocking I/O.
Question 10: Which MongoDB aggregation stage filters documents?
- $group
- $sort
- $project
- $match
Explanation: $match filters documents based on conditions.
Question 11: Which Angular decorator defines a service?
- @NgModule
- @Component
- @Injectable
- @Directive
Explanation: @Injectable allows a class to be injected as a service.
Question 12: Which HTTP method is idempotent?
Explanation: PUT is idempotent by design.
Question 13: Which Express method handles all HTTP methods?
- app.use()
- app.get()
- app.post()
- app.all()
Explanation: app.all() handles all HTTP verbs.
Question 14: Which MongoDB operator adds values to arrays?
Explanation: $push appends values to arrays.
Question 15: Which Angular feature enables route protection?
- Services
- Pipes
- Route Guards
- Modules
Explanation: Route Guards control navigation access.
Question 16: Which Node.js package loads environment variables?
Explanation: dotenv loads variables from .env files.
Question 17: Which MongoDB command removes a single document?
- remove()
- deleteOne()
- drop()
- clear()
Explanation: deleteOne() removes one document.
Question 18: Which Angular module is required for HTTP calls?
- FormsModule
- BrowserModule
- HttpClientModule
- RouterModule
Explanation: HttpClientModule enables HTTP communication.
Question 19: Which HTTP status code indicates successful creation?
Explanation: 201 indicates a resource was created successfully.
Question 20: Which Express middleware improves security headers?
- cors
- helmet
- morgan
- body-parser
Explanation: helmet adds secure HTTP headers.
Question 21: Which MongoDB relationship embeds related data?
- Referenced
- Embedded
- Linked
- Indexed
Explanation: Embedded documents store related data together.
Question 22: Which Angular feature enables lazy loading?
- Components
- Modules
- Pipes
- Services
Explanation: Lazy loading is implemented using Angular modules.
Question 23: Which Node.js object sends HTTP responses?
Explanation: res is used to send responses.
Question 24: Which MongoDB stage reshapes output fields?
- $group
- $sort
- $project
- $limit
Explanation: $project reshapes document fields.
Question 25: Which Angular feature helps share data globally?
- Pipes
- Services
- Directives
- Components
Explanation: Services provide shared global data.
Question 26: Which HTTP method partially updates a resource?
Explanation: PATCH is used for partial updates.
Question 27: Which Express middleware parses JSON bodies?
- body-parser
- express.json()
- jsonParser()
- dataParser()
Explanation: express.json() parses incoming JSON payloads.
Question 28: Which MongoDB feature supports transactions?
- Indexes
- Collections
- Replica sets
- Documents
Explanation: Replica sets enable transactions.
Question 29: Which Angular lifecycle hook runs after view initialization?
- ngOnInit
- ngAfterViewInit
- ngOnChanges
- ngOnDestroy
Explanation: ngAfterViewInit runs after the view is initialized.
Question 30: Which Node.js practice avoids blocking the event loop?
- Synchronous code
- Callbacks only
- Async operations
- CPU-heavy tasks
Explanation: Async operations prevent blocking.
Question 31: Which MongoDB command sorts query results?
- order()
- sort()
- group()
- arrange()
Explanation: sort() orders query results.
Question 32: Which Angular feature formats template output?
- Services
- Directives
- Pipes
- Modules
Explanation: Pipes format data in templates.
Question 33: Which HTTP status code represents server error?
Explanation: 500 indicates internal server error.
Question 34: Which Express method starts the server?
- app.start()
- app.run()
- app.listen()
- app.open()
Explanation: app.listen() starts the HTTP server.
Question 35: Which Angular CLI command generates a service?
- ng new service
- ng add service
- ng generate service
- ng create service
Explanation: ng generate service creates a new service.
Question 36: Which MongoDB operator removes fields?
- $unset
- $delete
- $remove
- $clear
Explanation: $unset removes specified fields.
Question 37: Which Angular module is required for forms?
- RouterModule
- FormsModule
- HttpClientModule
- BrowserModule
Explanation: FormsModule supports template-driven forms.
Question 38: Which Node.js module handles file system operations?
Explanation: fs handles file system operations.
Question 39: Which MongoDB feature enforces schema rules?
- Indexes
- Collections
- Mongoose schemas
- Documents
Explanation: Mongoose schemas enforce structure.
Question 40: Which Angular feature detects data changes?
- Change Detection
- Routing
- DI system
- Pipes
Explanation: Change Detection updates the UI.
Question 41: Which HTTP status code means bad request?
Explanation: 400 indicates a bad request.
Question 42: Which Express middleware enables CORS?
- helmet
- cors
- morgan
- cookie-parser
Explanation: cors enables cross-origin requests.
Question 43: Which Angular feature allows communication between unrelated components?
- Pipes
- Services with Observables
- Directives
- Modules
Explanation: Services with Observables enable component communication.
Question 44: Which MongoDB stage limits result count?
Explanation: $limit restricts the number of results.
Question 45: Which Node.js object represents the application?
Explanation: app represents the Express application.
Question 46: Which Angular feature is used for dependency injection?
- Modules
- DI framework
- Services
- Routing
Explanation: Angular has a built-in DI framework.
Question 47: Which MongoDB command retrieves documents?
- insert()
- find()
- update()
- delete()
Explanation: find() retrieves documents.
Question 48: Which HTTP method retrieves data safely?
Explanation: GET retrieves data without side effects.