Performance
Core Web Vitals, rendering performance, virtualization, bundles, caching and measurement.
1.Explain the concept of debouncing and throttling
Run after activity stops versus at most once per interval, with implementations and use cases.
2.Explain the concept of lazy loading and how it can improve performance
Deferring images, iframes, code and data until needed, and when not to.
3.What does re-rendering mean in React?
Render vs commit, what triggers re-renders, and when they become a problem.
5.Memoize
Cache a function's results by argument so repeated calls with the same input skip the work.
6.Throttle
Limit a function to at most one call per wait window, with leading and trailing calls.
7.What is code splitting in a React application?
Dynamic import, lazy and Suspense, route-level splitting and prefetching.
8.How do you decide where to code-split a large front-end app, and what can go wrong?
Route, component and vendor splitting, request waterfalls, chunk granularity and caching trade-offs.
9.What are the Core Web Vitals today, how are they measured, and what are the thresholds?
LCP, INP and CLS: what each one captures, the p75 thresholds, and lab vs field data.
10.Walk through the critical rendering path. What blocks rendering, and how do you shorten it?
HTML parsing, CSSOM, render-blocking vs parser-blocking resources, the preload scanner and first paint.
11.What causes Cumulative Layout Shift (CLS) and how do you fix it?
Session windows, the usual culprits (images, ads, fonts, injected banners) and how to debug shifts.
12.How would you set up image optimisation for a large, image-heavy site?
Formats, responsive images, lazy loading, priority hints, image CDNs and governance at scale.
13.What are some common performance bottlenecks in JavaScript applications?
Large bundles, long tasks, layout thrashing, memory leaks, network waterfalls and over-rendering.
14.Explain preload, prefetch, preconnect, dns-prefetch and modulepreload. When does each help or hurt?
Resource hints, speculation rules and 103 Early Hints, with the costs of over-hinting.
15.What is the React Compiler and how does it change memoization?
Build-time automatic memoization, its reliance on the Rules of React, and adoption.
16.What are some pitfalls about using context in React?
Re-render cascades, unstable values, overuse and missing providers.
17.Explain server-side rendering of React applications and its benefits
Per-request HTML, hydration, streaming SSR and the trade-offs against CSR and SSG.
18.What is the `useCallback` hook in React and when should it be used?
Stable function identities, when they matter, and the React Compiler.
19.What is the `useMemo` hook in React and when should it be used?
Caching expensive calculations and stable identities, and when not to bother.
20.Explain reflow (layout), repaint and compositing. How do you avoid layout thrashing and janky animations?
Which CSS changes trigger which pipeline stages, forced synchronous layout, will-change and layer costs.
21.Image Carousel Component
Design an accessible, performant image carousel with swipe, autoplay, lazy loading and responsive images.
22.News Feed (e.g. Facebook)
Design an infinitely scrolling, personalised social feed with posts, reactions, comments and live updates.
23.Photo Sharing App (e.g. Instagram)
Design a photo-first social app: image feed, profile grid, upload with client-side processing, and likes and comments.
24.Compare CSR, SSR, SSG, ISR and streaming SSR. How do you choose a rendering strategy per page?
Trade-offs in TTFB, LCP, INP, freshness, cost and complexity, with a per-route decision framework.
25.How do you find and fix a poor INP (Interaction to Next Paint)?
Input delay, processing time and presentation delay: finding the slow interaction and fixing each phase.
26.Your field LCP is 4.1 s on mobile. How do you diagnose and improve it?
Breaking LCP into TTFB, resource load delay, load duration and render delay, and fixing each part.
27.Design an HTTP caching strategy for a web app: Cache-Control, ETag and stale-while-revalidate.
Immutable hashed assets, revalidated HTML, CDN vs browser caches, validators and common caching incidents.
28.What is a long task, and what are the ways to break one up and yield to the main thread?
The 50 ms rule, setTimeout vs scheduler.yield vs postTask, isInputPending, Workers and the LoAF API.
29.How can you optimize network requests for better performance?
Fewer, smaller, earlier, cached and prioritised requests.
30.How would you optimize the performance of React contexts to reduce rerenders?
Stable values, split contexts, state/dispatch separation and selector-based stores.
31.Explain `useTransition` and `useDeferredValue` and when to use each
Marking updates as non-urgent so concurrent React keeps input responsive.
32.Collaborative Spreadsheet (e.g. Google Sheets)
Design a browser spreadsheet with a virtualized grid, formula engine, dependency graph and real-time co-editing.
33.Data Table / Data Grid Component
Design a reusable data table with sorting, filtering, pagination, selection, column resizing and virtualization.
34.Collaborative Design / Drawing Tool (e.g. Figma, Canva)
Design a multiplayer vector canvas with an infinite viewport, shape editing, hit testing, cursors and undo.
35.E-commerce Marketplace (e.g. Amazon)
Design the front end of a large e-commerce site: search and listing, product detail, cart and checkout, with SEO and Core Web Vitals in mind.
36.Email Client (e.g. Outlook / Gmail)
Design a web email client: folders and threaded inbox, safe rendering of HTML emails, composer with drafts, offline and keyboard-driven workflows.
37.Music Streaming Web Player (e.g. Spotify)
Design a music web app with uninterrupted playback across navigation, a queue, gapless streaming, DRM and multi-device control.
38.Pinterest (Masonry Image Feed)
Design a Pinterest-style home feed: a responsive masonry grid of variable-height pins with infinite scroll and virtualization.
39.Real-Time Collaborative Whiteboard
Design a Miro/FigJam-style multiplayer whiteboard: canvas rendering at scale, CRDT-based sync, presence, offline, permissions and the multiplayer service.
40.Video Conferencing App (e.g. Zoom, Google Meet)
Design a browser video meeting app with WebRTC, an SFU, simulcast, adaptive layouts, screen sharing and chat.
41.Video Streaming Service (e.g. Netflix)
Design a Netflix-style web client: browse rows of titles, a video player with adaptive bitrate streaming, DRM, and resume playback.
43.Selectable Cells (Drag Select)
Build a grid where dragging selects a rectangle of cells, with modifier-key multi-select and a full keyboard equivalent.
44.How do you add, remove, and modify HTML elements using JavaScript?
createElement, append, replaceWith, remove, classList, fragments, templates and avoiding innerHTML XSS.
45.Memoize II (multiple arguments)
Memoize a function of any number of arguments with a collision-free cache keyed on every argument.
46.What is the back/forward cache (bfcache), and what makes a page ineligible for it?
Instant back navigations, pageshow/pagehide, unload and other blockers, and how to test eligibility.
48.What changed from HTTP/1.1 to HTTP/2 to HTTP/3, and what does it mean for front-end delivery?
Multiplexing, HPACK/QPACK, head-of-line blocking, QUIC over UDP, and which old optimisations are now harmful.
49.Compare IntersectionObserver, ResizeObserver and MutationObserver. When would you use each?
What each observer watches, when callbacks run, performance characteristics and common pitfalls.
50.When should you virtualise a long list, how does it work, and what does it cost you?
Windowing mechanics, variable heights, accessibility and find-in-page trade-offs, and alternatives like content-visibility.
51.What are the benefits of using a module bundler?
Graph resolution, transforms, minification, code splitting and cache-friendly output.
52.Explain static generation of React applications and its benefits
Build-time HTML on a CDN, its freshness limits, and ISR-style hybrids.
53.Explain the concept of tree shaking in module bundling
Dead-code elimination of unused exports, side effects, and what defeats it.
54.How do you load web fonts without hurting LCP and CLS?
font-display, preloading, subsetting, self-hosting, variable fonts and metric-matched fallbacks.
55.Infinite Scroll Feed
Build a cursor-paginated feed that loads more posts as you scroll, with abort handling, retries and the ARIA feed pattern.
56.Pixel Art Editor
Build a 16×16 pixel-art editor with a colour palette, draw/erase tools, click-and-drag painting and keyboard drawing.
57.Debounce II
Debounce with leading, trailing and maxWait options, plus cancel and flush.
59.How does JavaScript garbage collection work?
Reachability, mark-and-sweep, generational collection and how front-end apps leak memory.
60.What is islands architecture, and how does it compare with full hydration and React Server Components?
Static HTML with isolated interactive islands, hydration directives, resumability, and when islands fit.
61.What are some tools that can be used to measure and analyze JavaScript performance?
DevTools Performance panel, Lighthouse, RUM with web-vitals, bundle analysers and profilers.
62.How do memory leaks happen in long-lived SPAs, and how would you find one?
Detached DOM, forgotten listeners, timers, caches and closures, plus the heap-snapshot workflow.
63.How can you optimize DOM manipulation for better performance?
Batching reads and writes, fragments, delegation, virtualization and content-visibility.
64.How would you build real-user performance monitoring (RUM) with PerformanceObserver?
Entry types, buffered observers, beaconing on visibilitychange, sampling, percentiles and segmentation.
65.What are workers in JavaScript used for?
Dedicated, shared and service workers: off-main-thread work, messaging, transferables and limits.