Full-Stack Development An Intro to Full-Stack Development 3 — Questions and Answers
Question 1: Which of the following is a JavaScript runtime that allows developers to run JS code on the server side?
- Django
- Node.js (Correct answer)
- Laravel
- Spring Boot
Correct answer: Node.js
Node.js is a JavaScript runtime built on Chrome's V8 engine that enables server-side JavaScript execution.
Question 2: What does CORS stand for and why does it matter in full-stack development?
- Client-Origin Resource Sharing — controls which clients can read responses
- Cross-Origin Resource Sharing — controls which domains can access your API (Correct answer)
- Cached Object Request Standard — controls how responses are cached
- Content-Only Rendering Spec — controls SSR behavior
Correct answer: Cross-Origin Resource Sharing — controls which domains can access your API
CORS (Cross-Origin Resource Sharing) is a browser security feature that restricts cross-domain HTTP requests unless the server explicitly allows them.
Question 3: In a React single-page application, what happens when the user navigates to a new route?
- The browser fetches a new HTML file from the server
- JavaScript intercepts the navigation and renders a new component without a full page reload (Correct answer)
- The server sends a redirect response to the new page URL
- The browser clears all state and re-executes the root script
Correct answer: JavaScript intercepts the navigation and renders a new component without a full page reload
React Router (or similar) intercepts navigation events and renders new components client-side, keeping the page loaded.
Question 4: What is the primary advantage of using environment variables in a full-stack application?
- They improve application rendering performance at runtime
- They allow sensitive configuration values to be kept out of source code (Correct answer)
- They enable hot-module replacement during development
- They automatically document API endpoints for developers
Correct answer: They allow sensitive configuration values to be kept out of source code
Environment variables store secrets like API keys and DB passwords separately from code, preventing them from being committed to version control.
Question 5: Which SQL clause is used to filter rows returned by a query?
- ORDER BY
- GROUP BY
- WHERE (Correct answer)
- HAVING
Correct answer: WHERE
The WHERE clause filters individual rows before any grouping or aggregation occurs.
Question 6: What is 'middleware' in the context of an Express.js application?
- A database connection pool shared between routes
- A function that has access to the request, response, and next function in the cycle (Correct answer)
- A front-end component that bridges the UI and the API
- A caching layer between the server and the database
Correct answer: A function that has access to the request, response, and next function in the cycle
Express middleware are functions that execute during the request-response cycle and can modify req/res or pass control to the next middleware.
Question 7: Which protocol do WebSockets use to establish a connection?
- They start with an HTTP handshake then upgrade to the WebSocket protocol (Correct answer)
- They use UDP directly for low-latency streaming
- They open a raw TCP connection without any HTTP involvement
- They rely on HTTP/2 multiplexing exclusively
Correct answer: They start with an HTTP handshake then upgrade to the WebSocket protocol
WebSocket connections begin with an HTTP Upgrade handshake, then switch to the full-duplex WebSocket protocol.
Which of the following is a JavaScript runtime that allows developers to run JS code on the server side?