Skip to content
Preptima

Compilers & Runtimes interview questions

Compilation phases, interpretation versus JIT, memory layout, and garbage-collection theory.

3 questions in CS Fundamentals.

medium2

mediumConcept

Walk me through what happens between the source you write and the instructions the CPU runs, and where does a JIT fit into that?

Source is tokenised, parsed, checked, lowered to an intermediate representation, optimised and emitted - either ahead of time to machine code or to bytecode executed by a runtime. A JIT compiles hot bytecode at run time using profiles, which is why managed programs get faster after warm-up. Use this compilers answer to show the decision, trade-off, and evidence rather than a memorised definition.

5 minmid, senior, staff

hard1

hardConcept

A method has been running fast for an hour and then gets slower, with no code change and no extra traffic. What might the runtime be doing?

A JIT compiles against a profile gathered earlier, so its fast code rests on assumptions that can be invalidated: a new receiver type at a call site, a branch taken for the first time, a class loaded that gives an interface a second implementation. The method deoptimises and recompiles from a worse profile. It also connects deoptimisation to the point an interviewer is testing.

5 minmid, senior, staff