Cross-compilers and Bootstrapping MCQs January 8, 2026December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. What is a cross-compiler? (A) A compiler that generates code for a different target platform than the one it runs on (B) A compiler that generates code for the same platform it runs on (C) A compiler that only interprets code (D) A compiler used exclusively for debugging 2. Which of the following is a main purpose of cross-compilers? (A) Running software on the same machine (B) Translating assembly code to high-level code (C) Debugging source code only (D) Generating executable code for embedded or remote systems 3. What is bootstrapping in compiler design? (A) Compiling a program using another programming language (B) Optimizing assembly code (C) The process of writing a compiler in the language it is intended to compile (D) Converting machine code to source code 4. Why is bootstrapping important for new programming languages? (A) It helps with memory management (B) It reduces runtime errors (C) It allows the language to compile itself, proving its completeness and correctness (D) It provides runtime debugging tools 5. What is a host machine in cross-compilation? (A) The machine for which the code is being generated (B) A server hosting the source code (C) The target embedded system (D) The machine on which the cross-compiler runs 6. What is a target machine in cross-compilation? (A) The machine for which the compiler generates executable code (B) The machine running the source code (C) The compiler itself (D) The development environment 7. Which of the following is true about cross-compilers? (A) They can compile code for multiple target architectures from one host (B) They cannot generate optimized code (C) They run only on embedded systems (D) They are the same as interpreters 8. What is self-hosting in compiler development? (A) A compiler capable of compiling programs written in another language (B) Debugging a compiler without source code (C) Compiling code remotely (D) A compiler written in the same programming language it compiles 9. Which of the following is a challenge in cross-compilation? (A) Memory allocation in high-level languages (B) Writing source code (C) Running the compiler on the same machine as the target (D) Ensuring compatibility between host and target system architectures 10. What is the first stage in bootstrapping a compiler? (A) Writing an interpreter for the language (B) Performing register allocation (C) Generating optimized machine code (D) Writing a simple initial compiler (stage 0) in another language 11. In bootstrapping, what is stage 1 compiler? (A) A debugging tool (B) The original simple compiler written in another language (C) The final optimized compiler (D) The first compiler written in the target language itself 12. What is the main advantage of a self-hosting compiler? (A) It demonstrates that the language is powerful and complete enough to implement itself (B) It eliminates the need for cross-compilers (C) It runs faster than interpreters (D) It simplifies memory management 13. Which of the following is true about a cross-compiler’s output? (A) Runs on a different architecture than the host (B) Always runs on the host machine (C) Cannot be executed (D) Is written in assembly language only 14. Why are cross-compilers commonly used for embedded systems? (A) Embedded systems require interpreters (B) Embedded systems cannot run machine code (C) Embedded systems cannot interpret code (D) Embedded systems often lack resources to run a full compiler 15. Which file format is commonly generated by cross-compilers for target machines? (A) Source code files (.c, .cpp) (B) Object files or executables (.o, .elf) (C) Text documents (.txt) (D) HTML files 16. In cross-compilation, what is the role of the assembler? (A) Translate assembly code to machine code for the target (B) Translate source code to intermediate representation (C) Debug source code (D) Analyze syntax errors 17. What is a benefit of bootstrapping a compiler? (A) It allows iterative improvement of the compiler using its own language (B) Faster source code interpretation (C) Reduces machine code size (D) Simplifies syntax analysis 18. What is the typical sequence in bootstrapping a new compiler? (A) Interpreter → Stage 0 compiler → Stage 1 compiler → Optimized compiler (B) Optimized compiler → Stage 0 → Stage 1 → Interpreter (C) Source code → Machine code → Assembly (D) Syntax analysis → Lexical analysis → Optimization 19. Which of the following is a common example of a cross-compiler? (A) Python interpreter (B) GCC targeting ARM on an x86 host (C) Java virtual machine (D) SQL compiler 20. What is a “hosted compiler”? (A) A compiler that runs on the target machine (B) A compiler used only in cloud systems (C) A compiler for distributed systems (D) A compiler that runs on a host machine to generate code for the same host 21. Which of the following is necessary for successful cross-compilation? (A) Cloud services (B) Only the source code (C) Only the host compiler (D) Target machine libraries and headers 22. What is the difference between cross-compilation and native compilation? (A) Cross-compilation generates code for a different platform; native generates for the same platform (B) Cross-compilation generates code for the same platform; native generates for a different platform (C) Both are identical (D) Native compilation uses interpreters 23. What is a common bootstrapping challenge? (A) Increasing memory capacity (B) Installing operating system updates (C) Ensuring the initial compiler can handle its own language features correctly (D) Debugging runtime errors 24. Which of the following languages is often bootstrapped? (A) C (B) All of the above (C) Rust (D) C++ 25. Why is testing important during bootstrapping? (A) To change syntax rules (B) To reduce runtime speed (C) To optimize disk usage (D) To verify that the compiler produces correct machine code 26. What is a stage 2 compiler in bootstrapping? (A) The initial interpreter (B) A parser generator (C) A cross-compiler (D) The compiler built using the stage 1 compiler, often fully functional and optimized 27. Which GCC option is commonly used for cross-compilation? (A) march (B) Wall (C) O2 (D) target 28. What does “self-compiling” mean in the context of bootstrapping? (A) A compiler runs without an operating system (B) A compiler can debug its own code (C) A compiler can compile its own source code (D) A compiler interprets code at runtime 29. Which is an advantage of cross-compilation for embedded systems? (A) Reduces the need for the target system to have a compiler (B) Increases target memory usage (C) Requires larger host machines (D) Eliminates source code debugging 30. What is the final goal of bootstrapping a compiler? (A) To run the compiler without errors on the host only (B) To have a fully functional, self-hosting compiler that can compile its own source code efficiently (C) To generate interpreters (D) To translate assembly into high-level code