Practice
1. A browser needs to resolve a domain name to an IP address but wants to avoid repeated queries to external servers for the same domain within a short time. Which component in the DNS resolution chain primarily handles this optimization?
easy
Solution
Step 1: Identify the role of the local DNS resolver
The local DNS resolver (stub resolver) on the user's machine caches recent DNS lookups to avoid repeated network queries for the same domain within a short time.Step 2: Eliminate other options
Authoritative DNS servers provide domain data but do not cache queries for clients. Root servers do not cache all mappings globally and are rarely queried directly. Recursive DNS servers do cache results to improve performance, so The recursive DNS server, which never caches results and always queries authoritative servers is incorrect.Final Answer:
Option B -> Option BQuick Check:
Local resolver caches to reduce network calls [check]
Hint: Local resolver caches recent lookups to reduce queries [check]
Common Mistakes:
2. In a microservices architecture, a client request flows through API Gateway -> Auth Service -> Order Service -> Inventory Service. At step 3, the Order Service calls Inventory Service synchronously. What happens if Inventory Service is slow at step 3?
easy
Solution
Step 1: Trace synchronous call behavior at step 3
Order Service calls Inventory Service synchronously, so it waits for response before replying to client.Step 2: Analyze impact of slow Inventory Service
Because of synchronous call, client request blocks until Inventory Service responds or times out; no immediate return or retries happen automatically.Final Answer:
Option D -> Option DQuick Check:
Synchronous calls block caller until response or timeout [check]
Hint: Synchronous calls block caller until response or timeout [check]
Common Mistakes:
3. A messaging system must decouple high-throughput message producers from multiple independent consumers subscribing to different topics. Which component best handles this decoupling and ensures message durability?
easy
Solution
Step 1: Identify decoupling and durability needs
In-memory queues (Use a simple in-memory queue on the producer server to buffer messages) lack durability and don't scale across servers. Direct HTTP push (Use a direct HTTP push from producer to each consumer) tightly couples producer and consumers, causing backpressure issues. Polling a relational DB (Use a relational database with polling by consumers) adds latency and load on DB, unsuitable for high throughput.Step 2: Recognize Kafka's role
Kafka's distributed log with topic partitions decouples producers and consumers, provides durability, and supports high throughput with consumer groups.Final Answer:
Option A -> Option AQuick Check:
Kafka partitions enable durable, scalable decoupling [check]
Hint: Distributed logs decouple producers and consumers reliably [OK]
Common Mistakes:
4. Without the Expiration Worker component, what exactly breaks in the Pastebin system?
medium
Solution
Step 1: Identify Expiration Worker's role
It removes expired snippets to free storage and prevent stale data serving.Step 2: Trace failure impact without Expiration Worker
Expired snippets accumulate indefinitely, increasing storage and possibly serving stale content.Final Answer:
Option A -> Option AQuick Check:
Without expiration cleanup, storage bloat and stale data occur [check]
Hint: No expiration worker -> storage bloat and stale snippets served [check]
Common Mistakes:
5. You need to implement a live news feed with many clients receiving frequent updates but no client-to-server messages. Which technology is best considering scalability and simplicity?
medium
Solution
Step 1: Analyze communication pattern
Live news feed requires unidirectional server-to-client updates with many clients and no client messages.Step 2: Evaluate technology trade-offs
Server-Sent Events efficiently support unidirectional streaming with automatic reconnection and lower overhead than WebSockets. WebSockets add complexity and resource usage for no client-to-server messages. Long Polling is less efficient due to repeated HTTP requests. HTTP/2 server push is not widely supported for this use case.Final Answer:
Option B -> Option BQuick Check:
Server-Sent Events optimize unidirectional streaming with scalability [check]
Hint: Unidirectional + many clients -> Server-Sent Events [check]
Common Mistakes:
