Top 100 Backend Software Engineer Practice MCQs
Every question on one page: open one, choose an answer, and see why at once. Signed in, your latest answer to each question counts, and you can answer again after 24 hours.
Curated: · Written: · Reviewed:
Answers to reviewed questions count toward this role and the overall leaderboard; your latest answer to each one is the one that counts.
MCQ-1A Java 17 service keeps 40,000 entries in a `HashMap<Token, String>` that has grown to a 65,536-slot table. `Token` overrides `hashCode` to return a constant and does not implement `Comparable`. An attacker sends missing keys that all land in one bin. Roughly how many `equals` calls does one `get()` cost in the worst case?
Answer to see the discussion.
MCQ-2A matcher searches s = 'ADOBECODEBANC' for the shortest substring containing every character of t = 'ABC' with its multiplicity. The current window is 'ADOBEC', which is valid, and left sits on 'A' at index 0. Which per-character test decides whether left advances?
Answer to see the discussion.
MCQ-3A fraud service reads a single forward stream of 500,000 transaction amounts in cents, each an integer from 0 to 999,999, and must report whether any two different positions sum to a target. The worker is a 64-bit JVM with a 4 MB heap cap, and a second pass over the stream is not possible. Which design answers exactly in one pass within the cap?
Answer to see the discussion.
MCQ-4A telemetry job in a Java 17 service computes, for each of 200,000 hourly temperature readings, how many readings until a warmer one. It keeps a stack of indices: for each reading it pops while the top reading is cooler, then pushes the current index. Across one full run, what is the most inner-loop comparisons the job can make?
Answer to see the discussion.
MCQ-5A Java 17 ingest service binary-searches a sorted `int[]` on its first step with `lo = 1,500,000,000` and `hi = 2,000,000,000`, computing `int mid = (lo + hi) / 2;` with 32-bit signed arithmetic. What value does `mid` hold after that line runs?
Answer to see the discussion.
MCQ-6A Java 17 ingest worker reverses a singly linked list 1→2→3→4→null in place, holding only `head`. Its loop body is `curr.next = prev; Node next = curr.next; prev = curr; curr = next;`, with `prev` null and `curr` set to `head` before the loop. What does the method return?
Answer to see the discussion.
MCQ-7A session-routing service walks a singly linked list with a slow pointer (one step per move) and a fast pointer (two steps) from the head. The tail before the cycle has 4 nodes and the cycle has 6, and the pointers first meet 2 nodes past the entry. To find the entry without another full lap, the team resets one pointer to the head and keeps the other at the meeting node. Which setup finds the entry, and where do the pointers meet?
Answer to see the discussion.
MCQ-8A Java 17 session index keys an unbalanced BST by expiry time in seconds. Deleting node 50 must use the in-order successor. Node 50's left subtree has maximum 45, and its right subtree is rooted at 70 with left child 60, whose left child is 55; 55 has right child 58. Which replacement and relinking keep the in-order sequence intact?
Answer to see the discussion.
MCQ-9A build scheduler stores six targets as a directed graph with edges 1→2, 1→3, 3→2 and 2→4. It runs a depth-first search from 1 with the undirected rule: skip a neighbour equal to the current node's parent, and report a cycle whenever an unskipped neighbour is already visited. What does it report?
Answer to see the discussion.
MCQ-10A routing service finds the cheapest cost from source S over a directed graph with edges S→A weight 3, S→B weight 6, A→C weight 1 and B→C weight -4. The weights are contract rates that can be negative, and the graph has no negative cycle. Which algorithm should the service use, and what cost does it report for C?
Answer to see the discussion.
MCQ-11A Backend Software Engineer's scheduler loads seven priority values 90, 80, 70, 60, 50, 40, 30 into a min-heap stored as an array with the root at index 0. Method A calls heapify bottom-up on the full array as given. Method B inserts the values in that order, one at a time, into an empty heap. Each exchange of a node with its parent or child counts as one swap. How many swaps does each method perform?
Answer to see the discussion.
MCQ-12A Backend Software Engineer's change service counts ways to make 6 cents from 1, 2 and 5 cent coins, with the coins as the outer loop of a DP over amounts. Which count does the service's `ways[6]` report for 6 cents?
Answer to see the discussion.
MCQ-13A Spotify-style ingest worker may run at most one copy of each of three jobs: A weighs 2 and pays 3, B weighs 3 and pays 4, C weighs 4 and pays 5, and capacity is 6. The team keeps one `dp` array and, for each job, loops capacity upward from 0 to 6 with `dp[c] = Math.max(dp[c], dp[c - w] + v)`. What value does the worker report?
Answer to see the discussion.
MCQ-14A Backend Software Engineer's deduplication service tracks 65,536 device IDs with union-find using path compression and union by rank. It runs 1,000,000 mixed union and find operations in one batch, with no reset between them. Which total pointer-step bound should the capacity plan use?
Answer to see the discussion.
MCQ-15A build scheduler runs Kahn's algorithm on six targets A to F with edges A→B, B→C, C→D, D→B, A→E and E→F. It repeatedly pops targets whose in-degree is zero until the queue is empty. What does it report?
Answer to see the discussion.
MCQ-16A client holds order 118 from its last GET, with ETag `v7`, and needs to append one line item and set a new delivery note. Its PATCH uses a JSON Patch (RFC 6902) add op on `/items/-` and times out with no response. Meanwhile another client saved the order, so the stored ETag is now `v8`. Which retry is safe?
Answer to see the discussion.
MCQ-17An order service stores each order with an ETag that changes on every save. A client read the order at ETag "v7", but another client has already saved a newer version. The client's PUT carries `If-Match: "v7"` and a valid body, and the server evaluates the precondition before it writes. What response does the server return, and what happens to the stored order?
Answer to see the discussion.
MCQ-18A Postgres 16 leaderboard API pages with `ORDER BY points DESC LIMIT 25` and a keyset cursor that stores only the last row's points, queried as `WHERE points < $1`. Points are integers, so many rows share a value. Page 1 ends on a row with 80 points, and three more rows with 80 points sit just past the boundary. What does page 2 return?
Answer to see the discussion.
MCQ-19A Node 20 API issues JWTs signed with RS256 and verifies them with the issuer's RSA public key, which is published openly. An attacker rewrites a token's alg header to HS256 and signs it using the public key bytes as the HMAC secret. Which verifier setting makes this forgery fail?
Answer to see the discussion.
MCQ-20A single-page app holds a rotating refresh token. The authorization server marks each token used the moment it is exchanged, and every token from one login shares a family ID. The app exchanged R1 for R2, then R2 for R3. Now an attacker who stole R1 earlier presents R1 to the token endpoint. What should the server do with this request?
Answer to see the discussion.
MCQ-21A Postgres 16 job lists customers who are not VIP. The customers table has 1,200 rows with ids 1 to 1,200. The vip_list table holds customer_id values 4, 9 and 17 plus one row with a NULL customer_id. Query A is `SELECT id FROM customers WHERE id NOT IN (SELECT customer_id FROM vip_list)`. Query B applies the same filter with `NOT EXISTS (SELECT 1 FROM vip_list v WHERE v.customer_id = c.id)`. What do A and B return?
Answer to see the discussion.
MCQ-22A reporting query runs `SELECT c.id, o.id FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.status = 'paid'`. Four customers have no orders and two more have only unpaid orders. Which customers appear in the result?
Answer to see the discussion.
MCQ-23A Postgres 16 table of 40 million rows has an index on (a, b, c). The hot query is WHERE a = 7 AND b > 100 AND c = 'x', and EXPLAIN shows Index Cond on a and b, with a Filter on c that removes 2.1 million of the 2.3 million rows the index range returns. Which change lets c narrow the index scan itself?
Answer to see the discussion.
MCQ-24A Postgres 16 orders table has an index on (customer_id, created_at). The report SELECT created_at, total FROM orders WHERE customer_id = $1 AND created_at >= now() - interval '1 year' returns 18,400 rows and runs as an Index Scan, with only 2% of heap pages all-visible. The team rebuilds the index as (customer_id, created_at) INCLUDE (total). What plan should they expect?
Answer to see the discussion.
MCQ-25A Postgres 16 scheduler enforces that each ward keeps at least one doctor on call. Two transactions run at REPEATABLE READ on ward 7. Each counts on-call doctors, sees 2, then sets its own doctor to off. Both commit and the ward has nobody on call, while unrelated wards keep running. Which change stops this without locking every ward row?
Answer to see the discussion.
MCQ-26A PostgreSQL 16 payments job runs `SELECT COUNT(*) FROM orders WHERE status = 'paid'` twice inside one transaction. Between the two counts, another session inserts and commits a new paid order. Which isolation level makes the second count match the first?
Answer to see the discussion.
MCQ-27A shipping service reads order 118 at version 7 with status `packed`, then runs `UPDATE orders SET status = 'shipped', version = version + 1 WHERE id = 118 AND version = 7` on Postgres 16. Meanwhile a support session committed status `cancelled` at version 8. The UPDATE reports 0 rows affected. What should the service do next?
Answer to see the discussion.
MCQ-28An order service writes each order and its outbox row in one Postgres transaction. A relay polls the outbox every 500 ms, publishes each row to Kafka, and marks it sent after the broker acknowledges. The relay pod is killed after the ack for event 8841 but before the sent update commits, so on restart it publishes 8841 again. The payment consumer has already charged for 8841. Which change makes the charge happen exactly once?
Answer to see the discussion.
MCQ-29A payments API stores each `Idempotency-Key` with the response it produced. A client retries a POST with the same key while the first request is still processing and no response has been saved yet. What should the server return to the retry?
Answer to see the discussion.
MCQ-30A telemetry table in Cassandra 4.1 uses `hour_bucket`, the event time truncated to the hour, as its partition key, with `device_id` as clustering column. Ingest runs at 90,000 writes/s, all landing in the current hour, and one node takes almost every write. The dashboard reads the last 24 hours for one device and must be served by a single partition read per device. Which key change fixes the hot node without breaking that read?
Answer to see the discussion.
MCQ-31A Redis 7.2 instance has maxmemory set to 4 GB and is nearly full. It holds about 300,000 user sessions, each written with a 30-minute TTL, and 12,000 feature-flag hashes written with no TTL that must never be evicted. Sessions can be dropped in least-recently-used order when memory runs short. Which maxmemory-policy should the team set?
Answer to see the discussion.
MCQ-32A cache tier runs four nodes on a hash ring of positions 0 to 99, each placed at one point: A at 10, B at 20, C at 30, D at 90. A key goes to the first node clockwise from its hash, wrapping past 99 to 0. Across 100,000 uniformly hashed keys, what share does each node receive?
Answer to see the discussion.
MCQ-33A user reads an order as `shipped` from one replica, then refreshes and sees `packed` from a replica that is 3 seconds behind. Which guarantee has the user lost?
Answer to see the discussion.
MCQ-34A Dynamo-style store runs N=3, W=2, R=2 with home replicas A, B and C for a key. During a partition, a write is acknowledged by A and D, where D is a sloppy-quorum stand-in outside the key's home set, and the hinted handoff to D has not yet been delivered. Later, a read contacts only B and C and gets both responses. What does it return?
Answer to see the discussion.
MCQ-35A Kafka consumer in group orders-billing has enable.auto.commit set to false and calls commitSync() on each batch before its handler runs. The batch holds offsets 1000 to 1499 from partition 3, and the process is killed after the handler finishes offsets 1000 to 1299. What does the group resume from after restart?
Answer to see the discussion.
MCQ-36An order service writes order 5521's events to one 12-partition topic, orders.events. Checkout produces OrderPlaced and OrderPaid keyed by order_id, the warehouse produces OrderPacked keyed by warehouse_id, and the carrier integration produces OrderShipped keyed by carrier_id. A single consumer group reads the topic. Which pair of events for order 5521 is guaranteed to be consumed in the order it was produced?
Answer to see the discussion.
MCQ-37A standard SQS queue has a 30-second visibility timeout and no redrive policy. A consumer receives one message and needs 90 seconds to process it, and it never calls ChangeMessageVisibility. What happens to that message?
Answer to see the discussion.
MCQ-382,000 clients of a payments API all receive a 503 at t=0 and retry. Fixed backoff sleeps exactly 1 s before the first retry, while full jitter sleeps a uniform random time between 0 and 2 s. How many of the 2,000 retries fall in the 100 ms window from 0.5 s to 0.6 s under full jitter, and how many under fixed backoff?
Answer to see the discussion.
MCQ-39A product page key is cached for 60 seconds and rebuilt by a 400 ms database query. At expiry, 2,000 requests per second arrive for that key. The team adds a per-key lock: the first miss takes it and rebuilds, and other misses wait for the lock. How many database rebuilds run during the 400 ms after expiry, and what do the waiting requests do?
Answer to see the discussion.
MCQ-40A write-back cache node holds dirty entries and flushes them to the database every 10 seconds. Key a is written at 2 s and again at 12 s, key b is written at 8 s, and key c is written at 13 s. The node crashes at 14 s before its next flush and restarts with only the database. What does a read return for a and for c after restart?
Answer to see the discussion.
MCQ-41A pricing service must keep `price:42` in Redis from serving a stale price after an update. The update writes the new price to Postgres and then removes the cache key. Which fact about the commit and delete order makes the cache stop serving the old price once the update succeeds?
Answer to see the discussion.
MCQ-42A rate limiter uses a token bucket with capacity 100 tokens and a refill rate of 20 tokens per second. Traffic from one client has been light, and the bucket holds 30 tokens at t=0. The client then sends requests as fast as it can for the next two seconds, with no other traffic. How many requests does the limiter serve in that two-second window?
Answer to see the discussion.
MCQ-43A rate limiter allows 100 requests per 60-second fixed window and uses a sliding window counter. The previous window recorded 80 requests, all in its final 5 seconds, and the current window has 30 so far. The next request arrives 15 seconds into the current window. What does the counter estimate for the rolling count, and what does an exact sliding log count?
Answer to see the discussion.
MCQ-44A payments client's circuit breaker trips to open after 5 consecutive failures. Its open window is a fixed 30 s with no backoff, and half-open admits one probe at a time. The probe is sent at t=30.5 s and times out at t=31.5 s, and no other request is sent during half-open. What state does the breaker enter after the failed probe, and when is the next probe admitted?
Answer to see the discussion.
MCQ-45A gateway gives a request a 2 second deadline and calls service A, which has already spent 0.5 seconds of it before calling service B. Under deadline propagation, what timeout does A's call to B receive?
Answer to see the discussion.
MCQ-46A Spotify-style service runs 500 queries per second against one Postgres primary. Each query holds a pooled connection for 40 ms on average, but 15% of queries are 300 ms cache-miss scans that also hold a connection for their full duration. The app runs 6 pods, each with its own pool, and the database accepts at most 150 connections across all pods. What is the largest per-pod pool size that stays within the database limit?
Answer to see the discussion.
MCQ-47A Go 1.22 service handles one request by starting 1,000 goroutines, each looking up one shard and sending its result on the unbuffered channel `results`. The handler runs `v := <-results`, returns `v` to the client, and never reads from `results` again. Every lookup finishes before the handler returns. How many goroutines are still blocked on their send, and why do they stay?
Answer to see the discussion.
MCQ-48A Java 17 transfer service moves money between two `Account` objects, each guarded by its own intrinsic lock. It synchronizes on the source, then on the destination. Callers name the pair in any order, so one A-to-B and one B-to-A transfer can each hold one lock and wait forever for the other. Ops needs a stuck transfer to give up within one second so the caller can retry, and the team cannot impose a lock order on callers. Which change meets that requirement?
Answer to see the discussion.
MCQ-49A v1 order message declared `int32 quantity = 4;`. In v2 the team deleted that field and reused number 4 as `string quantity = 4;`. A v1 producer still writes quantity 3 on field 4 as a varint, and a v2 Java consumer parses those bytes. What does the consumer's `getQuantity()` return?
Answer to see the discussion.
MCQ-50An orders API returns an optional courier_eta string that is present only while an order is out_for_delivery. Mobile app 4.2 is still used on 12% of installs and cannot be force-updated. Its decoder declares courier_eta as a required nullable key, so a null value decodes but an absent key throws. The team is removing the field in v3. What should v3 send for courier_eta on orders in other statuses?
Answer to see the discussion.
MCQ-51A payments consumer charges cards through an external provider API that accepts a client-supplied idempotency key and returns the original result when the same key is sent again. The consumer calls the provider first, then inserts the message ID into a processed_messages table. A pod crashes after the provider returns success but before that insert commits, and the broker redelivers the message. Which change stops a second charge?
Answer to see the discussion.
MCQ-52A checkout saga charges a card through a payment provider at step 1, then reserves stock at step 2. Step 2 fails 4 seconds later, after the provider has captured the charge and settled it to the merchant's bank. Compensation must return the money to the customer and keep the provider ledger consistent. What should step 1's compensation do to the charge?
Answer to see the discussion.
MCQ-53A worker holds a 10 s lease from a lock service with fencing token 33. A GC pause stalls it for 12 s, the lock service re-grants the lock with token 34 to another worker, and that worker writes to the shared store first. The store has already accepted a write carrying token 34 when the paused worker resumes and sends its write carrying token 33. What does the store do with the token 33 write?
Answer to see the discussion.
MCQ-54A replicated key-value store resolves concurrent writes with last-write-wins on client wall-clock timestamps in milliseconds. At true time 12:00:00.000, client X writes `draft v2`, but its clock runs 800 ms fast, so the stored stamp is 12:00:00.800. At true time 12:00:00.300, client Y writes `draft v3` with an accurate clock, so its stamp is 12:00:00.300. After both writes replicate, what does a read return?
Answer to see the discussion.
MCQ-55A Riak-style store on replicas A, B and C tags each sibling of a key with a vector clock. Two writes to one key carry the clocks {A:3, B:1, C:0} and {A:2, B:2, C:0}, and neither client read the other's value. The store must either keep one value or keep both as siblings for the application to reconcile. What should it do?
Answer to see the discussion.
MCQ-56A feed service pushes each new post into every follower's precomputed timeline, except for accounts with 40 million followers, which are merged into feeds at read time. One such account publishes a single post. Under full push, how many timeline writes would that one post trigger?
Answer to see the discussion.
MCQ-57A link shortener draws codes from the 62-character set 0-9, a-z and A-Z, with case kept significant, and must never reuse a code. The product must cover one billion distinct URLs with no planned ceiling, and the team wants the shortest fixed-length code that still fits all of them. Which code length should the service fix on?
Answer to see the discussion.
MCQ-58A URL shortener issues 7-character codes drawn uniformly at random from 36 symbols (a to z and 0 to 9), with no uniqueness check before insert. After 100,000 codes have been issued, what is the expected number of pairs of codes that collide?
Answer to see the discussion.
MCQ-59A shortener's link has 12,000 clicks a day and must count every click, and its destination changes next month. The redirect runs through no CDN and sends no caching headers beyond the defaults. Which response should the server return so every click reaches the analytics pipeline?
Answer to see the discussion.
MCQ-60A crawler records every URL it has fetched in a Bloom filter with 10 million bits and 7 hash functions, and it skips any URL the filter reports as present. For one new URL, the filter reports absent. What should the crawler do with that URL?
Answer to see the discussion.
MCQ-61A Backend Software Engineer's ingest job uses quickselect to find the smallest of 200,000 timestamps that arrive already sorted ascending. It takes the last element as the pivot in a Lomuto partition, recurses only into the side that holds index 0, and counts one comparison per non-pivot element in each partition. What is the total number of comparisons for one run?
Answer to see the discussion.
MCQ-62A telemetry job runs a sliding window maximum with window size k=3 over readings at indexes 0 to 4: 4, 2, 5, 1, 3. It keeps a deque of indexes whose values decrease from front to back, and it removes an index from the front once that index falls outside the window. After index 4 is processed, which indexes does the deque hold, front first?
Answer to see the discussion.
MCQ-63A Backend Software Engineer is writing the two-stack evaluator for `7 - 3 * 2 + 1`. The operand stack holds 7 and 3, the operator stack holds `-`, and the scanner has just read `*`. What should the evaluator do with `*`?
Answer to see the discussion.
MCQ-64A service serializes a binary tree of 9 nodes as preorder, writing `#` for every missing child, and rebuilds it with a recursive parser that reads one token per call. Whatever the tree's shape, how many `#` tokens does the stored string hold?
Answer to see the discussion.
MCQ-65A booking service merges meeting intervals in seconds: [1,10], [2,3] and [4,5]. It sorts them by end time, then sweeps once, keeping a list of merged intervals. For each interval it merges into the last kept interval when its start is at most that interval's end, setting the merged end to the larger end. What does the sweep return?
Answer to see the discussion.
MCQ-66A booking service assigns rooms to meetings in start-time order and keeps a min-heap of end times for rooms still in use. After meetings [0,30], [5,10] and [15,20] the heap holds {20, 30}, and the next meeting is [25,35]. What should the scheduler do with the heap top, 20, when placing that meeting?
Answer to see the discussion.
MCQ-67A routing service runs an unweighted BFS from S to T on a directed graph with edges S→A weight 9, A→T weight 9, S→B weight 1, B→C weight 1 and C→T weight 1. Which path does the BFS return, and what is its total weight?
Answer to see the discussion.
MCQ-68A night-shift planner is scoping a ring of five houses with loot values 2, 7, 9, 3 and 1 in clockwise order. Houses 1 and 5 share a wall, so the alarm trips if both are robbed, and no house may be robbed twice. Which maximum loot can the planner report, and from which houses?
Answer to see the discussion.
MCQ-69A Backend Software Engineer's ranking service runs patience sorting with strictly increasing tails on the stream 2, 5, 3, 7, 11, 8, 10, 13, 6. After the last value the `tails` array is [2, 3, 6, 8, 10, 13], and its length of 6 matches the LIS length. Which element of that final array appears in no longest increasing subsequence of the stream?
Answer to see the discussion.
MCQ-70A Backend Software Engineer's import job writes 10,000 rows to Postgres 16 over a link with a 1 ms round trip. Each row's server-side execution takes 0.1 ms, and the job runs one single-row INSERT per statement in autocommit. The team rewrites it as one multi-row INSERT of the same 10,000 rows, still in autocommit. Roughly how long does each version spend on the writes?
Answer to see the discussion.
MCQ-71A feed API pages newest-first with `ORDER BY created_at DESC, id DESC LIMIT 20 OFFSET 20` on Postgres 16. A client loads page 1, then two new posts are inserted at the top before it requests page 2 with the same query shape. What does page 2 return compared with page 1?
Answer to see the discussion.
MCQ-72A Postgres 16 `workspaces` table has columns id, name and deleted_at, and soft delete sets deleted_at to the deletion time. The table has `UNIQUE (name)`, so creating a new workspace named 'acme' after the old one was soft-deleted fails with a duplicate key error. Which change lets a new 'acme' be created while every active name stays unique?
Answer to see the discussion.
MCQ-73A Go service pushes orders into a bounded channel `make(chan Order, 1000)` read by one worker. Producers send about 300 orders/s while the worker sustains 200 orders/s, starting from an empty channel at t=0. Each send is a blocking `ch <- o`. After how many seconds does an upstream send first block?
Answer to see the discussion.
MCQ-74A checkout service is at 95% CPU and must drop some requests to stay responsive. Its traffic is checkout writes, product search reads served partly from cache, and an analytics export that an internal dashboard sends in bulk. Which request class should it drop first?
Answer to see the discussion.
MCQ-75A payments webhook receiver checks an HMAC-SHA256 signature over the raw body with a shared secret and a constant-time comparison. Each delivery carries a signed timestamp. An attacker captures a valid delivery that credited a customer and resends it verbatim 20 minutes later, and the signature still verifies. The provider retries failed deliveries for up to 72 hours, so legitimate retries can be days old. Which change stops the replay without rejecting those retries?
Answer to see the discussion.
MCQ-76A checkout team dark-launches a new write path: each order is still written to the legacy Postgres table, and the same write goes to a new table with its errors swallowed. After a week the new table has zero errors and matching row counts. The new path rounds tax to two decimals at write time, while the legacy path keeps four and rounds at invoice time. Cutover is set for Monday. What should the team do before cutover?
Answer to see the discussion.
MCQ-77A service's median latency is 20 ms. A 300 ms stop-the-world GC pause delays 2% of requests by 300 ms, and nothing else changes. Which percentile shows the pause?
Answer to see the discussion.
MCQ-78A pricing service keeps `price:42` in a per-instance Caffeine cache with a 30 s TTL and `expireAfterWrite`, and no invalidation. Each of 400 instances refills from Postgres on miss, and a refill takes up to 2 s under load. A price change commits at t=0. Instances refill on different schedules, and some refill started before t=0 but finished after it, storing the old price with a fresh 30 s clock. What is the longest the old price can still be served after t=0?
Answer to see the discussion.
MCQ-79A Backend Software Engineer's batch job sorts 100 GB of event records on a worker with 1 GB of memory. It writes 1 GB sorted runs to disk, then merges them with fan-in 9 until a single run remains. How many merge passes does the job make over the data?
Answer to see the discussion.
MCQ-80A checkout API allows each client 600 requests per fixed 60-second window across 10 stateless nodes, and each node enforces a local share of 60 requests per window. Node clocks are NTP-synced, so every node's window resets at the same instant, and a client's requests spread evenly over the nodes. What is the most requests the cluster can admit in any 60-second span?
Answer to see the discussion.
MCQ-81A Backend Software Engineer's service serves 5 million daily active users, and each user makes 10 requests spread evenly across the day. What is the average request rate, in requests per second?
Answer to see the discussion.
MCQ-82A checkout path runs gateway to orders to inventory to a pricing database, with max attempts 3 on each hop and retries on any 503. The gateway sets a 2 s deadline and passes its remaining budget downstream, but orders and inventory each use a fixed 1 s client timeout and ignore the inbound deadline. Pricing returns 503 instantly for its first 4 calls, then succeeds on every later call, and no circuit breaker applies. How many calls does pricing receive for one checkout request?
Answer to see the discussion.
MCQ-83A Java 17 service lazily builds a singleton `Pricer` through `getInstance()`, which uses double-checked locking. The static `instance` field is not volatile, and each call reads it outside the lock at about 50,000 calls per second. Construction must stay lazy because it reads a config file that must not load at class init. Readers occasionally see a non-null `Pricer` whose `table` is still null. Which change fixes this without taking a lock on every call?
Answer to see the discussion.
MCQ-84A depot ships parcels weighing 4, 3, 5, 2, 6, 1 and 7 kg in arrival order. Each day it loads a contiguous run of parcels whose total stays within the truck capacity C kg, and the whole batch must clear within 3 days. The team binary-searches C between 7 and 28 and runs a greedy loader that fills each day until the next parcel would exceed C. Which predicate should the search test, and what capacity does it settle on?
Answer to see the discussion.
MCQ-85A Java 17 autocomplete service stores 2,000,000 product names averaging 12 lowercase letters and must answer, in under 1 ms, whether any stored name starts with a user's typed prefix. The index has a 512 MB budget. The names produce about 9,000,000 distinct prefixes, and 85% of prefix nodes have exactly one child. Which per-node child layout should the trie use?
Answer to see the discussion.
MCQ-86A Java 17 transfer service moves money between `Account` objects, each guarded by its own intrinsic lock. Callers name the pair in either order, so an A-to-B transfer and a B-to-A transfer can run at the same time. Every account has a `long` id that never changes, its balance changes on every transfer, and two accounts can share an `identityHashCode`. The team may change only the locking code inside `transfer()`, must keep `synchronized`, and must not add a timeout. Which lock-acquisition rule removes the cycle?
Answer to see the discussion.
MCQ-87A Python 3.12 service runs a CPU-bound request handler on a pool of 8 threads on an 8-core machine. Each request is pure Python parsing and arithmetic with no I/O. Measured throughput is 410 requests/s with 1 thread and 430 requests/s with 8 threads. Which change is most likely to raise throughput toward 8 times the single-thread figure?
Answer to see the discussion.
MCQ-88A FastAPI service on Python 3.11 runs 4 uvicorn workers on 4 cores. Its `async def` report handler calls a psycopg2 query directly. The query takes about 80 ms and must return its full result, and the handler must stay async because it streams the response. Cache-hit endpoints that never touch the database show p99 rising from 9 ms to about 700 ms whenever a report runs, on every worker. Which change restores the cache-hit latency?
Answer to see the discussion.
MCQ-89A Java 17 ingest service runs 16 threads that each call `accepted++` on a shared `long` counter for every accepted event, at about 2 million increments per second. The counter is the only state involved: nothing else is written with it, and no branch in the request path reads it. The team cannot take a lock on each request. Which change makes the final count exact?
Answer to see the discussion.
MCQ-90A Go service behind a cloud load balancer receives SIGTERM during a rolling deploy and closes its listener at once. The balancer keeps routing new connections to it for up to 30 seconds, and clients see connection refused during that window. Which change stops the refused connections?
Answer to see the discussion.
MCQ-91A Postgres 10 service has a 300-million-row orders table and a migration that adds a channel column. The team's plan has five steps, and it needs to know which one rewrites every row in the table file on Postgres 10. Which step does that?
Answer to see the discussion.
MCQ-92A Postgres 16 orders table has 10 million rows packed at about 80 rows per 8 KB heap page, with a B-tree index on status. Three status values exist, and 'open' matches 60% of rows, spread across nearly every heap page. The query is SELECT id, total FROM orders WHERE status = 'open' with no ORDER BY or LIMIT, the statistics were analyzed an hour ago, and random_page_cost keeps its default of 4.0. Which plan does EXPLAIN most likely show?
Answer to see the discussion.
MCQ-93A Java 17 ingest service checks after each batch that a 500,000-key binary search tree is height-balanced, meaning every node's left and right subtree heights differ by at most 1. Its isBalanced(node) calls a recursive height(node) on both children at every node, so a near-chain tree takes minutes. The check must visit each node once and stop at the first unbalanced subtree. Which change meets both requirements?
Answer to see the discussion.
MCQ-94A Java 17 report job has a worker thread fill a plain `long[] totals` array, then set a plain `boolean done` to true. The main thread runs `while (!done) Thread.sleep(10);` and then reads `totals`. The worker finishes in about 2 ms, yet on some hosts the main thread spins forever, and when it exits it sometimes reads zeros. The main thread polls on every request, so no lock may be taken on each poll. Which change makes the main thread reliably see the completed totals?
Answer to see the discussion.
MCQ-95An orders table gets a nullable `tax_zone text` column in an expand migration. Twelve pods roll out one at a time over 10 minutes, and pods that have not yet been replaced keep inserting orders without the column. The next release will read tax_zone for tax calculation, and the team wants that reader to see a value on every order it handles. Which step must go first?
Answer to see the discussion.
MCQ-96A payments service runs two-phase commit across three participants. Participant P2 has force-written its prepare record and sent a yes vote, then the coordinator crashes before any decision reaches P2. While P2 waits, what should it do with the row locks it holds?
Answer to see the discussion.
MCQ-97A login service runs on 1-vCPU pods and must verify a password within a 250 ms p99 budget at a peak of 800 logins/s. It stores passwords with bcrypt at cost 12, which takes about 240 ms per hash on those pods, and each pod handles one hash at a time. A stolen password table must stay expensive to crack. Which change should the team make to the stored-hash scheme and its parameters?
Answer to see the discussion.
MCQ-98A checkout request crosses three services, and one failure in about 10,000 requests happens only on a rare downstream retry path. The team uses head-based trace sampling at 1%, so most failing traces are discarded before anyone can read them. Which sampling change lets the team keep the traces it needs for debugging without storing every request's spans?
Answer to see the discussion.
MCQ-99A Java 17 container runs under a fixed 2 GiB memory limit set by a namespace quota, with -Xmx2g and a constant pool of 200 worker threads. Committed heap plateaus at about 1.2 GiB, but RSS climbs with load as Netty allocates direct buffers, and the kubelet kills the process with exit code 137 about every 40 minutes. Which single setting stops the kills without reducing the heap available to requests?
Answer to see the discussion.
MCQ-100A Postgres 16 table of 50 million rows lost 30 million rows to a nightly delete, and disk usage is still high. Writes must keep flowing from 08:00 to 20:00, and no statement may block them for more than a few seconds. The freed space must go back to the filesystem before the next business day, and the team can install extensions. Which maintenance step should it run?
Answer to see the discussion.