Compilation Process MCQ Quiz – Objective Question with Answer for Compilation Process

1. Which of the following function can interpret data in the C language?

A. printf
B. scanf
C. proc
D. file

Answer: B

The scanf and printf are the well-known functions in the C language which is used to interpret data and print data respectively.

 

2. What is the first stage of the compilation process?

A. pre-processing
B. post-processing
C. compilation
D. linking

Answer: A

The pre-processing involves the first stage of the compilation process in which the included files are added. This file defines the standard functions, constants, etc and the output is fed to the compiler.

 

3. Which of the following produces an assembler file in the compilation process?

A. pre-processor
B. assembler
C. compiler
D. post-processing

Answer: C

The output of the pre-processor is given to the compiler which it produces an assembler file from the instruction codes of the processor.

 

4. Which file is converted to an object file?

A. hex file
B. decoded file
C. coded file
D. assembly file

Answer: D

The output of the pre-processor is given to the compiler which produces an assembler file from the instruction codes of the processor and this possesses libraries. The assembly file is then converted into the object file and this contains the hexadecimal coding.

 

5. Which of the following contains the hexadecimal coding?

A. object file
B. assembly file
C. coded file
D. decoded file

Answer: A

The output of the pre-processor is given to the compiler which produces an assembler file from the instruction codes of the processor and which possesses libraries then this assembly file is converted into the object file and which possesses the coding of hexadecimal.

 

6. Which of the following processes the source code before it goes to the compiler?

A. compiler
B. simulator
C. pre-processor
D. emulator

Answer: C

The pre-processor is responsible for processing the source code before it goes to the compiler and this, in turn, allows the programmer to define variable types, constants, and much other information.

 

7. Which of the following allows the programmer to define constants?

A. pre-processor
B. compiler
C. emulator
D. debugger

Answer: A

The pre-processor processes the source code before it goes to the compiler and this allows the programmer to define variable types, constants, and much other information.

 

8. Which statement replaces all occurrences of the identifier with string?

A. # define identifier string
B. # include
C. # define MACRO()
D. # ifdef

Answer: A

# define statement can replace all occurrences of the identifier with string. Similarly, it is able to define the constants, which also makes the code easier to understand.

 

9. Which of the following has the included file?

A. emulator
B. debugger
C. pre-processor
D. simulator

Answer: C

The pre-processor produces the source code before it goes to the compiler and this allows the programmer to define variable types, constants, and much other information. This pre-processor also has to include files and combines them into the program source.

 

10. Which statement is used to condense the code to improve the eligibility?

A. # define MACRO()
B. # include
C. if
D. else-if

Answer: A

The # define MACRO() statement is used to condense the code for improving the code eligibility or for space reasons.

 

11. Which of the following are header files?

A. #include
B. file
C. struct()
D. proc()

Answer: A

The #include is a header file that defines the standard constants, variable types, and many other functions. This can also include some standard libraries.

 

12. Which is the standard C compiler used for the UNIX systems?

A. simulator
B. compiler
C. cc
D. sc

Answer: C

The cc is the standard C compiler used in the UNIX system. Its command lines can be pre-processed, compiled, assembled, and linked to create an executable file.

 

13. Which compiling option is used to compile programs to form part of a library?

A. -c
B. -p
C. -f
D. -g

Answer: A

There are several options for the compilers. Option -c compiles the linking stage and then leaves the object file. This option is used to compile programs to form a part of the library.

 

14. Which compiling option can be used for finding which part of the program is consuming most of the processing time?

A. -f
B. -g
C. -p
D. -c

Answer: C

The -p instructs the compiler to produce codes that count the number of times each routine is called and this is useful for finding the processing time of the programs.

 

15. Which compiling option can generate symbolic debug information for debuggers?

A. -c
B. -p
C. -f
D. -g

Answer: D

The -g generates the symbolic debug information for the debuggers. Without this, the debugger cannot print the variable values, it can only work at the assembler level. The symbolic information is passed through the compilation process and stored in the executable file.

 

16. Which of the following is also known as loader?

A. locater
B. linker
C. assembler
D. compiler

Answer: B

The linker is also known as a loader. It can take the object file and searches the library files to find the routine it calls.

 

17. Which of the following gives the final control to the programmer?

A. linker
B. compiler
C. locater
D. simulator

Answer: A

The linker can give the final control to the programmer concerning how unresolved references are reconciled, where the sections are located in the memory, which routines are used, and so on.

 

18. Which command takes the object file and searches library files to find the routine calls?

A. simulator
B. emulator
C. debugger
D. linker

Answer: D

The linker is also known as a loader. It can take the object file and searches the library files to find the routine it calls. The linker can give the final control to the programmer concerning how unresolved references are reconciled, where the sections are located in the memory, which routines are used, and so on.

 

19. Which assembler option is used to turn off long or short address optimization?

A. -n
B. -V
C. -m
D. -o

Answer: A

The option -o puts the assembler into the file obj file, -V can write the assembler’s version number on the standard error output, -m runs the macro preprocessor on the source file, and -n turns off the long or short address optimization.

 

20. Which assembler option runs the m4 macro preprocessor on the source file?

A. -n
B. -m
C. -V
D. -o

Answer: B

The option -o puts the assembler into the file obj file, -V can write the assembler’s version number on the standard error output, -m runs the macro preprocessor on the source file, and -n turns off the long or short address optimization.

Scroll to Top