Definition and Purpose of Compilers MCQs January 8, 2026December 13, 2024 by u930973931_answers 10 min Score: 0 Attempted: 0/10 Subscribe 1. What is the primary purpose of a compiler? (A) To execute programs directly (B) To perform memory management (C) To translate high-level programming languages into machine code (D) To check for syntax errors only 2. Which of the following best describes the role of a compiler in software development? (A) It interprets the code line by line (B) It translates a program written in a high-level language into machine-readable code (C) It runs the program on the target machine (D) It manages runtime errors during the execution of the program 3. Which of the following is NOT a purpose of a compiler? (A) To debug a program (B) To check for syntax errors (C) To optimize the performance of a program (D) To generate the final executable code 4. What does the compiler convert a high-level programming language into? (A) Assembly language (B) Bytecode for virtual machines (C) Machine code or object code (D) Source code 5. In which of the following programming stages does a compiler operate? (A) Compilation time (B) Runtime (C) Development time (D) Testing time 6. What is the key advantage of using a compiler over an interpreter? (A) A compiler translates code line by line (B) A compiler translates code all at once, making the execution faster (C) A compiler requires less memory (D) A compiler is more flexible in error handling 7. Which of the following is an example of a task that a compiler performs? (A) Converting high-level programming language statements into machine instructions (B) Converting machine instructions into high-level language (C) Interpreting and executing high-level code directly (D) Checking code for runtime errors 8. Why is compilation necessary for a program written in a high-level language? (A) High-level languages are too complex for direct execution on hardware (B) To ensure the program can run on all devices (C) High-level languages cannot be understood by the computer’s hardware (D) High-level languages are not portable across different systems 9. Which of the following does a compiler NOT do? (A) Translates code to machine language (B) Executes the program immediately (C) Optimizes the performance of the code (D) Detects and reports syntax errors 10. What type of code does a compiler generate from a high-level language? (A) Bytecode (B) Object code or machine code (C) Intermediate code (D) Assembly language