Back-End Development Basics of Back End Development 3 — Questions and Answers
Question 1: Which of the following is a characteristic of a NoSQL document database like MongoDB?
- Enforces a strict schema for every record
- Stores data as flexible JSON-like documents (Correct answer)
- Requires JOIN operations to relate data
- Uses tables and foreign keys as its primary structure
Correct answer: Stores data as flexible JSON-like documents
Document databases store records as self-contained JSON-like documents, allowing flexible and nested data structures without a fixed schema.
Question 2: What does horizontal scaling mean for a back-end server?
- Increasing the CPU and RAM of an existing server
- Adding more server instances to distribute load (Correct answer)
- Partitioning a database across multiple drives on one machine
- Upgrading the server's network bandwidth
Correct answer: Adding more server instances to distribute load
Horizontal scaling (scaling out) adds more machines or instances, while vertical scaling (scaling up) increases resources on a single machine.
Question 3: Which protocol is most commonly used for real-time, bidirectional communication between a browser and a server?
- FTP
- SMTP
- WebSocket (Correct answer)
- HTTP/1.1 long polling
Correct answer: WebSocket
WebSocket provides a persistent, full-duplex channel over a single TCP connection, enabling real-time communication without repeated HTTP overhead.
Question 4: What is a race condition in a back-end context?
- Two database indexes competing for the same query plan
- A bug where outcome depends on unpredictable timing of concurrent operations (Correct answer)
- A CPU scheduling conflict between two Node.js processes
- A network timeout caused by a slow external API
Correct answer: A bug where outcome depends on unpredictable timing of concurrent operations
A race condition occurs when multiple operations access shared state concurrently and the final result depends on the order of execution, leading to inconsistent behavior.
Question 5: Which of the following best describes an idempotent HTTP method?
- A method that always returns the same body regardless of input
- A method that can be called multiple times without changing the result beyond the first call (Correct answer)
- A method that requires authentication on every request
- A method that caches the response automatically
Correct answer: A method that can be called multiple times without changing the result beyond the first call
An idempotent method produces the same server state whether it is called once or many times; GET, PUT, and DELETE are idempotent, while POST generally is not.
Question 6: In back-end development, what is connection pooling used for?
- Aggregating multiple API responses into one payload
- Reusing a set of established database connections to reduce overhead (Correct answer)
- Distributing requests across multiple geographic regions
- Compressing database query strings before transmission
Correct answer: Reusing a set of established database connections to reduce overhead
Connection pooling maintains a pool of open database connections that can be reused, avoiding the expensive cost of opening a new connection for every request.
Question 7: Which HTTP method is considered safe according to the HTTP specification?
- POST
- PUT
- DELETE
- GET (Correct answer)
Correct answer: GET
GET is considered 'safe' because it should only retrieve data and not modify server state, whereas POST, PUT, and DELETE can alter resources.
Which of the following is a characteristic of a NoSQL document database like MongoDB?