Practice
1. A system must enforce a maximum number of API calls per user per minute to prevent abuse. Which component in an API Gateway architecture is best suited to handle this requirement?
easy
Solution
Step 1: Identify rate limiting responsibility
The API Gateway is the entry point and can efficiently enforce rate limits before requests reach backend services, preventing overload.Step 2: Eliminate other options
The backend microservices implement rate limiting individually to distribute load spreads rate limiting, risking inconsistent enforcement and backend overload. A centralized database tracks request counts and enforces limits synchronously adds latency and complexity by synchronous DB checks. Clients are responsible for self-throttling their request rates trusts clients, which is insecure.Final Answer:
Option A -> Option AQuick Check:
API Gateway enforces rate limits upfront to protect backend [check]
Hint: Rate limiting belongs at the gateway entry point [check]
Common Mistakes:
2. In a system using HyperLogLog to estimate daily unique users, at step 3 the Aggregator merges multiple HyperLogLog sketches from different servers. What is the state of the merged sketch immediately after this step?
easy
Solution
Step 1: Understand HyperLogLog merge operation
Merging HyperLogLog sketches combines their registers by taking the maximum per register, producing an approximate union.Step 2: Check what the merged sketch represents
The merged sketch approximates the cardinality of the union of all input sets, not exact IDs or duplicates.Final Answer:
Option B -> Option BQuick Check:
HyperLogLog merge -> approximate union, not exact data [check]
Hint: Merge = max registers -> approximate union preserved [check]
Common Mistakes:
3. If the origin server becomes unreachable, what exactly breaks in a CDN using origin pull with TTL caching?
medium
Solution
Step 1: Understand origin pull with TTL caching failure
When origin is unreachable, edge nodes serve cached content until TTL expires.Step 2: Identify behavior after TTL expiry
After TTL expires, edge nodes cannot refresh content and must return errors for new requests.Final Answer:
Option C -> Option CQuick Check:
Origin down + expired TTL -> edge nodes return errors [check]
Hint: Expired TTL + origin down -> errors returned [check]
Common Mistakes:
4. If the Kafka cluster used for buffering document update events becomes unavailable, what is the immediate failure mode in the full-text search indexing pipeline?
medium
Solution
Step 1: Understand Kafka unavailability impact
Without Kafka, ingestion of new document updates cannot proceed, causing blocking or stalling.Step 2: Evaluate options
Indexing workers do not have local caches of events (A) and cannot continue processing. Automatic failover to a backup queue with identical ordering (C) is a designed mitigation. Index corruption (D) does not happen immediately; missing events cause stale results but not corruption.Final Answer:
Option A -> Option AQuick Check:
Failover to backup queue prevents pipeline stall [check]
Hint: Kafka outage stalls ingestion unless backup queue with ordering [check]
Common Mistakes:
5. For a social media feed requiring low-latency reads and flexible schema, which database choice is better and why?
medium
Solution
Step 1: Analyze read latency and schema flexibility needs
Social feeds require fast reads and flexible schema to handle diverse content types.Step 2: Compare database options
Relational DBs have join overhead; graph DBs excel at relationships but not high-volume feed reads; in-memory cache alone lacks persistence.Step 3: Justify wide-column NoSQL choice
Wide-column stores denormalize data for fast reads and support flexible schemas, fitting feed requirements.Final Answer:
Option B -> Option BQuick Check:
Wide-column NoSQL -> denormalized, low-latency reads [check]
Hint: Low-latency feed -> denormalized wide-column store [check]
Common Mistakes:
