Practice
1. In the request flow of a real-time ML inference system, at Step 4 the Model Router receives a prediction request. What happens if the system is currently in shadow mode with a new model deployed?
easy
Solution
Step 1: Understand shadow mode request routing
Shadow mode runs new models in parallel without affecting live traffic. So, requests are sent to both models.Step 2: Identify response behavior
Only the production model's prediction is returned to the client; shadow model predictions are logged for evaluation.Final Answer:
Option A -> Option AQuick Check:
Shadow mode duplicates requests but returns production output [check]
Hint: Shadow mode duplicates requests; only production output returned [OK]
Common Mistakes:
2. In the order processing pipeline, at step 5 the Inventory Service checks stock availability. What is the state of the order if the Inventory Service finds insufficient stock at this step?
easy
Solution
Step 1: Trace Inventory Service check at Step 5
Inventory Service detects insufficient stock and cannot confirm order immediately.Step 2: Understand retry mechanism
System updates order to 'Pending Stock' and enqueues it for retry once stock replenishes, avoiding immediate cancellation or false confirmation.Final Answer:
Option C -> Option CQuick Check:
Insufficient stock -> 'Pending Stock' + retry queue [check]
Hint: Insufficient stock triggers retry queue, not immediate cancel [check]
Common Mistakes:
3. A REST API needs to support clients fetching large lists of user records without overwhelming the server or client memory. Which design principle best addresses this requirement?
easy
Solution
Step 1: Identify the need to limit response size
Fetching large lists risks high memory usage and slow responses; pagination limits data per request.Step 2: Recognize pagination as the standard REST approach
Using query parameters likepageandlimitallows clients to request manageable chunks.Final Answer:
Option A -> Option AQuick Check:
Pagination with query params controls response size [check]
Hint: Paginate large lists with query params [check]
Common Mistakes:
4. For a high-traffic e-commerce site needing to invalidate product pages immediately after price updates, which cache invalidation strategy is best and why?
medium
Solution
Step 1: Identify need for immediate, atomic invalidation
Price updates require instant invalidation of all related pages to avoid stale data.Step 2: Evaluate strategies
Long TTL with manual purge delays invalidation; short TTL causes high cache misses; client-side headers don't guarantee server cache invalidation; surrogate keys enable atomic invalidation of related content.Final Answer:
Option A -> Option AQuick Check:
Surrogate keys enable atomic, immediate invalidation of related cache [check]
Hint: Surrogate keys invalidate related content atomically [check]
Common Mistakes:
5. For a globally distributed system requiring unique IDs with strict time ordering, which approach is best considering clock skew and network latency?
medium
Solution
Step 1: Evaluate centralized timestamp authority
Centralized authority (A) creates a bottleneck and single point of failure, unsuitable for global scale.Step 2: Assess UUID v1 and random IDs
UUID v1 (C) includes MAC and timestamp but has weak ordering guarantees and privacy concerns; random IDs (D) lack ordering.Step 3: Analyze Snowflake approach
Snowflake (B) uses synchronized clocks and machine IDs to generate unique, time-ordered IDs locally, tolerating minor clock skew with sequence numbers.Final Answer:
Option B -> Option BQuick Check:
Snowflake balances ordering and decentralization despite clock skew [check]
Hint: Local generation with synced clocks beats centralized bottlenecks [OK]
Common Mistakes:
