Apple · interview prep
Apple Frontend Interview Prep Questions
25 frontend interview practice questions oriented toward Apple-style loops (Craft, performance, accessibility, and meticulous UX detail.). Unofficial composite guide—not Apple property.
Expect high taste for interaction quality: focus states, motion preferences, layout polish, and performance. Composite prep—not official Apple content.
- 25 questions
- css
- html
- react
- javascript
How to use this list
- Answer out loud in 60–90 seconds, then check the written answer.
- Where a “Deeper guide” link appears, open it after you attempt the answer yourself.
- Pair with DSA, machine coding, and playground drills.
css
1.How do you handle motion and reduced-motion preferences?
Default to subtle motion, respect prefers-reduced-motion, avoid essential information only in animation, and test input latency on mid-tier devices.
2.What details separate polished UI CSS from “works on my laptop” CSS?
Focus states, empty/loading/error layouts, overflow edge cases, font fallback metrics, and consistent spacing tokens—not only happy-path desktop screenshots.
3.What is the CSS box model?
Every box has content, padding, border, and margin. With content-box, width applies to content only; with border-box, width includes padding and border. Most layout systems set border-box globally.
html
4.What is semantic HTML and why does it matter?
Use elements that match meaning (nav, main, button, label) so browsers, assistive tech, and crawlers understand structure. CSS can fake appearance; it cannot replace missing semantics without extra ARIA and keyboard work.
react
5.What is React’s core mental model?
UI is a function of state. You describe trees of elements; React reconciles descriptions and updates the host tree (DOM or native). Prefer data → view over imperative DOM mutation.
javascript
6.What is the JavaScript event loop?
A single JS agent has one call stack. Host APIs (timers, network, DOM) finish work and queue callbacks. The event loop runs a macrotask until the stack is empty, drains all microtasks, may render, then takes the next macrotask. Workers are separate agents with their own stacks.
css
7.What is the difference between content-box and border-box?
content-box: specified width/height size the content area; padding and border add outside. border-box: specified width/height include content, padding, and border—usually easier for column math and components.
html
8.When should you use a link versus a button?
Links navigate with href (open in new tab, bookmarkable, crawlable). Buttons perform actions on the page. Do not fake either with divs unless you reimplement keyboard and accessibility fully.
react
9.What is reconciliation in React?
The process of comparing the previous tree to the next one to decide what to insert, update, or remove. Same type at a position updates; different type remounts. Keys give list items identity.
javascript
10.What is the difference between microtasks and macrotasks?
Microtasks (promise reactions, queueMicrotask, await continuations, MutationObserver) run after the current stack and before the next macrotask or paint. Macrotasks include timers, many DOM events, and other host tasks. That is why Promise.then usually runs before setTimeout(0). Footgun: endless microtasks starve rendering.
css
11.When do you use Flexbox versus Grid?
Flexbox is strong for one-dimensional distribution (rows or columns of components). Grid is strong for two-dimensional page/section layouts. Real UIs often combine both.
html
12.Why should a page have a single main landmark?
main identifies primary content and should appear once. It enables skip links and AT landmark navigation. Header/nav/footer sit outside main.
react
13.Why do list keys matter?
Keys preserve identity across renders so state and DOM attach to the correct items. Index keys break when you reorder or insert—inputs and local state glitch. Prefer stable IDs from data.
javascript
14.What is a closure in JavaScript?
A function bundled with its lexical environment—the outer bindings it can still reach. Closures capture bindings, not frozen snapshots of values. Footgun: a long-lived callback that closes over a large object keeps that object alive for GC.
css
15.What do flex-grow, flex-shrink, and flex-basis do?
flex-basis is the initial main size before free space is distributed. flex-grow shares positive free space. flex-shrink reduces items when space is tight. Defaults matter—know flex: 1 shorthand implications.
html
16.How do you correctly label form controls?
Associate a label via for/id or wrap the control. Placeholder is a hint, not a label. Unlabeled inputs fail accessibility and often fail Testing Library role queries.
react
17.What is the difference between props and state?
Props are inputs from the parent (read-only for the child). State is data the component owns and can update over time. Lift state to the closest common owner that needs to coordinate children.
javascript
18.What is the difference between var, let, and const?
var is function-scoped and hoisted as undefined. let and const are block-scoped and stay in the temporal dead zone until initialized. const cannot rebind the identifier (object contents can still mutate). Prefer const by default, let when reassignment is needed.
css
19.What is the difference between align-items and justify-content in Flexbox?
justify-content distributes along the main axis; align-items aligns on the cross axis. Direction depends on flex-direction. Interviewers often swap axis names—draw it.
html
20.What are the rules of thumb for img alt text?
Informative images need meaningful alt. Decorative images use empty alt (alt=""). Do not stuff keywords. Provide width/height or CSS aspect-ratio to limit CLS.
react
21.What is a controlled input in React?
The input’s value is driven by React state via value + onChange. Uncontrolled inputs keep value in the DOM and use refs. Controlled forms make validation and programmatic resets easier.
javascript
22.What is the temporal dead zone?
From the start of a block until a let/const binding is initialized, accessing it throws ReferenceError. That gap is the TDZ. It prevents using bindings before their declaration runs.
css
23.What is the fr unit in CSS Grid?
fr represents a fraction of available free space in the grid container. repeat(3, 1fr) builds equal columns after accounting for gaps and fixed tracks.
html
24.What is the difference between section, article, and div?
div is generic styling/hook with no semantics. section is a thematic grouping with a heading. article is self-contained content that could stand alone (post, card widget).
react
25.How does useState’s functional update work?
setState(prev => next) uses the latest queued state, avoiding stale closures when the next value depends on the previous one. Prefer it inside async handlers and effects that schedule updates.