Full-Stack Development An Intro to Full-Stack Development 4 — Questions and Answers
Question 1: What distinguishes a NoSQL database from a relational (SQL) database?
- NoSQL databases cannot store structured data under any circumstance
- NoSQL databases store data in flexible schemas like documents, key-value pairs, or graphs instead of fixed tables (Correct answer)
- NoSQL databases always outperform SQL databases for every workload
- NoSQL databases do not support any querying mechanism
Correct answer: NoSQL databases store data in flexible schemas like documents, key-value pairs, or graphs instead of fixed tables
NoSQL databases use flexible data models (documents, key-value, column-family, graph) rather than rigid tabular schemas.
Question 2: In the context of JWT authentication, where should a JSON Web Token typically be stored on the client side?
- In the URL query string for every request
- In localStorage or an HttpOnly cookie, with HttpOnly cookies being more secure (Correct answer)
- In the HTML title tag for easy access
- In a global CSS variable
Correct answer: In localStorage or an HttpOnly cookie, with HttpOnly cookies being more secure
JWTs can be stored in localStorage or cookies, but HttpOnly cookies protect against XSS attacks by preventing JS access.
Question 3: Which of the following best describes a 'microservices' architecture compared to a monolith?
- Microservices run all application logic in a single deployable unit
- Microservices decompose the application into small, independently deployable services (Correct answer)
- Microservices eliminate the need for a database by using in-memory storage only
- Microservices require every service to share the same codebase and deployment
Correct answer: Microservices decompose the application into small, independently deployable services
Microservices split an application into small services, each owning its own domain and deployable independently.
Question 4: What is the purpose of a 'package.json' file in a Node.js project?
- It stores the compiled output of TypeScript files
- It defines project metadata, scripts, and dependencies for the npm ecosystem (Correct answer)
- It contains the runtime configuration for the Express server
- It maps URL routes to their handler functions
Correct answer: It defines project metadata, scripts, and dependencies for the npm ecosystem
package.json records project name, version, npm scripts, and both runtime and development dependencies.
Question 5: What HTTP status code indicates that a resource was successfully created by a POST request?
- 200 OK
- 204 No Content
- 201 Created (Correct answer)
- 301 Moved Permanently
Correct answer: 201 Created
201 Created is the standard success response when a POST request results in a new resource being created.
Question 6: Which CSS concept allows a layout to automatically adjust the number of columns based on available screen width?
- CSS Floats
- CSS Grid with auto-fill or auto-fit (Correct answer)
- CSS z-index stacking
- CSS clip-path animations
Correct answer: CSS Grid with auto-fill or auto-fit
CSS Grid's auto-fill and auto-fit keywords let the browser dynamically place columns based on the container width.
Question 7: What is the main purpose of a load balancer in a production full-stack environment?
- To compile and bundle front-end JavaScript files
- To distribute incoming traffic across multiple server instances (Correct answer)
- To encrypt database connections using TLS
- To manage user session tokens and rotate them regularly
Correct answer: To distribute incoming traffic across multiple server instances
A load balancer spreads requests across multiple server instances to prevent any single server from becoming a bottleneck.
What distinguishes a NoSQL database from a relational (SQL) database?