1. What is a cross-compiler?
A) A compiler that runs on multiple operating systems
B) A compiler that generates code for the same architecture on which it runs
C) A compiler that generates code for a different platform than the one on which it runs
D) A compiler that only translates source code into assembly language
Answer: C) A compiler that generates code for a different platform than the one on which it runs
2. Which of the following is NOT a typical use case for a cross-compiler?
A) Developing software for embedded systems
B) Compiling code on a 64-bit machine for a 32-bit target machine
C) Compiling code for the same architecture
D) Developing applications for a microcontroller from a desktop machine
Answer: C) Compiling code for the same architecture
3. Which of the following is an example of a cross-compiler?
A) A compiler that generates x86 code on an x86 machine
B) A compiler that generates ARM code on an Intel-based machine
C) A compiler that only generates assembly code
D) A compiler that generates code for the same machine architecture
Answer: B) A compiler that generates ARM code on an Intel-based machine
4. What is bootstrapping in the context of compilers?
A) Generating machine code for an operating system
B) Creating a new version of a compiler using a previous version of the same compiler
C) Translating a program into assembly language
D) Debugging a program using a debugger
Answer: B) Creating a new version of a compiler using a previous version of the same compiler
5. Which of the following describes the bootstrapping process in compiler development?
A) Writing a new compiler by hand
B) Using a pre-existing compiler to create a new version of itself
C) Debugging the compiler using test cases
D) Translating high-level code into machine code directly
Answer: B) Using a pre-existing compiler to create a new version of itself
6. Which is an advantage of using a cross-compiler?
A) It generates machine code for the same platform it runs on
B) It allows developers to compile code for different target architectures from a host system
C) It eliminates the need for debugging
D) It only works on a single operating system
Answer: B) It allows developers to compile code for different target architectures from a host system
7. What is typically required for a cross-compiler to work?
A) A compiler for the same architecture
B) A target platform simulator
C) A runtime environment for the target platform
D) A compiler that runs on the host platform and generates code for the target platform
Answer: D) A compiler that runs on the host platform and generates code for the target platform
8. Which of the following is NOT an example of a cross-compilation scenario?
A) Compiling code on a Windows machine for Linux
B) Compiling C code for a mobile device from a desktop
C) Compiling code on a 64-bit machine for another 64-bit machine
D) Compiling embedded code on a desktop for an embedded system
Answer: C) Compiling code on a 64-bit machine for another 64-bit machine
9. Which of the following is an example of bootstrapping in the real world?
A) Writing assembly code for a target machine
B) Using a compiler written in C to compile a new C compiler
C) Writing a compiler for a target language without any pre-existing compilers
D) Using a debugger to optimize a program
Answer: B) Using a compiler written in C to compile a new C compiler
10. What is the primary goal of bootstrapping a compiler?
A) To generate the source code for a compiler
B) To enable the generation of a new version of the compiler that can be used to compile programs for different architectures
C) To improve the speed of the target platform
D) To debug and fix errors in a pre-existing compiler
Answer: B) To enable the generation of a new version of the compiler that can be used to compile programs for different architectures
11. Which of the following steps is typically involved in the bootstrapping process?
A) Using an existing compiler to compile an earlier version of the same compiler
B) Writing a compiler from scratch using machine-level instructions
C) Developing a new language to be compiled
D) Testing the code generated by a compiler on multiple platforms
Answer: A) Using an existing compiler to compile an earlier version of the same compiler
12. Why is bootstrapping important for the development of new compilers?
A) It allows for better runtime performance of the compiled code
B) It helps avoid the need for using third-party tools
C) It allows a compiler to be self-hosting, enabling future improvements
D) It simplifies the process of generating machine code
Answer: C) It allows a compiler to be self-hosting, enabling future improvements
13. Which of the following can be used to cross-compile for different operating systems?
A) A single compiler for both host and target systems
B) A dedicated cross-compiler that targets different platforms
C) A dynamic linker
D) A runtime system specific to each target platform
Answer: B) A dedicated cross-compiler that targets different platforms
14. Which of the following is NOT an advantage of using a cross-compiler in embedded system development?
A) It allows compilation of code for an embedded target from a host system
B) It avoids the need for building a compiler on the target system
C) It provides better optimization for the target system
D) It compiles code for the same architecture it runs on
Answer: D) It compiles code for the same architecture it runs on
15. Which of the following is NOT typically true about a cross-compiler?
A) It compiles code for a target platform different from the host platform
B) It can be used to develop software for embedded systems
C) It requires a target platform simulator to function
D) It compiles code for the same platform on which it runs
Answer: D) It compiles code for the same platform on which it runs
16. Which of the following is the correct sequence for bootstrapping a compiler?
A) Write the source code, then write the compiler, and finally use the compiler to generate code
B) Use an existing compiler to compile the source code, then write a new compiler
C) Write the new compiler, then test it using the source code
D) Use an existing compiler to generate machine code directly
Answer: B) Use an existing compiler to compile the source code, then write a new compiler