Translation & Execution MCQs

11 MCQs  — Fundamental Programming MCQs  (Page 1 of 2)

Practice Translation & Execution MCQs with correct answers and explanations. These questions are from the Fundamental Programming MCQs section.

Which statement about an interpreter is correct?
It translates and executes code statement by statement, so an error on a later line may not be reported until execution reaches it
It reports all syntax errors in the whole program before executing any line
It produces a standalone executable file that runs without the interpreter
Interpreted programs always run faster than compiled programs
How does the standard CPython implementation run a .py file?
It compiles the source to bytecode, which the Python virtual machine then executes
It compiles the source directly to native machine code
It interprets raw source text line by line with no compilation step
It converts the code to Java bytecode and runs it on the JVM
What is the correct order of stages when building a C++ program?
Preprocessing → Linking → Compilation → Assembly
Preprocessing → Compilation → Assembly → Linking
Compilation → Preprocessing → Linking → Assembly
Compilation → Assembly → Preprocessing → Linking
What does #include <iostream> do in C++?
The compiler imports a precompiled module at execution
The linker attaches the iostream library at run time
The loader loads iostream into memory when the program starts
The preprocessor textually inserts the header's contents before compilation
What does a JIT (Just-In-Time) compiler do?
It checks syntax only, without generating any code
It compiles intermediate code (such as bytecode) into native machine code while the program is running
It compiles all source code to machine code before distribution
It converts machine code back into source code
In standard C++, what happens when an integer is divided by zero (int x = 5 / y; with y == 0)?
The compiler always refuses to compile the program
A std::runtime_error exception is always thrown
The result is always 0
Undefined behavior: the standard does not guarantee any exception