Full-Stack Development Development Sample 3 — Questions and Answers
Question 1: What is the main advantage of using environment variables for API keys in a full-stack application?
- They improve API response speed
- They prevent secrets from being hardcoded in source code (Correct answer)
- They automatically rotate credentials
- They compress key size
Correct answer: They prevent secrets from being hardcoded in source code
Environment variables keep secrets out of the codebase and version control, reducing the risk of accidental exposure.
Question 2: In CSS, which property controls the stacking order of overlapping elements?
- opacity
- z-index (Correct answer)
- position
- overflow
Correct answer: z-index
z-index determines which element appears on top when elements overlap, with higher values appearing in front.
Question 3: Which of the following best describes 'idempotency' in REST APIs?
- A request that always returns JSON
- A request that can be sent multiple times with the same result (Correct answer)
- A request that never modifies data
- A request authenticated with a token
Correct answer: A request that can be sent multiple times with the same result
An idempotent operation produces the same server state no matter how many times it is applied with the same input.
Question 4: What does 'lazy loading' mean in the context of a web application?
- Caching responses in a service worker
- Loading resources only when they are needed (Correct answer)
- Deferring CSS until after JavaScript loads
- Prefetching all page assets on first visit
Correct answer: Loading resources only when they are needed
Lazy loading defers the download of non-critical resources until they are actually required, improving initial page load time.
Question 5: In Git, what command merges a feature branch into the current branch while preserving a linear commit history via replay?
- git merge
- git rebase (Correct answer)
- git cherry-pick
- git stash
Correct answer: git rebase
git rebase replays commits from one branch on top of another, creating a linear history without a merge commit.
Question 6: Which JavaScript operator is used to safely access a deeply nested property without throwing if an intermediate value is null or undefined?
- Nullish coalescing (??)
- Logical OR (||)
- Optional chaining (?.) (Correct answer)
- Spread (...)
Correct answer: Optional chaining (?.)
Optional chaining (?.) short-circuits and returns undefined instead of throwing a TypeError when a property in the chain is nullish.
Question 7: What is the role of a reverse proxy like Nginx in a full-stack deployment?
- It compiles TypeScript to JavaScript
- It manages database connections
- It forwards client requests to backend servers and handles SSL termination (Correct answer)
- It runs unit tests before deployment
Correct answer: It forwards client requests to backend servers and handles SSL termination
A reverse proxy sits in front of application servers, routing traffic, terminating TLS, and optionally caching responses.
What is the main advantage of using environment variables for API keys in a full-stack application?