Compiler Writing Tools (e.g., LLVM, GCC Internals) MCQs January 8, 2026December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. What is LLVM primarily used for? (A) Operating system development (B) Database management (C) Compiler infrastructure and code optimization (D) Networking 2. Which of the following is a front-end component in a compiler? (A) Code generator (B) Register allocator (C) Optimizer (D) Parser 3. What is the main function of GCC in compiler design? (A) Debugging software (B) Network simulation (C) Running operating systems (D) Compiling source code into machine code 4. LLVM IR stands for: (A) Internal Register (B) Internal Runtime (C) Input Resource (D) Intermediate Representation 5. Which of the following is true about GCC internals? (A) GCC only performs lexical analysis (B) GCC has front-end, middle-end, and back-end components (C) GCC is only an interpreter (D) GCC cannot optimize code 6. What is the purpose of LLVM’s optimizer? (A) Transform LLVM IR to improve performance and reduce resource usage (B) Convert source code to tokens (C) Allocate memory (D) Generate user interfaces 7. Which tool is used to generate assembly code in GCC? (A) GCC back-end (B) GCC front-end (C) Lex (D) Yacc 8. What is the role of a compiler front-end? (A) Generate machine code (B) Manage memory allocation at runtime (C) Execute the program (D) Perform lexical, syntax, and semantic analysis 9. What is just-in-time (JIT) compilation in LLVM? (A) Generating source code (B) Compiling code at runtime for immediate execution (C) Debugging errors (D) Tokenizing source code 10. Which language is GCC primarily written in? (A) Java (B) C/C++ (C) Python (D) Ruby 11. What is the purpose of LLVM passes? (A) To perform sequential compilation of source code (B) To parse command-line arguments (C) To generate HTML reports (D) To analyze and transform LLVM IR for optimization 12. Which of the following is a benefit of using LLVM? (A) Provides reusable compiler infrastructure for multiple languages (B) Only supports one programming language (C) Cannot optimize code (D) Only works for embedded systems 13. What is GCC’s GIMPLE representation? (A) A type of token (B) A simplified intermediate representation used for optimizations (C) A parser tree (D) A machine code format 14. Which of the following is a back-end task in compilers? (A) Lexical analysis (B) Generating target-specific assembly code (C) Syntax analysis (D) Semantic analysis 15. What does the term “cross-compilation” mean in compiler tools? (A) Compiling code and executing immediately (B) Compiling code on one platform to run on another (C) Compiling only for testing purposes (D) Compiling without generating object code 16. What is an important feature of LLVM compared to GCC? (A) LLVM cannot perform optimization (B) LLVM only works for C language (C) LLVM does not support intermediate code (D) LLVM provides a modular compiler infrastructure and reusable libraries 17. Which GCC component handles language-specific front-end tasks? (A) Middle-end (B) Back-end (C) Language front-end (e.g., g++ for C++) (D) Optimizer 18. Which of the following is an LLVM tool for analyzing IR? (A) llc (B) opt (C) gcc (D) gdb 19. What is the purpose of GCC’s middle-end? (A) Lexical analysis (B) Debugging runtime errors (C) Generating machine code (D) Optimization and intermediate code transformations 20. Which file format does LLVM use for its intermediate representation? (A) c (B) bc (bitcode) (C) o (D) asm 21. What is the role of a target-independent optimizer? (A) Optimize code without considering the hardware specifics (B) Allocate registers for a specific CPU (C) Perform syntax checking (D) Generate assembly instructions 22. What is the function of LLVM’s llc tool? (A) Perform lexical analysis (B) Debug source code (C) Compile LLVM IR to target-specific assembly (D) Generate tokens 23. Which GCC pass simplifies control flow and expression evaluation? (A) GIMPLE pass (B) Lexical pass (C) Syntax pass (D) Parser pass 24. What is a benefit of using intermediate representations (IR) in compilers? (A) Removes need for syntax analysis (B) Slows down compilation (C) Increases code size (D) Simplifies optimization and code generation 25. Which LLVM component manages code generation for multiple target architectures? (A) Back-end (B) Front-end (C) Tokenizer (D) Parser 26. Which of the following GCC tools is used to compile C++ code? (A) gcc (B) make (C) g++ (D) lex 27. What is a pass manager in LLVM? (A) A lexical analyzer (B) A module that manages execution of optimization and analysis passes (C) A parser generator (D) A debugger 28. What is link-time optimization (LTO) in compilers? (A) Optimization performed at the source code level (B) Lexical optimization (C) Parsing optimization (D) Optimization performed when linking multiple object files 29. Which of the following languages has front-end support in LLVM? (A) Only Java (B) C, C++, Rust, Swift (C) Only Python (D) Only Assembly 30. Why are compiler tools like LLVM and GCC important for modern software development? (A) They provide debugging and networking services (B) They handle user interface design (C) They manage databases (D) They provide efficient, optimized, and portable code generation for multiple languages and platforms