Question:medium

Which one of the following classes of statements usually produces no executable code when compiled?

Show Hint

Declarations affect compilation metadata, not runtime execution.
Updated On: Jul 6, 2026
  • Declarations
  • Assignment statements
  • Input and output statements
  • Control statements
Show Solution

The Correct Option is A

Approach Solution - 1

Assignments, I/O statements, and control statements all describe something that has to actually happen while the program is running, computing a value, transferring data, or changing which instruction runs next, so the compiler must emit real machine instructions for each of them.
A declaration is different, it just tells the compiler "this name exists and has this type", information the compiler uses to allocate storage and check later statements, but it doesn't correspond to any runtime action by itself.
Because nothing needs to happen at runtime just from declaring a variable, no executable code is generated for it.
So the correct answer is declarations.
Was this answer helpful?
0
Show Solution

Approach Solution -2

A clean way to check this is to sort each statement type into "purely compile-time bookkeeping" versus "something the CPU must do while running":

  1. Declarations: Purely compile-time, they update the symbol table with a name, type, and storage size, none of which requires a runtime action, so no instructions are emitted for them.
  2. Assignment statements: Runtime action required, a value must be computed and physically written to memory or a register while the program executes.
  3. Input and output statements: Runtime action required, data must actually move between the program and an external device or file as the program executes.
  4. Control statements: Runtime action required, the CPU must evaluate a condition and jump to a different instruction address while executing.

Only one category has no runtime component at all, everything else demands the CPU do something while the program is actually running.

Therefore, the correct answer is Declarations.

Was this answer helpful?
0