Which of the following class of statement usually produces no executable code…
2008
Which of the following class of statement usually produces no executable code when compiled?
- A.
declaration
- B.
assignment statements
- C.
input and output statements
- D.
structural statements
Attempted by 1150 students.
Show answer & explanation
Correct answer: A
Concept
A compiler classifies source statements into two broad kinds. Non-executable (declarative) statements only give the compiler information — names, types, sizes, scope — so it can reserve storage and check usage; they translate to no machine instructions that run at execution time. Executable statements describe actions to be carried out at run time, so the compiler emits actual machine code for them.
Applying it here
“declaration” is a declarative statement: it tells the compiler the type and storage requirement of an identifier. The compiler uses it to build its symbol table and lay out memory, but it usually emits no run-time instruction for the declaration itself. Hence it is the class that normally produces no executable code.
Contrast with the other classes
“assignment statements” — compute a value and store it into a location; the compiler must emit load/compute/store instructions that run at execution time.
“input and output statements” — transfer data to or from devices/streams, which requires run-time calls and instructions.
“structural statements” — control statements such as branches and loops; they compile into jump/test instructions that direct the flow at run time.
Cross-check
Note the standard distinction between a declaration and a definition: a pure declaration merely introduces a name, whereas a definition that initialises storage may emit code. The question asks for the class that “usually” produces no executable code, which matches a plain declaration.
A video solution is available for this question — log in and enroll to watch it.