Backend Developer Interview Preparation
Backend Developer Interview Preparation
and async/await.
- **Callbacks**: A function passed as an argument to another function. Once the asynchronous task
is complete, the callback function is executed. It can lead to 'callback hell' if nested too deeply.
Promises provide `then()` and `catch()` methods for handling success and errors.
synchronous-looking style. The `async` keyword is used to define a function, and `await` is used to
- Implement CRUD operations using appropriate HTTP methods (GET, POST, PUT, DELETE).
- Ensure stateless communication, where each request from a client contains all the information
Q: How do you manage memory and handle high concurrency in Node.js applications?
- Use the `cluster` module or a process manager like PM2 to scale applications across multiple CPU
cores.
- Monitor memory usage using tools like `heapdump` or `v8-profiler` and handle potential memory
leaks.
A: - **Horizontal Scaling**: Increase the number of instances of the application and distribute traffic
- **Vertical Scaling**: Increase the computational power (CPU, RAM) of the machine running the
Node.js application.
A: Go routines are lightweight, managed by the Go runtime, and are used for concurrent
programming. Unlike threads, they are multiplexed onto a smaller number of OS threads, allowing
Q: Explain how channels work in Go and how you would use them in a concurrent
application.
A: Channels in Go are used for communication between Go routines. They allow Go routines to
send and receive values to synchronize their execution. In a concurrent application, channels are