Questions: Just-In-Time (JIT) Compilation

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A JIT compiler observes that a function is always called with integer arguments and generates a specialized integer-only version. What must the JIT include to handle the case when the function is later called with a float?

AA compile-time type checker that prevents the float call
BA guard that checks the type assumption at runtime and falls back if violated
CA second pass of the AOT compiler to handle edge cases
DNothing — the specialized version will automatically handle floats correctly
Question 2 Multiple Choice

Why can a JIT-compiled language sometimes outperform ahead-of-time compiled C code for specific workloads?

AJIT compilers use faster hardware than AOT compilers
BJIT compilers skip register allocation to save compilation time
CJIT can generate code specialized to the actual runtime types and hot paths, which AOT cannot know in advance
DJIT-compiled languages are always more efficient because they eliminate all dead code
Question 3 True / False

A JIT compiler starts by executing code in an interpreter before compiling anything, which makes programs initially slower than AOT-compiled equivalents.

TTrue
FFalse
Question 4 True / False

JIT compilation is essentially the same as ahead-of-time compilation, just performed later in the process.

TTrue
FFalse
Question 5 Short Answer

Explain why a JIT compiler needs to interact with the garbage collector, and what could go wrong if it did not.

Think about your answer, then reveal below.