Generated output (3 of 12 questions shown)
What does this useMemo prevent?
Given the component below, what does removing the `useMemo` hook change about its behavior?
function PriceTable({ orders, taxRate }: Props) {
const totals = useMemo(() => {
return orders.map((o) => ({
id: o.id,
total: o.quantity * o.unitPrice * (1 + taxRate),
}))
}, [orders, taxRate])
return <Table rows={totals} />
}- A) The component would no longer re-render when `orders` or `taxRate` change.
- B) `totals` would be recomputed on every render of `PriceTable`, causing `<Table>` to receive a new array reference each time and re-render even when its inputs are structurally unchanged.
- C) React would throw a warning because `orders.map` cannot be called outside of a memoization hook.
- D) The component would crash on the first render because `useMemo` is required for any derived data in React 18.
Fix the useEffect leak
A junior engineer wrote the component below to poll an endpoint. It works, but the team is getting alerts about memory pressure in long-lived dashboards. Identify the bug(s) and fix them. Add a comment above each fix explaining what it addresses.
function LiveCount({ id }: { id: string }) {
const [count, setCount] = useState(0)
useEffect(() => {
setInterval(async () => {
const res = await fetch(`/api/count/${id}`)
const data = await res.json()
setCount(data.count)
}, 1000)
}, [])
return <span>{count}</span>
}Candidate editor
function LiveCount({ id }: { id: string }) {
const [count, setCount] = useState(0)
useEffect(() => {
// Your fix here
}, [])
return <span>{count}</span>
}Write a PR description
You're refactoring a data table from client-side sorting to server-side sorting because profiling showed 800ms blocking renders on tables with >10k rows. Write a concise PR description (4–6 sentences) that explains: what changed, why, what reviewers should pay attention to, and any follow-up work. Assume your audience is another senior engineer who hasn't seen the profiling data.
Candidate response
+ 9 more questions across writing, debugging, communication, and tradeoffs — all scored automatically with per-question feedback and an integrity report per submission.
Generate one for your role
Paste any engineering job description, get a tailored 12-question assessment in ~30 seconds. 10 free cycles, no credit card.
Comparing tools?
We've written honest side-by-sides with the major players.