Base CS from zero
From machine code to a language: multiple-choice review
Six questions that cut across the whole unit. Each one asks you to connect ideas from different lessons — the assembler’s one-to-one rule, what high-level languages buy you, how translation strategies differ, and what the runtime does — rather than to recite a single definition.
Confirm you can connect the rungs of the ladder: raw machine code, assembly, high-level languages, the translation strategies that bridge them, and the runtime and pipeline that carry your code all the way to the CPU.
You write one line of assembly, ADD R0 R1, and one line of TypeScript, total = price * qty + shipping. How many machine instructions does each produce, and what does that reveal?
A team wants to ship the same program to both x86-64 Linux servers and ARM laptops. They consider distributing it as hand-written assembly. What goes wrong, and what fixes it?
A CPU-bound batch job runs for hours. The team can ship it as compiled C or as an interpreted Python script. Ignoring development effort, which runs the computation faster at run time, and why?
A Node.js service is slow for the first few seconds under load, then speeds up and stays fast. Which mechanism explains this, and is it a bug?
A junior says 'the runtime is just another name for the operating system.' Why is that wrong?
You click Run on a C program. Which ordering of the pipeline stages is correct?
The unit is one ladder. Assembly names machine code one instruction at a time; high-level languages let one statement stand for many instructions and stay portable across CPUs; compilers translate the whole program ahead of time while interpreters translate statement by statement at run time, and JIT mixes both by compiling hot spots on the fly; the runtime (GC, call stack, standard library, VM) supports your code throughout; and the full pipeline — source → translate → link → load → runtime startup → fetch-decode-execute — carries every program to the CPU, which never knows what language it came from.