Low-Level Design (Object-Oriented Design) Module 11
Case studies: everyday machines interview questions
Interview questions on “Case studies: everyday machines”: 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.
-
Fresher to mid
Should ParkingLot be a singleton?
Answered in the lesson Low-level design: parking lot (the model)
-
Fresher to mid
Should Car, Motorcycle and Van be subclasses of Vehicle?
Answered in the lesson Low-level design: parking lot (the model)
-
Fresher to mid
Why does a signal plan need an all-red interval between phases when the amber already warns drivers?
Answered in the lesson Low-level design: traffic signal controller
Questions with model answers
What each question tests, the first step of a good answer and the follow-ups to expect.
-
Mid to senior
Your parking lot has two entry gates, and once in a while both send a car to the same spot. Explain how that can happen, then fix it twice: in the in-memory design, and when the spots live in a relational database.
- What it tests
- Spotting a check-then-act race, deciding exactly what one lock must cover, keeping slow work outside it, and the database form of an atomic claim.
- First step
- Write the entry out as steps and interleave two gates: both look, both see the same spot available, both claim it. The bug is the gap between looking and claiming. Then say which steps must become one: the plate check, the choice of a spot and the claim.
- Follow-ups
-
- The payment call sits inside the same lock. What happens at the evening rush?
- Would one lock per floor be better than one lock for the lot?
- How would you test the fix?
From the lesson Low-level design: parking lot (the model)
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; nothing renews unless you choose to. 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 4 minutes
-
Mid to senior
The operator raises parking prices at noon. How does your design price a car that entered at 10:00 and leaves at 14:30, and what changes in your classes if the business decides to split each stay at the change instead?
- What it tests
- Keeping the version of a rule with the record it prices, what each choice does to caps and rounding, and changing a policy behind its interface without editing callers.
- First step
- Name the three possible rules: the tariff at entry, the tariff at exit, or a split at the moment of the change. Choose one with a reason, then show where the tariff is stored, because that decides what a receipt can explain later.
- Follow-ups
-
- A driver disputes a fee a week later. How do you show which tariff applied?
- Prices now change every weekday at 18:00. Does the design still hold?
- The business wants the new prices to apply to every car inside from the moment they change.
From the lesson Low-level design: parking lot (the model)
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 4 minutes
-
Mid to senior
Your controller switches to the evening timing plan exactly at 17:00. Soon after it goes live, a near miss is reported at 17:00:00. What could have gone wrong, and how do you change plans safely?
- What it tests
- Seeing that a plan change is a transition with its own safety rules, checking transitions rather than pairs, and choosing the moment a new plan may start.
- First step
- Ask what the junction was showing at 16:59:59. If a phase other than the new plan's first was green, switching at once cut that green to red with no amber and released crossing traffic with no all red. Then say when a switch is safe: at the end of a cycle, after its all red.
- Follow-ups
-
- Why did the check of crossing pairs not catch it?
- The new plan must start within 10 seconds of 17:00. Is that possible?
- How would a test prove that every plan change is safe?
From the lesson Low-level design: traffic signal controller
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
An ambulance approaches from the east while north-south has 25 seconds of green left and a pedestrian has pressed the button. Walk through what the junction shows, second by second, and say what the controller must never cut short.
- What it tests
- Preemption as a state with priority, the intervals that are never shortened, how waiting requests are kept, and how the cycle resumes.
- First step
- Separate what may be cut from what may not. The north-south green may end at once; its amber and the all red that follows keep their full length. Count the seconds from the call to the east green, then say what happens to the pedestrian's request.
- Follow-ups
-
- A second ambulance arrives from the north during the first one's green. Now what?
- The emergency call never clears because a detector failed. What stops the junction staying on one green?
- Should the pedestrian phase run before the plan resumes?
From the lesson Low-level design: traffic signal controller
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Senior to staff
A relay sticks, and one signal head keeps showing green after the controller tells it amber. How does your design notice, how quickly, and what does the junction do next?
- What it tests
- Detecting faults from what the heads really show, the value of a check independent of the controller, and a safe fault mode with a manual way out.
- First step
- Say what the controller can compare: what it told each head against what the head reports back. That catches the stuck head in the same second. Then explain what a separate monitor adds, and what the junction shows once a fault is found.
- Follow-ups
-
- What does the independent monitor catch that the controller's own check cannot?
- Why should only a technician end flashing operation?
- How would you test the fault path without real hardware?
From the lesson Low-level design: traffic signal controller
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
All Low-Level Design (Object-Oriented Design) interview questions · The Low-Level Design (Object-Oriented Design) track