Full-Stack Development Technology & Digital Applications 2 — Questions and Answers
Question 1: Which HTTP status code should a REST API return when a client successfully creates a new resource?
- 200 OK
- 201 Created (Correct answer)
- 204 No Content
- 202 Accepted
Correct answer: 201 Created
201 Created is the correct status when a POST request successfully creates a new resource, and the response typically includes the new resource's URI.
Question 2: In a progressive web app (PWA), which technology enables offline functionality by intercepting network requests?
- Web Workers
- Service Workers (Correct answer)
- IndexedDB
- WebSockets
Correct answer: Service Workers
Service Workers act as a proxy between the browser and network, caching responses and serving them when the network is unavailable.
Question 3: What is the primary purpose of a Content Delivery Network (CDN) in web applications?
- To compress server-side code
- To serve static assets from geographically distributed edge servers (Correct answer)
- To manage database replication
- To encrypt API payloads end-to-end
Correct answer: To serve static assets from geographically distributed edge servers
CDNs cache and serve static assets from edge servers close to users, reducing latency and offloading origin server traffic.
Question 4: Which design pattern separates an application into three interconnected components: model, view, and controller?
- Observer
- Singleton
- MVC (Correct answer)
- Factory
Correct answer: MVC
MVC (Model-View-Controller) divides application logic so that each component has a distinct responsibility, improving maintainability.
Question 5: What does CORS stand for, and what problem does it solve?
- Content Origin Relay System — speeds up asset loading
- Cross-Origin Resource Sharing — allows controlled cross-domain HTTP requests (Correct answer)
- Cached Object Retrieval System — reduces database calls
- Client-side Object Rendering Schema — defines UI components
Correct answer: Cross-Origin Resource Sharing — allows controlled cross-domain HTTP requests
CORS is a browser security mechanism that lets servers declare which origins may access their resources via HTTP headers.
Question 6: In containerized deployments, what is the role of a container orchestration platform like Kubernetes?
- Compiling application source code into container images
- Automating deployment, scaling, and management of containerized applications (Correct answer)
- Replacing Docker as a container runtime
- Providing a GUI for container image creation
Correct answer: Automating deployment, scaling, and management of containerized applications
Kubernetes automates container scheduling, scaling, load balancing, and self-healing across a cluster of nodes.
Question 7: Which JavaScript concept allows a function to access variables from its outer scope even after the outer function has returned?
- Prototype chain
- Closure (Correct answer)
- Event loop
- Hoisting
Correct answer: Closure
A closure is formed when an inner function retains a reference to its outer function's scope, preserving those variables in memory.
Which HTTP status code should a REST API return when a client successfully creates a new resource?