Topic 3 · Class activity 6 · Week 8 · Friday

Technical Interview Rehearsal

Eight questions, ten minutes each way, at a whiteboard, out loud.

Format pairs, taking turnsTime 50 minNeed a whiteboard or shared doc

The point

Technical Interview Quiz 1 falls in this topic. The questions are not trivia — they are the design decisions you have already made, asked out loud. Rehearse saying them.

How to run it

Ten minutes each way. One person asks, the other answers at the whiteboard, talking throughout. The asker's job is to keep asking why.

The questions

  1. Walk me through what happens to x = a[i] + 1; in your compiler, phase by phase. Follow-up: which phase would catch it if a were undeclared, and why can no earlier one?
  2. Your parser sees int total. Variable or function? How does it decide, and how much lookahead does it need?
  3. Where do local variables live, and who decides the offsets, and when? Follow-up: why must the compiler walk the whole function before emitting a single instruction?
  4. Draw the stack for factorial(3) at maximum depth. Now tell me what would break if $ra were not saved.
  5. Your language passes integers by value and arrays by reference. Why the difference? What would change if arrays were by value?
  6. You have ten registers and thirty live values. What do you do? Follow-up: how do you choose which to evict, and what is the ideal choice you cannot compute?
  7. Explain the difference between the two symbol tables in your compiler.
  8. Name a program your compiler accepts and should not. What would catching it take, and in which phase?
What is actually being assessed

Not whether you memorised an answer, but whether you can reason aloud about a system you built, say which parts you are unsure of, and describe how you would find out. 'I do not know, but here is how I would check' is a strong answer.

Deliverable

Nothing to hand in. Note the two questions you answered worst and read the relevant sections before the quiz.