Compiler Design Questions and Answers - Cross Compiler

1. A system program that combines separately compiled modules of a program into a form suitable for execution is called ___________
a) Assembler
b) Linking loader
c) Cross compiler
d) None of the mentioned

Answer: b
Explanation: The definition of cross compiler.

2. A compiler for a high-level language that runs on one machine and produces code for a different machine is called ___________
a) Optimizing compiler
b) One pass compiler
c) Cross compiler
d) Multipass compiler

Answer: c
Explanation: A compiler for a high-level language that runs on one machine and produces code for a different machine is called cross compiler.

3. Cross-compiler is a compiler __________
a) Which is written in a different language from the source language?
b) That generates object code for the machine it’s running on.
c) Which is written in the same language as the source language?
d) That runs on one machine but produces object code for another machine

Answer: a
Explanation: A compiler for a high-level language that runs on one machine and produces code for a different machine is called a cross compiler.

4. Cross compiler is used in Bootstrapping.
a) True
b) False

Answer: a
Explanation: Bootstrapping to a new platform. When software is developed for a new platform, a cross compiler is used to compile necessary tools such as the OS and a native compiler.

5. Is GCC a cross Complier.
a) Yes
b) No

Answer: a
Explanation: GCC, a free software collection of compilers, also can be used as cross compile. It supports many languages and platforms.

6. The __________ is a technique for building cross compilers for other machines.
a) Brazilian Cross
b) Canadian Cross
c) Mexican Cross
d) X-cross

Answer: b
Explanation: The Canadian Cross is a technique for building cross compilers for other machines. Given three machines X, Y, and Z, one uses machine X (e.g. running Windows XP on an IA-32 processor) to build a cross compiler that runs on machine Y (e.g. running Mac OS X on an x86-64 processor) to create executables for machine Z.

7. __________ was developed from the beginning as a cross compiler.
a) Free Pascal
b) GCC
c) Pascal
d) None of the mentioned

Answer: a
Explanation: Free Pascal was developed from the beginning as a cross compiler. The compiler executable (ppcXXX where XXX is target architecture) is capable of producing executables for all OS of the same architecture.

8. What is the output of lexical analyzer?
a) A set of RE
b) Syntax Tree
c) Set of Tokens
d) String Character

Answer: c
Explanation: A lexical analyzer coverts character sequences to set of tokens.

9. Which symbol table implementation is based on the property of locality of reference?
a) Linear list
b) Search tree
c) Hash Table
d) Self Organisation

Answer: c
Explanation: Hash table is used as a reference for symbol table because it is efficient.

10. Which of the following is true for operator precedence parsing?
a) For all pair of non-terminal
b) For all pair of non-terminals
c) To delimit the handle
d) None of the mentioned

Answer: a
Explanation: There are two important properties for these operator precedence parsers is that it does not appear on the right side of any production and no production has two adjacent non-terminals. Implying that no production right side is empty or has two adjacent non-terminals. So accordingly to property option (A) is correct.