Language Atlas (mini-courses for more languages) Module 14
Capstone: one specification, twelve languages interview questions
Interview questions on “Capstone: one specification, twelve languages”: warm-ups, then what each harder question tests and how a good answer starts.
Warm-up questions
Short questions with short answers, each answered in full.
-
Mid to senior
Why does the specification round half up with integers instead of calling the language's round?
Answered in the lesson Capstone: one spec in twelve languages
-
Fresher to mid
What is a test vector, and what can twenty public vectors prove?
Answered in the lesson Capstone: one spec in twelve languages
-
Fresher to mid
What is floor division, and when does it differ from truncating division?
Answered in the lesson Capstone: one spec in twelve languages
Questions with model answers
What each question tests, the first step of a good answer and the follow-ups to expect.
-
Fresher to senior
A teammate's implementation of the bill-splitting specification passes most vectors, but on some bills one diner is one paisa off and the totals no longer add up to the bill. Where do you look, in what order, and how do you prove the fix?
- What it tests
- Tracing an off-by-one-paisa failure to division, rounding or ordering rules, using the shared vectors as evidence, and the invariant that the shares add up to the bill.
- First step
- Run check.sh and list the vectors that differ, then compare the rules they pin. Totals that stop adding up point at the shares and the leftover paise: truncating division of a negative line, such as the coupon of vector 07, gives shares that add up to more than the line and a leftover of -1.
- Follow-ups
-
- The failing vectors are 06 and 08. What is wrong?
- Only vector 09 fails. What is wrong?
- How would you guard against this class of bug for good?
From the lesson Capstone: one spec in twelve languages
Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.Opening the model answers with your pass…
Model answers open with any MySmartCoPilot pass.
- Pro pass · 1 week₹79$2.99
- 30 days₹179$5.99
- 1 year₹1,699$45
One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.
Passes can’t be bought right now, so the model answers can’t be opened at the moment. If you have a pass, enter your licence key.
It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).
In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to staff
You are asked to implement the bill-splitting specification in an atlas language you have never used. How do you go from zero to twenty of twenty vectors with the fewest wrong turns, and what do you check before you trust the result?
- What it tests
- Working from a concept map and recorded probes instead of assumptions, ordering the work by risk, and knowing what public vectors can and cannot prove.
- First step
- Before writing the program, answer the rows the specification depends on for that language, with a probe run on its pinned toolchain: integer division of -1051 by 2, a half rounded, 1,000,000,000 × 1,800 in the integer type you plan to use, and the order of asha, Zoya and Bilal. The atlas mini-course of that language has recorded most of them already.
- Follow-ups
-
- Which part of the program do you write first, and why?
- All twenty vectors pass. What is still unproven?
- How would you compare your implementation with the four on the page?
From the lesson Capstone: one spec in twelve languages
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
All Language Atlas (mini-courses for more languages) interview questions · The Language Atlas (mini-courses for more languages) track