1. Which of the following stages converts source code into object code?
(A) Compilation
(B) Linking
(C) Preprocessing
(D) Loading
2. What is the purpose of the preprocessor in C++?
(A) To convert source code into machine code
(B) To include header files and expand macros
(C) To resolve external references
(D) To execute the program
3. Which stage combines multiple object files into a single executable?
(A) Compilation
(B) Preprocessing
(C) Linking
(D) Optimization
4. Which of the following is generated after the compilation stage?
(A) Source file
(B) Executable file
(C) Object file
(D) Header file
5. Which command is typically used to compile a C++ program without linking?
(A) g++ -c file.cpp
(B) g++ file.cpp
(C) g++ -o file file.cpp
(D) g++ -E file.cpp
6. During linking, what is resolved?
(A) Syntax errors
(B) Function calls and external symbols
(C) Preprocessor macros
(D) Comments
7. What file is produced after preprocessing?
(A) cpp file
(B) obj/.o file
(C) Preprocessed source file
(D) Executable file
8. Which of the following stages can generate a “undefined reference” error?
(A) Preprocessing
(B) Compilation
(C) Linking
(D) Loading
9. Which option allows viewing preprocessed code in g++?
(A) c
(B) o
(C) S
(D) E
10. In which stage are inline functions expanded?
(A) Compilation
(B) Linking
(C) Preprocessing
(D) Loading
11. Which of the following is true about static linking?
(A) Libraries are linked at runtime
(B) The source code is linked directly
(C) Only dynamic symbols are resolved
(D) Libraries are combined into the executable at compile time
12. Which of the following is NOT part of the compilation process?
(A) Lexical analysis
(B) Syntax analysis
(C) Semantic analysis
(D) Dynamic loading
13. Which of these files is usually input to the linker?
(A) Source file (.cpp)
(B) Header file (.h)
(C) Executable (.exe)
(D) Object file (.o/.obj)
14. Which type of error is detected at link time?
(A) Syntax error
(B) Type mismatch
(C) Missing function definition
(D) Logical error
15. The main function is required because:
(A) Compiler looks for it to start execution
(B) Preprocessor requires it
(C) Linker requires it
(D) Header files need it