Build Process in C MCQ Questions and Answers
Table of Contents
Learn Build Process in C MCQ Questions and Answers on Basics to attend job placement exams, interview questions, college viva and Lab Tests
Creating and Running C Program ( Build Process in C )
Generally, the programs created using programming languages like C, C++, Java, etc., are written using a high-level language like English. But, the computer cannot understand the high-level language. It can understand only low-level language. In order for the computer to understand a programme written in high-level language, low-level language must be used instead. Either an interpreter or a compiler is employed to perform this conversion.
Popular programming languages like C, C++, Java, etc., use the compiler to convert high-level language instructions into low-level language instructions. A compiler is a program that converts high-level language instructions into low-level language instructions. The compiler typically does two things: first, it checks for programme errors and returns a list of them if any are discovered; otherwise, it converts the entire programme into a low-level language.
To create and execute C programs in the Windows Operating System, we need to install Turbo C software
Step 1: Creating a Source Code
Source code is a file with C programming instructions in a high-level language. To create source code, we use any text editor to write the program instructions. The instructions written in the source code must follow the C programming language rules. The following steps are use to create a source code file in Windows OS…
- Click on the Start button
- Select Run
- Type cmd and press Enter
- and Type cd c:\TC\bin in the command prompt and press Enter
- Type TC press Enter
- Click on File -> New in C Editor window
- Type the program
- Save it as FileName.c (Use shortcut key F2 to save)
Step 2: Compile Source Code (Alt + F9)
The compilation is the process of converting high-level language instructions into low-level language instructions. We use the shortcut key Alt + F9 to compile a C program in Turbo C.
The compilation is the process of converting high-level language instructions into low-level language instructions.
The source file will be sent to the compiler whenever we press Alt + F9. When a source file is received, the compiler first looks for errors. The compiler returns a list of errors if there are any, otherwise it converts the source code to object code and saves it as a file with the extension.obj. The Linker receives the object code after that. The Linker creates an executable file with a.exe extension by combining the code from the specified header file and object code.
Step 3: Executing / Running Executable File (Ctrl + F9)
After completing compilation successfully, an executable file is created with a .exe extension. The processor can understand this .exe file content so that it can perform the task specified in the source file.
We use a shortcut key Ctrl + F9 to run a C program. Whenever we press Ctrl + F9, the .exe file is submitted to the CPU. On receiving .exe file, CPU performs the task according to the instruction written in the file. The result generated from the execution is placed in a window called User Screen.
Step 4: Check Result (Alt + F5)
After running the program, the result is placed into User Screen. Just we need to open the User Screen to check the result of the program execution. We use the shortcut key Alt + F5 to open the User Screen and check the result.
Execution Process of a C Program
The file which contains c program instructions in a high-level language is said to be source code. Every c program source file is saved with .c extension, for example, Sample.c.
Whenever we press Alt + F9 the source file is submitted to the compiler. Compiler checks for the errors, if there are any errors, it returns a list of errors, otherwise generates object code in a file with name Sample.obj and submit it to the linker. The linker combines the code from specified header file into an object file and generates executable file as Sample.exe. With this compilation process completes.
Now, we need to run the executable file (Sample.exe). To run a program we press Ctrl + F9. When we press Ctrl + F9 the executable file is submitted to the CPU. Then CPU performs the task according to the instructions written in that program and place the result into UserScreen.
Then we press Alt + F5 to open UserScreen and check the result of the program.
Important Points of C Program Build Process
- C program file (Source file) must save with .c extension.
- The compiler converts complete program at a time from high-level language to low-level language.
- Input to the compiler is .c file and output from the compiler is .exe file, but it also generates .obj file in this process.
- The compiler converts the file only if there are no errors in the source code.
- CPU places the result in User Screen window.
Overall Process
- Type the program in C editor and save with .c extension (Press F2 to save).
- Press Alt + F9 to compile the program.
- If there are errors, correct the errors and recompile the program.
- If there are no errors, then press Ctrl + F9 to execute/run the program.
- Press Alt + F5 to open User Screen and check the result.
[WpProQuiz 45]
Build Process in C MCQ
1) What is the input file in a C program building process.?
A) filename.k
B) filename.cpp
C) filename.c
D) filename.p
Answer [=] C
Explanation:
Obviously, it is a C file with some code.
2) What is the output Filename of C Program build process ?
A) filename.ex
B) filename.bak
C) filename.exe
D) filename.asm
Answer [=] C
Explanation:
Yes. There will one Exe file created with the same name as the.C file.
3) What is the first step in C program building process?
A) Compiling
B) Assembling
C) Linking
D) Preprocessing
Answer [=] D
Explanation:
Preprocessing deals with #define macros, #pragma, #include and other commands.
4) What is the next step to Preprocessing in C Program build process.?
A) Compiling
B) Assembling
C) Linking
D) None of the above
Answer [=] A
5) What is the next step to Compiling in C program build process.?
A) Preprocessing
B) Assembling
C) Linking
D) None of the above
Answer [=] B
Explanation:
An assembler converts Assembly code from compiler and converts it to Object code or machine code.
6) What is the next step to Assembling in C program build process.?
A) Preprocessing
B) Compiling
C) Linking
D) None of the above
Answer [=] C
Explanation:
Linking combines our C file object code and predefined library functions object code into a single exe file.
7) What is a C Editor.?
A) A C compiler
B) A C assembler
C) A C code editor like notepad
D) None of the above
Answer [=] C
Explanation:
You can any editor for typing and editing C code.
8) What is the output of C Compiler compiling.?
A) An assembly language code
B) Object Code
C) Class file code
D) None of the above
Answer [=] A
9) Expanded Source code is the output of which C program building process?
A) Preprocessor
B) Assembler
C) Linker
D) Compiler
Answer [=] A
Explanation:
Expanded source code includes appropriately replaced macro names (eg. CVV or PI) with Values or Expressions (eg. 3.14 or 2*x+y).
10) Choose a correct statement about C program output file.?
A) Output file .exe is machine dependent. .Exe is windows suitable file.
B) Exe file does not work in Linux or Unix machines. So different type of output is create on different machines
C) Linker produces a suitable output file for each maching
D) All the above
Answer [=] D