Run-Time-Environment
Question 1 |
A linker is given object modules for a set of programs that were compiled separately. What information need to be included in an object module?
Object code | |
Relocation bits | |
Names and locations of all external symbols defined in the object module
| |
Absolute addresses of internal symbols |
Question 1 Explanation:
In object module it includes names and locations of all external symbols defined in the object module.
To link to external symbols it must know the location of external symbols.
To link to external symbols it must know the location of external symbols.
Question 2 |
Consider the following statements.
- I. Symbol table is accessed only during lexical analysis and syntax analysis.
II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.
III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.
Which of the above statements is/are TRUE?
II only | |
I only | |
I and III only
| |
None of I, II and III |
Question 2 Explanation:
I is wrong as Symbol table is also accessed during semantic analysis phase.
II is wrong as compilers which supports recursion require stack memory in run time environment.
III is wrong “any variable must be declared before its use” is a semantic error and not syntax error.
II is wrong as compilers which supports recursion require stack memory in run time environment.
III is wrong “any variable must be declared before its use” is a semantic error and not syntax error.
Question 3 |
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.
Program main; Var ... Procedure A1; Var ... Call A2; End A1 Procedure A2; Var ... Procedure A21; Var ... Call A1; End A21 Call A21; End A21 Call A1; End main.
Consider the calling chain : Main->A1->A2->A21->A1 The correct set of activation records along with their access links is given by:
Question 3 Explanation:
Main → A1 → A2 → A21 → A1
Since, Activation records are created at procedure exit time.
A1 & A2 are defined under Main ( ). So A1 & A2 access links are pointed to main.
A21 is defined under A2, hence its access link will point to A2.
Question 4 |
A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which of the following is true?
A compiler using static memory allocation can be written for L | |
A compiler cannot be written for L; an interpreter must be used | |
A compiler using dynamic memory allocation can be written for L | |
None of the above |
Question 4 Explanation:
Compiler is use dynamic memory allocation then the memory will be allocated to an array at runtime.