Backend Developer Intern - Interview Q&A Guide
JAVASCRIPT
1. let vs const vs var
- let: block-scoped, reassignable
- const: block-scoped, not reassignable
- var: function-scoped (older)
2. What is a Promise?
- A Promise handles async operations and has 3 states: pending, fulfilled, rejected.
3. map vs forEach?
- map returns a new array; forEach just iterates.
4. What is async/await?
- Cleaner syntax to handle Promises in async operations.
NODE.JS
5. What is Node.js?
- A JavaScript runtime for running JS outside the browser.
6. What is the event loop?
- Nodes mechanism to handle async tasks using a queue and single thread.
EXPRESS.JS
7. What is Express?
- A web framework for Node.js to build APIs and apps.
8. What is middleware?
- Functions that run before route handlers for tasks like auth, logging.
9. How do you create a route?
- app.get('/users', (req, res) => res.send("Users"));
REACT.JS
10. What is a component?
- A reusable UI piece in React.
11. What is useState?
- A Hook to manage state in function components.
12. What is useEffect?
- A Hook to handle side effects like API calls.
REST API
13. HTTP methods in REST?
- GET, POST, PUT, PATCH, DELETE
14. req.params vs req.query?
- req.params: /user/:id | req.query: /search?name=deep
15. Common status codes?
- 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Server Error
MONGODB
16. What is MongoDB?
- A NoSQL DB storing data as documents.
17. What is Mongoose?
- ODM for MongoDB in Node.js
18. Create schema & model?
- const User = mongoose.model("User", new mongoose.Schema({ name: String }))
19. CRUD in MongoDB?
- User.find(), new User().save(), findByIdAndUpdate(), findByIdAndDelete()