Skip to content
Sharp

Core Collections · interview question

What does a strong engineer do when reasoning through sorting and grouping code?

Multiple choiceMediumchapter-3-curatedpremiumcore-collectionssorting-and-grouping
python
lines = [{"sku": "SKU-2", "qty": 1}, {"sku": "SKU-1", "qty": 4}]
lines.sort(key=lambda row: row["sku"])
print(lines)
Choose one answer
Answer and explanation

Correct answer

D. Narrate the data shape, the state changes, and the exact rule order step by step.

Why

Interviewers often use simple code to test whether you can reason through execution without bluffing.

Test yourself on Core Collections

A free test with instant, explained results. No account needed.

Start free test
All Core Collections questions →