Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

When compiling a C program, which tool or GCC component is responsible for resol

ID: 2247012 • Letter: W

Question

When compiling a C program, which tool or GCC component is responsible for resolving the cross-references that are introduced when code in one separately-compiled C file reads or writes to a global variable defined in a different C file? a. the assembler (as) b. the lexer/parser/code generator ("compiler") (cc1) c the linker/loader(ld) d. the runtime linker/loader (ld.so) e. the preprocessor (cpp) During which part of the compilation process are expressions using the sizeof operator (e.g. sizeof int) replaced by the correct numeric value? a. during assembly b. during linking c. during compilation (lexical analysis, parsing and code generation) d. upon the invocation of the make command e. during preprocessing During which part of the compilation process are # define directives processed? a. during assembly b. during linking c. during compilation (lexical analysis, parsing and code generation) d. upon the invocation of the make command e. during preprocessing.

Explanation / Answer

Hi,

Below are the answers-

Ans 12 - (d) The rutime linker/loader(ld.so)
Explanation-
The programs ld.so and ld-linux.so* finds and loads the shared objects that are required by a program and then they prepare the program to run and then run it.
The dynamic linker first inspects each dependency string by verifying the slashes.

Ans 13 - (c) during compilation(lexical analysis, parsing and code generation)
Explanation-
During the Code generation and optimisation phase possibly , the compiler would emit, for example, 4 in place of the code that represents sizeof(int).
The sizeof can be evaluated at runtime if it is assigned to variable length variable like array.

Ans 14 - (e) during preprocessing
Explanation-
#define is a pre-processor directive.
The preprocessor is the part of the compiler that performs certain tasks before the actual compilation starts.
It is used to define constants and macros.
For example,
#define PI 3.14

Thanks and Regards,

Vinay Singh

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote