Low-Level Design (Object-Oriented Design) Module 17 – Machine-coding and interview practice
A timed machine-coding mock, step by step
A 90-minute machine-coding mock replayed minute by minute: a visitor gate pass built, run at 30, 60 and 90 minutes, extended and scored on a rubric.
What you will learn
- Follow a 90-minute build from prompt to demo with time stamps
- Assess a solution with a six-area rubric and the evidence for each score
- Plan your own timed mocks over four weeks with original practice prompts
Before you start
What you’ll learn · Before you start
What you will learn
- Follow a 90-minute build from prompt to demo with time stamps
- Assess a solution with a six-area rubric and the evidence for each score
- Plan your own timed mocks over four weeks with original practice prompts
Before you start
On this page
A timed machine-coding mock is a 90-minute rehearsal of a machine-coding round under the round’s own conditions: a written prompt with a sample input and its exact expected output, your own editor, a timer that does not stop, a change requested near the end, and a scored review afterwards. Its value comes from the clock. Untimed practice shows whether you can solve a problem; a timed machine-coding mock shows where your minutes go and which habits break under pressure. This lesson replays one mock step by step, on an original prompt.
The prompt, the plan and the three checkpoints
The prompt: a housing society’s security desk needs a program for visitors, and every input line starts with the time. A resident approves a visitor for a flat, and the visitor gets a pass code that works once. The guard lets the visitor in and out with that code. Someone without a pass waits at the gate until the flat allows or denies them. A delivery enters at once and must leave within 15 minutes. A resident may cancel a pass that has not been used, and a report lists everyone inside, with late deliveries flagged. Every refused command gets one answer line, and the program carries on. The sample has 17 commands and 21 expected answer lines.
The plan is six stages, and three of them end with a checkpoint: a run of the sample and of every test written so far.
The mock's six stages and its three checkpoints
Text description of the diagram
The diagram is a column of six boxes joined by arrows, from top to bottom.
- Minutes 0 to 10: read the prompt twice, list the commands and the assumptions, and write the class skeletons.
- Minutes 10 to 30: the happy path. A run of the sample at minute 30 matches 8 of its 21 expected lines.
- Minutes 30 to 60: refusals, deliveries and the report, then the tests. At minute 60 all 21 lines match and 9 tests pass.
- Minutes 60 to 75: tidy up and write the list of what is not done.
- Minutes 75 to 85: the interviewer's follow-up, written test first.
- Minutes 85 to 90: the demo. All 21 lines still match, and 12 tests pass.
Step by step, the checkpoints are the point of the exercise. At minute 30 the sample matched 8 of its 21 expected lines; at minute 60 it matched all 21, with 9 tests passing; at minute 90, after the follow-up, it still matched all 21, with 12 tests. Each number tells you whether the plan is on time while there is still time to react.
The finished program is scored on six areas, each from 1 to 4:
- Requirements coverage: every command and refusal of the prompt works.
- Model quality: each rule has one owner, and parsing stays apart from the rules.
- Correctness: tests prove the rules, starting with the prompt’s sample.
- Extensibility: the follow-up lands in few places, with the old tests green.
- Code quality: short functions, names from the domain and one way to refuse.
- Communication: decisions, assumptions and gaps are said out loud.
The scores are not a verdict on you; they show which habit to practise in the next mock.
The program at minutes 30, 60 and 90, replayed Pro: opens with a Pro, Premium or Ultimate pass
In this part:
- Why the line count and the command count differ
- Minutes 0 to 10: assumptions and one Visit class
- Minutes 10 to 30: the happy path and the first run
- Minutes 30 to 60: guarded transitions, then the tests
- Minutes 60 to 90: tidying, the follow-up and the demo
- Two mistakes the first run shows, with their cost
- The rubric: six areas, four levels each
- This mock scored, area by area
- Four weeks of timed mocks
- Practise: visitor parking in 25 minutes
- Add visitor parking to the gate pass
- Check yourself
- Interview questions
- Why does a timed mock stop to run the sample and the tests at fixed checkpoints, such as minutes 30, 60 and 90?
- At minute 60 of a 90-minute round your happy path works, three refusals are missing, there are no tests, and the interviewer will ask for a change at minute 75. How do you spend the last 30 minutes?
- After your demo of a visitor gate-pass program, the interviewer asks: "What would you do with two more hours?" What makes a strong answer, and what makes a weak one?
- You finished a practice mock: every sample line matches, nine tests pass, and the follow-up took edits in four places. How do you score it on six areas from 1 to 4, and what evidence would move a 2 to a 3?
- Key takeaways
1 runnable example (expected.txt, replay.py, sample.txt, t30/gate.py, t60/gate.py, t60/test_gate.py, t90/gate.py, t90/test_gate.py) · 1 exercise with sample tests · 3 interview answers · about 26 minutes
Opening this part with your pass…
This part opens 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 this part can’t be opened at the moment. The free part above stands on its own. 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).
Read a complete sample first: Low-level design: parking lot (the model)
References
- Google engineering practices: what to look for in a code review (Google)
- difflib: SequenceMatcher objects (Python Software Foundation)
- importlib.util.spec_from_file_location (Python Software Foundation)
- dataclasses: Data Classes (Python Software Foundation)
Related tools
Report a problem with this lesson
Kept only in this browser. Your Learn progress