Full-Stack Development Technology & Digital Applications 5 — Questions and Answers
Question 1: What is the main benefit of using WebSockets over HTTP polling for real-time features?
- WebSockets use less CPU on the client device
- WebSockets provide a persistent, full-duplex channel eliminating repeated request overhead (Correct answer)
- WebSockets are always encrypted by default unlike HTTP
- WebSockets bypass browser same-origin restrictions
Correct answer: WebSockets provide a persistent, full-duplex channel eliminating repeated request overhead
After the handshake, a WebSocket connection stays open, allowing both client and server to send messages instantly without the overhead of repeated HTTP requests.
Question 2: In semantic versioning (SemVer), when should the major version number be incremented?
- When adding new backwards-compatible functionality
- When making backwards-incompatible (breaking) API changes (Correct answer)
- When releasing bug fixes that don't affect the public API
- When updating documentation or build tooling only
Correct answer: When making backwards-incompatible (breaking) API changes
SemVer's major version signals breaking changes that require consumers to update their code to remain compatible.
Question 3: Which approach best describes server-side rendering (SSR) in a Next.js application?
- The browser downloads JavaScript and generates all HTML on the client
- HTML is generated on the server per request and sent to the client, improving initial load and SEO (Correct answer)
- Static HTML files are pre-built at deploy time and served from a CDN
- The server streams raw JSON that React hydrates into HTML without any server HTML output
Correct answer: HTML is generated on the server per request and sent to the client, improving initial load and SEO
With SSR, Next.js generates the full HTML on the server for each request, giving search engines crawlable content and users a faster first paint.
Question 4: What is the purpose of database indexing, and what is its main trade-off?
- Indexing encrypts column data for security; trade-off is slower writes
- Indexing speeds up read queries on indexed columns; trade-off is additional storage and slower writes (Correct answer)
- Indexing enforces foreign key constraints; trade-off is increased query complexity
- Indexing caches query results in memory; trade-off is stale data
Correct answer: Indexing speeds up read queries on indexed columns; trade-off is additional storage and slower writes
An index creates an auxiliary data structure that allows the database to locate rows faster, but it must be updated on every write, adding overhead.
Question 5: In OAuth 2.0, what does the authorization code flow provide that the implicit flow does not?
- Support for mobile applications
- The access token is exchanged server-to-server, never exposed to the browser (Correct answer)
- Refresh token capabilities only available in authorization code flow
- Multi-factor authentication support
Correct answer: The access token is exchanged server-to-server, never exposed to the browser
The authorization code flow keeps the access token out of the browser by exchanging the short-lived code server-side, preventing token exposure in browser history or logs.
Question 6: Which tool category is used to analyze and improve Core Web Vitals like Largest Contentful Paint (LCP) and Cumulative Layout Shift (CLS)?
- Static code linters such as ESLint
- Performance profiling tools such as Lighthouse or WebPageTest (Correct answer)
- Unit testing frameworks such as Jest
- API mocking libraries such as MSW
Correct answer: Performance profiling tools such as Lighthouse or WebPageTest
Lighthouse and similar tools measure real-world performance metrics defined by the Core Web Vitals initiative that Google uses as ranking signals.
Question 7: What is the primary function of a reverse proxy in a web application deployment?
- It forwards client requests to internal servers, hiding their addresses and enabling load balancing, caching, and SSL termination (Correct answer)
- It routes traffic from the server back to the originating client
- It proxies database queries to reduce connection pool usage
- It caches DNS lookups to speed up domain resolution
Correct answer: It forwards client requests to internal servers, hiding their addresses and enabling load balancing, caching, and SSL termination
A reverse proxy (e.g., Nginx) sits in front of backend servers, distributing load, terminating TLS, and shielding internal infrastructure from direct client access.
What is the main benefit of using WebSockets over HTTP polling for real-time features?