FreeExam

Compiler engineer: Code Generation and Runtime

Original technical interview cases on instruction selection, registers, ABI lowering, layout, relocation, exceptions, garbage collection, JIT code, and runtime metadata. Target assumptions are stated where needed.

These prompts are original practice. They are not questions from a named employer or a live hiring loop.

  1. 1.A backend maps an IR operation to a target instruction. What must selection preserve?

    Show answer and explanation
    1. Opcode spelling
    2. The fewest instructions regardless of effects
    3. Required IR results and effects
    4. The original virtual-register order

    Answer: Required IR results and effects

    Instruction selection must implement the relevant value and effect behavior.

  2. 2.A target lacks a direct instruction for an operation. What may legalization do?

    Show answer and explanation
    1. Drop the operation
    2. Change its result width without preserving meaning
    3. Equivalent supported expansion
    4. Assume unsupported operations execute implicitly

    Answer: Equivalent supported expansion

    Legalization must preserve meaning using available mechanisms.

  3. 3.A 64-bit add is lowered to two 32-bit adds. What must cross the low-half boundary?

    Show answer and explanation
    1. Carry information
    2. The high half's sign bit only
    3. The low-half result's zero flag only
    4. The original high-half sum without adjustment

    Answer: Carry information

    The high half must account for overflow from the low half.

  4. 4.A target uses little-endian bytes. What order represents 16-bit value 0x1234 in increasing addresses?

    Show answer and explanation
    1. 0x12 then 0x34
    2. 0x00 then 0x12
    3. 0x34 then 0x34
    4. 0x34 then 0x12

    Answer: 0x34 then 0x12

    Little-endian stores the least significant byte first.

  5. 5.An instruction requires a sign-extended immediate. What must encoding verify?

    Show answer and explanation
    1. The encoded immediate’s legal range and extension rule
    2. Whether the assembler accepts the literal spelling
    3. Whether the host integer type accepts the value
    4. Whether truncation leaves the low bits unchanged

    Answer: The encoded immediate’s legal range and extension rule

    Not every integer fits a constrained immediate representation.

  6. 6.A supplied target uses a two's-complement signed 8-bit immediate. Which supplied value is representable?

    Show answer and explanation
    1. 255
    2. -128
    3. 256
    4. 128

    Answer: -128

    Its range is negative 128 through positive 127.

  7. 7.A target shift masks the count, but the source requires a trap for large counts. What is needed?

    Show answer and explanation
    1. Preserve source traps.
    2. Use count masking unconditionally.
    3. Treat the target's behavior as redefining the source rule.
    4. Discard the range check because the operation is fast.

    Answer: Preserve source traps.

    Target behavior must implement the language's specified exceptional cases.

  8. 8.A backend uses arithmetic shift where logical shift is required. What can differ?

    Show answer and explanation
    1. Only the low bits discarded by the shift
    2. Inserted high bits
    3. Only flags that no later instruction reads
    4. No result when the input has its high bit set

    Answer: Inserted high bits

    Arithmetic and logical shifts treat high bits differently.

  9. 9.A narrow unsigned result is extended to a wider type. What extension is required under the supplied unsigned rule?

    Show answer and explanation
    1. Zero extension
    2. Sign extension
    3. Replicating the most significant source bit
    4. Reversing the byte order

    Answer: Zero extension

    Unsigned widening preserves the value by adding zero high bits.

  10. 10.Under a supplied two's-complement signed integer convention, a negative narrow value is widened. What should sign extension preserve?

    Show answer and explanation
    1. Its unsigned interpretation
    2. Its original bit width
    3. Its signed numeric value
    4. The raw source bits followed by zeros

    Answer: Its signed numeric value

    Repeating the sign bit preserves the two's-complement signed value.

  11. 11.A register allocator assigns overlapping live values to one physical register. What can happen?

    Show answer and explanation
    1. Always safe coalescing
    2. Automatic preservation by the processor
    3. Clobbering one live value with another
    4. Only a larger stack frame

    Answer: Clobbering one live value with another

    Simultaneously needed values generally require nonconflicting storage.

  12. 12.Two values are never live together. What opportunity may exist?

    Show answer and explanation
    1. Mandatory separate storage
    2. Automatic memory aliasing between the values
    3. A required spill for both values
    4. Reusing one physical register across disjoint live ranges

    Answer: Reusing one physical register across disjoint live ranges

    Nonoverlapping live ranges can share storage subject to constraints.

  13. 13.A target instruction requires a fixed register. What must allocation respect?

    Show answer and explanation
    1. The operand constraint
    2. The lowest available register number
    3. The operand's preferred register even if illegal
    4. The allocation with the fewest spills regardless of legality

    Answer: The operand constraint

    Machine constraints can require specific physical locations.

  14. 14.A call clobbers a caller-saved register holding a live value. What must code generation ensure?

    Show answer and explanation
    1. Its earlier allocation
    2. Live-value preservation
    3. The call's small instruction count as preservation proof
    4. A guarantee all calls preserve all registers

    Answer: Live-value preservation

    The caller must account for the calling convention's clobbers.

  15. 15.A function modifies a callee-saved register. What does the ABI typically require under the supplied convention?

    Show answer and explanation
    1. Return it as the function result.
    2. Restore the caller value.
    3. Clear it instead of restoring it.
    4. Preserve it only when optimizations are disabled.

    Answer: Restore the caller value.

    Callee-saved means preserving the caller's value according to the convention.

  16. 16.A spill slot is reused for simultaneously live values. What invariant is violated?

    Show answer and explanation
    1. Only source-level scope boundaries
    2. Only stack-slot naming consistency
    3. Only the frame's total alignment
    4. Interference between simultaneously live stored values

    Answer: Interference between simultaneously live stored values

    Spill locations must preserve all values still needed.

  17. 17.A value is cheap to recreate. What may reduce spill traffic?

    Show answer and explanation
    1. Duplicating arbitrary effects
    2. Rematerializing the value when needed
    3. Removing live uses that caused the spill
    4. Ignoring the value's lifetime

    Answer: Rematerializing the value when needed

    Safe recomputation can avoid some memory loads and stores.

  18. 18.A rematerialized operation reads mutable memory. What must be checked?

    Show answer and explanation
    1. Its execution cost alone
    2. Recomputation that observes the required memory value
    3. The fact the original load succeeded once
    4. Whether another physical register is free

    Answer: Recomputation that observes the required memory value

    Not every operation can be safely repeated.

  19. 19.A parallel copy requires swapping registers A and B. What is needed if neither value is dead?

    Show answer and explanation
    1. Two naive sequential copies
    2. A cycle-safe swap
    3. Dropping one assignment because registers overlap
    4. Assuming the two incoming values are equal

    Answer: A cycle-safe swap

    Naive copies can overwrite a source before it is preserved.

  20. 20.A temporary register saves old A, then A receives old B. What should B receive?

    Show answer and explanation
    1. The newly written A
    2. The saved old A
    3. The old B
    4. The current stack pointer

    Answer: The saved old A

    The saved value completes the swap correctly.

  21. 21.Phi elimination inserts edge-specific copies. What must they preserve?

    Show answer and explanation
    1. The incoming value associated with each control-flow edge
    2. The same number of copies on every edge
    3. The first incoming value for every predecessor
    4. Only that all copy operands have matching widths

    Answer: The incoming value associated with each control-flow edge

    Phi values depend on the incoming edge, so copies must execute on the appropriate path.

  22. 22.A machine scheduler has a required memory-dependence edge from a store to a load of potentially overlapping storage. What must an emitted schedule respect?

    Show answer and explanation
    1. The required memory-dependence ordering
    2. Scheduling priority overrides all memory edges.
    3. Equal load and store latency proves independence.
    4. Register assignment makes potentially aliasing addresses disjoint.

    Answer: The required memory-dependence ordering

    A legal schedule must respect required memory dependencies. Priority, equal instruction latency, or register allocation does not prove that potentially overlapping accesses can be reordered.

  23. 23.A scheduler models data dependencies but ignores exceptions. What can go wrong?

    Show answer and explanation
    1. Only a less compact schedule
    2. Guaranteed equivalence from data dependencies alone
    3. Only a different throughput estimate
    4. Changed fault behavior

    Answer: Changed fault behavior

    Faulting operations can constrain motion.

  24. 24.A target has separate integer and vector register classes. What must allocation respect?

    Show answer and explanation
    1. Virtual-register numbering
    2. Only width, regardless of available register banks
    3. The legal machine register class for each operand
    4. The block's execution count

    Answer: The legal machine register class for each operand

    Machine operands must be assigned compatible registers or conversions.

  25. 25.A vector register is partially overwritten. What must liveness track if old lanes remain used?

    Show answer and explanation
    1. Only the newly written lanes
    2. Contents of lanes still needed by later uses
    3. Only whether the vector instruction has a result
    4. Only whole-register definition counts

    Answer: Contents of lanes still needed by later uses

    Partial writes can preserve or destroy particular portions depending on target semantics.

  26. 26.A target instruction implicitly reads status flags. What must scheduling represent?

    Show answer and explanation
    1. Explicit operands alone
    2. Only control-flow predecessors
    3. Only the instruction's result register
    4. Dependencies on implicit status-flag operands

    Answer: Dependencies on implicit status-flag operands

    Implicit machine state is still semantically relevant.

  27. 27.A comparison's flags are overwritten before a conditional branch. What can happen?

    Show answer and explanation
    1. The original condition is recovered automatically.
    2. Only the branch encoding size can change.
    3. The branch uses the wrong condition.
    4. The linker recreates the comparison flags.

    Answer: The branch uses the wrong condition.

    Flag liveness must extend to its dependent branch.

  28. 28.A stack frame contains 24 bytes and must align to 16 under an exercise. What rounded size is sufficient?

    Show answer and explanation
    1. 32 bytes
    2. 48 bytes
    3. 24 bytes
    4. 28 bytes

    Answer: 32 bytes

    The next multiple of sixteen at or above twenty-four is thirty-two.

  29. 29.A slot starts at offset 12 and requires 8-byte alignment. What is the next aligned offset?

    Show answer and explanation
    1. 12
    2. 20
    3. 14
    4. 16

    Answer: 16

    Sixteen is the next multiple of eight.

  30. 30.A function's stack pointer is misaligned at a call. What should be checked?

    Show answer and explanation
    1. Only the local spill-slot alignment
    2. Only the stack alignment at function entry
    3. Only whether the callee has stack arguments
    4. The ABI’s required stack alignment at the call boundary

    Answer: The ABI’s required stack alignment at the call boundary

    Calling conventions can impose alignment constraints at call boundaries.

  31. 31.A variable-sized stack allocation occurs. What must frame handling preserve?

    Show answer and explanation
    1. A constant frame size for all executions
    2. A valid frame state as the runtime allocation changes
    3. Only the number of stack allocations
    4. A stack pointer fixed at its entry address throughout

    Answer: A valid frame state as the runtime allocation changes

    Dynamic allocation complicates stack layout and exit restoration.

  32. 32.A function has multiple returns. What must prologue/epilogue generation ensure?

    Show answer and explanation
    1. Restore state on all exits.
    2. Restore the first return only.
    3. Restore only the longest path.
    4. Assume every return shares an epilogue automatically.

    Answer: Restore state on all exits.

    All permitted exits must respect frame and calling-convention obligations.

  33. 33.An exceptional exit bypasses required cleanup. What is missing?

    Show answer and explanation
    1. Only normal-return restoration
    2. Only the size of the reserved stack frame
    3. Unwind and cleanup paths
    4. Only the handler's ordinary return value

    Answer: Unwind and cleanup paths

    Exception handling must preserve language cleanup and unwinding semantics.

  34. 34.Unwind metadata describes a different stack layout from emitted code. What can fail?

    Show answer and explanation
    1. Recovering caller frames during stack unwinding
    2. Only arithmetic constant folding
    3. Only register selection in already emitted instructions
    4. Only the source parser's type inference

    Answer: Recovering caller frames during stack unwinding

    Unwind information must accurately describe machine state transitions.

  35. 35.An ABI returns a large structure through hidden storage. What must callers and callees agree on?

    Show answer and explanation
    1. Visible source arity alone
    2. Only the structure's source name
    3. Only the total bytes copied inside the callee
    4. The hidden storage parameter and its ABI placement

    Answer: The hidden storage parameter and its ABI placement

    ABI lowering can add implicit parameters and obligations.

  36. 36.Two modules use incompatible calling conventions for one function. What risk arises?

    Show answer and explanation
    1. Only slower linking
    2. Incompatible argument, return, or preserved-state conventions
    3. Automatic adaptation between all conventions
    4. Only a debug-location difference

    Answer: Incompatible argument, return, or preserved-state conventions

    Interoperability depends on compatible binary contracts or explicit adapters.

  37. 37.A variadic call passes floating values under a special ABI rule. What must lowering use?

    Show answer and explanation
    1. The fixed-argument rule unchanged
    2. The register allocator's preferred placement
    3. The variadic ABI
    4. The source type names alone

    Answer: The variadic ABI

    Variadic ABIs can differ from ordinary calls.

  38. 38.An FFI function returns a pointer to storage that is released before its caller uses it. Layout and calling conventions match. Which remaining boundary contract fails?

    Show answer and explanation
    1. Argument register assignment
    2. Returned storage lifetime
    3. Integer byte order
    4. External symbol visibility

    Answer: Returned storage lifetime

    Matching the binary call convention does not keep returned storage alive. The caller needs a valid lifetime or ownership arrangement for the pointed-to data.

  39. 39.A language boolean has target ABI width different from an internal IR boolean. What must happen?

    Show answer and explanation
    1. Reuse the internal bits without checking the ABI.
    2. Truncate arbitrarily to the shortest representation.
    3. Conversion to the ABI’s boolean representation
    4. Change the source type to match allocation convenience.

    Answer: Conversion to the ABI’s boolean representation

    Internal and external representations can differ.

  40. 40.A backend emits target layout using host pointer size. What must be corrected?

    Show answer and explanation
    1. Target layout
    2. The host ABI alone
    3. Only the generated register width
    4. The widest integer type used by the compiler implementation

    Answer: Target layout

    Cross-compilation must use target representation rules.

  41. 41.A supplied target has 32-bit pointers. What is pointer size in bytes?

    Show answer and explanation
    1. 2
    2. 8
    3. 4
    4. 32

    Answer: 4

    Thirty-two bits divided by eight equals four bytes.

  42. 42.A supplied structure has 4-byte int then 8-byte value aligned to 8, with total alignment 8. What is its size?

    Show answer and explanation
    1. 24 bytes
    2. 12 bytes
    3. 20 bytes
    4. 16 bytes

    Answer: 16 bytes

    Four bytes of padding place the second member at eight; total size is sixteen.

  43. 43.A packed structure removes alignment padding. What must generated accesses consider?

    Show answer and explanation
    1. Guaranteed natural alignment
    2. Only the structure's total byte size
    3. Only the field's declared scalar type
    4. Fields whose addresses lack natural alignment

    Answer: Fields whose addresses lack natural alignment

    Packed layout can require safe unaligned access handling.

  44. 44.A target traps on unaligned wide loads. What may lowering need?

    Show answer and explanation
    1. An unconditional aligned load
    2. A register rename instead of access legalization
    3. Safe unaligned handling
    4. An assumption every runtime pointer is aligned

    Answer: Safe unaligned handling

    Target constraints require suitable code when alignment is not proven.

  45. 45.A branch displacement exceeds the short encoding's range. What can a backend do?

    Show answer and explanation
    1. Wrap the displacement.
    2. A valid alternate encoding
    3. Delete the branch if it is too distant.
    4. Assume the loader guesses the intended destination.

    Answer: A valid alternate encoding

    Branch relaxation must preserve the destination with a representable encoding.

  46. 46.Instruction sizes change during branch relaxation. What must be recomputed?

    Show answer and explanation
    1. Instruction addresses and displacements in the final layout
    2. Only branch probabilities
    3. The original instruction addresses unchanged
    4. Only the original displacement's sign

    Answer: Instruction addresses and displacements in the final layout

    Layout changes can alter distances for other branches and relocations.

  47. 47.An object record names the correct external symbol but uses an absolute relocation where the instruction expects a PC-relative offset. What is the defect?

    Show answer and explanation
    1. Wrong relocation kind for the encoded address form
    2. Correct relocation because the symbol name matches
    3. Only an incorrect source-line mapping
    4. Correct relocation whenever its field is wide enough

    Answer: Wrong relocation kind for the encoded address form

    The relocation must compute the value the instruction expects. A matching symbol name is insufficient when absolute and PC-relative address forms have different semantics.

  48. 48.Position-independent code is required. What must generated addressing respect?

    Show answer and explanation
    1. The target addressing model
    2. Fixed absolute addresses everywhere
    3. Only the relocation field's width
    4. Only whether the symbol was locally declared

    Answer: The target addressing model

    Code may load at different addresses and needs appropriate access sequences.

  49. 49.A function pointer and a data pointer differ under a target ABI. What must code generation avoid?

    Show answer and explanation
    1. Assuming pointer equivalence
    2. Using the actual ABI
    3. Tracking distinct pointer categories
    4. Applying supported boundary conversions

    Answer: Assuming pointer equivalence

    Target pointer categories need not be interchangeable.

  50. 50.A thread-local variable is accessed like a process-global address. What can break?

    Show answer and explanation
    1. Only a different register-allocation preference
    2. Only a larger relocation table
    3. No behavior if the address fits a machine word
    4. Per-thread storage semantics

    Answer: Per-thread storage semantics

    Thread-local storage requires the target runtime's access model.

  51. 51.A garbage collector moves objects at safepoints. What information may be needed?

    Show answer and explanation
    1. Only all pointer-typed source declarations, regardless of liveness
    2. Maps locating live references at collection points
    3. Only assembly labels for allocation sites
    4. Only the total stack-frame size

    Answer: Maps locating live references at collection points

    The runtime must find and update relevant references.

  52. 52.A pointer is hidden in an unreported register across a moving collection. What risk arises?

    Show answer and explanation
    1. Automatic safe pointer relocation
    2. Only an inaccurate debug variable
    3. Guaranteed safety because the register remains allocated
    4. References that still point at old object locations

    Answer: References that still point at old object locations

    The collector cannot update references it does not know about under that runtime contract.

  53. 53.A derived pointer survives a safepoint. What must the runtime/compiler contract address?

    Show answer and explanation
    1. Only the interior pointer's static type
    2. Only its raw pre-collection address
    3. How to retain or recover each derived pointer’s base and offset
    4. An assumption moving the base preserves all derived addresses

    Answer: How to retain or recover each derived pointer’s base and offset

    Moving collection can require reconstructing interior references from tracked bases.

  54. 54.A safepoint map marks an integer as a pointer under an exact collector. What is wrong?

    Show answer and explanation
    1. Root entries inconsistent with the exact collector’s contract
    2. Only slower scanning
    3. Guaranteed conservative correctness under the exact contract
    4. Automatic conversion of the integer's type

    Answer: Root entries inconsistent with the exact collector’s contract

    Exact runtime metadata must describe actual reference locations.

  55. 55.A compiler eliminates a value needed by deoptimization. What must it retain or reconstruct?

    Show answer and explanation
    1. Only the original variable names
    2. The state required to resume the fallback execution
    3. Only the optimized path's explicit uses
    4. Only a larger register-allocation budget

    Answer: The state required to resume the fallback execution

    Optimized execution must support valid fallback state reconstruction.

  56. 56.A JIT patches instructions while another thread executes them. What must be considered?

    Show answer and explanation
    1. Only patch length
    2. Safe code-publication rules
    3. A guarantee every architecture sees instruction writes immediately
    4. Only source-level type checks

    Answer: Safe code-publication rules

    Safe code patching depends on hardware and runtime protocols.

  57. 57.A target has separate instruction and data caches. After generating code, what may be required?

    Show answer and explanation
    1. Only writing code bytes
    2. Only marking all memory executable
    3. Instruction-cache synchronization
    4. Only successfully assembling the bytes

    Answer: Instruction-cache synchronization

    New code must become visible to instruction fetch under the actual platform contract.

  58. 58.A runtime enforces write-or-execute memory policy. What should code installation respect?

    Show answer and explanation
    1. Permanent writable-executable mappings by default
    2. Only an internal installed-code flag
    3. Valid protection transitions
    4. Only page allocation without protection changes

    Answer: Valid protection transitions

    Code generation must cooperate with platform memory protections.

  59. 59.A JIT embeds an address that later becomes invalid. What is needed?

    Show answer and explanation
    1. Only choosing shorter instructions
    2. Only recording the source expression
    3. Assuming embedded addresses update themselves
    4. Keeping embedded addresses valid or updating affected code

    Answer: Keeping embedded addresses valid or updating affected code

    Generated code can outlive the objects or code it references.

  60. 60.A shared library unloads while generated code still calls it. What exposure exists?

    Show answer and explanation
    1. Only a slower indirect call
    2. Automatic repair by the original static linker
    3. Calls through references to code that is no longer loaded
    4. Only a missed inlining opportunity

    Answer: Calls through references to code that is no longer loaded

    Code lifetime and outstanding references must be coordinated.

  61. 61.An inline cache assumes a receiver shape. What must a guard establish?

    Show answer and explanation
    1. Nonnullness alone
    2. Fast-path preconditions
    3. The receiver's source type name without runtime shape evidence
    4. The inline cache's capacity

    Answer: Fast-path preconditions

    A fast path is sound only when its specific preconditions hold.

  62. 62.A shape changes after code specialization. What is required?

    Show answer and explanation
    1. Keep assumptions indefinitely.
    2. Remove the guard because specialization already occurred.
    3. Treat updated documentation as code invalidation.
    4. Valid guards or invalidation

    Answer: Valid guards or invalidation

    Specialized code must remain consistent with mutable runtime facts.

  63. 63.A calling convention passes three arguments in registers and the rest on stack. A call has five arguments. How many use stack under that exercise?

    Show answer and explanation
    1. 2
    2. 8
    3. 3
    4. 5

    Answer: 2

    Five minus three equals two.

  64. 64.A supplied stack argument slot is 8 bytes. Two slots need how much space before other alignment?

    Show answer and explanation
    1. 10 bytes
    2. 8 bytes
    3. 32 bytes
    4. 16 bytes

    Answer: 16 bytes

    Two times eight equals sixteen bytes.

  65. 65.A tail call uses a different stack-argument layout. What must be checked?

    Show answer and explanation
    1. Legal frame reuse
    2. Textual tail position alone
    3. Equal return types alone
    4. Equal source argument counts alone

    Answer: Legal frame reuse

    Tail position alone does not establish a legal tail-call sequence.

  66. 66.An instruction selection pattern omits a side effect from the matched IR. What failed?

    Show answer and explanation
    1. Missing required effects
    2. Only missed profitability
    3. Only a different scheduling preference
    4. Only more conservative register allocation

    Answer: Missing required effects

    A selected instruction sequence must implement all required effects.

  67. 67.A peephole rewrite replaces two instructions with one that changes flags. What should be checked?

    Show answer and explanation
    1. The final scalar value alone
    2. Only the flag state at function entry
    3. Whether later instructions need the original status flags
    4. The reduced instruction count alone

    Answer: Whether later instructions need the original status flags

    Implicit effects can make an otherwise similar sequence inequivalent.

  68. 68.A machine instruction has an early-clobber output. What must allocation avoid?

    Show answer and explanation
    1. All low-numbered registers
    2. Every stack slot regardless of liveness
    3. Early input destruction
    4. All vector registers by default

    Answer: Early input destruction

    Timing constraints can prohibit some operand overlap.

  69. 69.A two-address instruction overwrites one input. What may lowering need?

    Show answer and explanation
    1. Delete other uses of the old input.
    2. Assume the overwritten input is always dead.
    3. Change the source arithmetic result.
    4. Preserve overwritten inputs.

    Answer: Preserve overwritten inputs.

    The overwritten operand must remain available where required.

  70. 70.Register allocation improves spill count but worsens runtime. What should profiling examine?

    Show answer and explanation
    1. Spill count alone
    2. Only the count of allocated physical registers
    3. A guarantee fewer spills always means faster code
    4. The combined costs of spills, scheduling, and memory behavior

    Answer: The combined costs of spills, scheduling, and memory behavior

    One metric does not capture total target cost.

  71. 71.A backend schedules for latency but ignores throughput resources. What can occur?

    Show answer and explanation
    1. Guaranteed optimal throughput
    2. Only larger symbol tables
    3. Execution bottlenecks
    4. No runtime effect if latency improves

    Answer: Execution bottlenecks

    Machine resource constraints can dominate performance.

  72. 72.A target has one execution unit for a repeated operation. What limits parallel issue?

    Show answer and explanation
    1. Only dependence-chain length
    2. Only the number of available registers
    3. Only the static number of distinct opcodes
    4. That unit's capacity and instruction constraints

    Answer: That unit's capacity and instruction constraints

    Available execution resources constrain achievable throughput.

  73. 73.A vectorized loop requires aligned data. What must the entry logic do?

    Show answer and explanation
    1. Assume all arrays meet alignment.
    2. A valid alignment strategy
    3. Use source type spelling as address proof.
    4. Ignore actual runtime addresses.

    Answer: A valid alignment strategy

    Alignment-dependent code needs justified preconditions or alternatives.

  74. 74.A target saturating add is selected for source wrapping add. What is wrong?

    Show answer and explanation
    1. Both always produce the same bits.
    2. Saturation changes only diagnostics.
    3. Overflow results differ.
    4. The linker restores the wrapping result.

    Answer: Overflow results differ.

    Saturating and modular arithmetic have different semantics.

  75. 75.Under 8-bit unsigned saturation, what is 250+10?

    Show answer and explanation
    1. 255
    2. 260
    3. 250
    4. 4

    Answer: 255

    Saturation clamps to the maximum 255, unlike wrapping.

  76. 76.Under a supplied unsigned 8-bit wrapping rule, what value results from 250+10?

    Show answer and explanation
    1. 4
    2. 0
    3. 255
    4. 260

    Answer: 4

    260 modulo 256 equals four.

  77. 77.An arithmetic instruction sets flags but the source requires none. Can those flag changes still matter?

    Show answer and explanation
    1. No; implicit machine state cannot be observed.
    2. Yes; every flag must be preserved forever.
    3. No; status flags exist only in source semantics.
    4. Yes, if flags are live.

    Answer: Yes, if flags are live.

    Backend legality depends on actual surrounding machine uses.

  78. 78.Debug information says a value is in a register after it has been spilled. What needs repair?

    Show answer and explanation
    1. The value’s location after it moves between register and stack
    2. Only the variable's source declaration
    3. Only the spill slot's byte size
    4. Only the function's call graph

    Answer: The value’s location after it moves between register and stack

    Debug locations must follow machine-state changes.

  79. 79.An optimized variable has no single storage location. What may debug metadata need?

    Show answer and explanation
    1. A permanent fabricated register
    2. Ranged value locations
    3. Only the value at function entry
    4. A source-line number without location information

    Answer: Ranged value locations

    Values can move, be reconstructed, or become unavailable over different ranges.

  80. 80.A runtime exception reports the wrong source location after scheduling. What should be examined?

    Show answer and explanation
    1. Only instruction latency
    2. Only the final frame size
    3. Source attribution
    4. Only the exception handler's symbol name

    Answer: Source attribution

    Movement and lowering should preserve useful source attribution under the debug contract.

  81. 81.A stack map's instruction offset changes during final layout. What must be updated?

    Show answer and explanation
    1. Only the entry's live-value list
    2. The code position associated with that stack-map entry
    3. Only the function's total frame size
    4. The original code offset unchanged

    Answer: The code position associated with that stack-map entry

    Metadata tied to code positions must match final emitted layout.

  82. 82.A linker relaxes a call sequence. What must remain coherent?

    Show answer and explanation
    1. Only metadata at function entry
    2. Only the source-level call's type
    3. Metadata whose positions depend on the relaxed code layout
    4. Only the old return-address offset

    Answer: Metadata whose positions depend on the relaxed code layout

    Late changes can affect more than instruction bytes.

  83. 83.A backend test runs only on the host architecture. What gap remains?

    Show answer and explanation
    1. Only host instruction legality
    2. Alternate targets
    3. Only host ABI compatibility
    4. Only host program output coverage

    Answer: Alternate targets

    Target-specific constraints need relevant coverage beyond one host.

  84. 84.A cross-target test inspects assembly but never runs it. What does it not establish alone?

    Show answer and explanation
    1. Runtime correctness
    2. That assembly was emitted
    3. That the checked pattern appeared
    4. That the compilation finished

    Answer: Runtime correctness

    Static output checks and execution tests provide different evidence.

  85. 85.An emulator disagrees with hardware. What should investigation compare?

    Show answer and explanation
    1. Specs and reproduction conditions
    2. Whichever result is faster
    3. A presumption the emulator always defines the hardware contract
    4. Only the tools' version labels

    Answer: Specs and reproduction conditions

    Both test environments and generated code can need scrutiny.

  86. 86.A miscompilation occurs only with exceptions enabled. What area deserves attention?

    Show answer and explanation
    1. Only parsing exception keywords
    2. Only ordinary arithmetic selection
    3. Only the source program's token count
    4. Lowering of exceptional control flow and required cleanup

    Answer: Lowering of exceptional control flow and required cleanup

    Exception mode can alter exits, cleanup, and runtime contracts.

  87. 87.A machine verifier finds an operand outside its register class. What does that indicate?

    Show answer and explanation
    1. A guaranteed source error
    2. Invalid machine IR
    3. A harmless performance preference
    4. An arbitrary valid physical register choice

    Answer: Invalid machine IR

    Machine IR must satisfy target operand constraints.

  88. 88.A generated function returns with the wrong stack pointer. What can fail?

    Show answer and explanation
    1. Caller state corruption during return or subsequent execution
    2. Only extra spill traffic
    3. Only a less accurate scheduling estimate
    4. Only larger debug records

    Answer: Caller state corruption during return or subsequent execution

    Stack restoration is part of the calling contract.

  89. 89.A callback crosses into a runtime with different exception rules. What should be defined?

    Show answer and explanation
    1. The callback's name alone
    2. Cross-runtime error handling
    3. A guarantee every exception crosses every runtime freely
    4. The length of the callback body

    Answer: Cross-runtime error handling

    Foreign boundaries need explicit compatible error handling.

  90. 90.A runtime object layout changes but old JIT code remains. What is required?

    Show answer and explanation
    1. Keep old field offsets indefinitely.
    2. Update the type name without affected code.
    3. Invalidate stale layout assumptions.
    4. Assume shared source means stable runtime layout.

    Answer: Invalidate stale layout assumptions.

    Compiled layout assumptions can become stale.

  91. 91.A constant-pool load is moved beyond its addressing range. What should layout handle?

    Show answer and explanation
    1. Only the constant's bit width
    2. The original pool address despite increased distance
    3. Only whether the literal's value is unchanged
    4. An address form or pool placement that reaches the literal

    Answer: An address form or pool placement that reaches the literal

    Target addressing constraints apply to literal data as well as branches.

  92. 92.A branch has signed displacement range -128 to 127. Is displacement 140 directly representable?

    Show answer and explanation
    1. Yes; every positive displacement fits.
    2. Yes; any number fits a one-byte displacement.
    3. No; only zero can be encoded.
    4. No, it exceeds the positive range.

    Answer: No, it exceeds the positive range.

    140 is greater than 127; another encoding or sequence is needed.

  93. 93.A backend folds a load into an instruction with different fault ordering. What should be checked?

    Show answer and explanation
    1. The instruction count alone
    2. Only the final scalar value on nonfaulting inputs
    3. Memory and fault behavior
    4. Only whether both instructions access memory

    Answer: Memory and fault behavior

    Combining operations must preserve required behavior, not just values.

  94. 94.A runtime can inspect stack frames asynchronously. What must code and metadata support?

    Show answer and explanation
    1. Only normal return states
    2. Permitted observation states
    3. Only the first instruction's frame state
    4. Only states visible in debug builds

    Answer: Permitted observation states

    Required asynchronous observations can constrain frame and metadata design.

  95. 95.A code buffer grows and moves after addresses were embedded. What is needed?

    Show answer and explanation
    1. Only increasing the buffer's capacity
    2. Only regenerating source-line names
    3. Automatic updates of all embedded addresses
    4. Relocating references affected by the moved code buffer

    Answer: Relocating references affected by the moved code buffer

    Moving code can invalidate absolute references.

  96. 96.A JIT publishes a callable entry point to another thread while code bytes and runtime metadata are still being validated. What risk should design review consider?

    Show answer and explanation
    1. Only slower compilation
    2. Another thread entering incompletely validated code
    3. Only an extra metadata allocation
    4. Guaranteed safety from allocated executable memory

    Answer: Another thread entering incompletely validated code

    Publication can let another thread execute incomplete or invalid code. Validation, metadata completion, protection, and synchronization must satisfy the runtime and platform contract before use.

  97. 97.A backend optimization changes instruction count but fails an ABI test. What should be prioritized?

    Show answer and explanation
    1. The smaller instruction count
    2. The faster compilation time
    3. ABI correctness
    4. The cleaner assembly listing

    Answer: ABI correctness

    ABI correctness is required regardless of static code size.

  98. 98.A candidate explains a backend bug using one assembly dump. What strengthens the case?

    Show answer and explanation
    1. Only another dump from the same compilation
    2. Only fewer instructions in the proposed output
    3. Only a performance measurement without checking behavior
    4. A focused test checking the target behavior and failure condition

    Answer: A focused test checking the target behavior and failure condition

    A concrete semantic and machine-level argument makes the diagnosis reviewable.

  99. 99.A backend patch fixes one target but changes shared lowering. What else should be checked?

    Show answer and explanation
    1. Only the original target's reproducer
    2. Only generated code size on the original target
    3. Regression behavior on other targets using the shared lowering
    4. A guarantee shared lowering cannot affect other targets

    Answer: Regression behavior on other targets using the shared lowering

    Shared transformations may have target-specific consequences.

  100. 100.Registers A, B, and C hold distinct live values. A parallel copy requires A←old B, B←old C, and C←old A. One temporary t is available. Which sequential sequence implements the simultaneous assignment?

    Show answer and explanation
    1. t=A; A=B; B=C; C=t
    2. A=B; B=C; C=A
    3. t=B; A=B; B=C; C=t
    4. t=A; A=C; C=B; B=t

    Answer: t=A; A=B; B=C; C=t

    Saving old A prevents it from being overwritten before C receives it. With old values 11,22,33, the correct sequence yields 22,33,11; the naive sequence loses old A.

  101. 101.A supplied moving collector relocates an object base from byte address 1000 to 2000. A live interior pointer denotes base+24 bytes and must be reconstructed after the safepoint; the object is not pinned. What address must the reconstructed pointer contain?

    Show answer and explanation
    1. 1024
    2. 2000
    3. 3024
    4. 2024

    Answer: 2024

    The runtime contract preserves the interior offset from the relocated base: 2000+24=2024. Retaining 1024 uses the stale object address; using 2000 drops the offset.