Run-Time-Environment
Question 1 |
Which one of the following is NOT performed during compilation?
Dynamic memory allocation | |
Type checking | |
Symbol table management | |
Inline expansion |
Question 1 Explanation:
Dynamic memory allocation is not performed during compilation, it occurs at run time only. At the time of compilation, compiler only compiles the instructions for dynamic memory allocation, like calloc, malloc….
Question 2 |
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 2 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 3 |
Which languages necessarily need heap allocation in the runtime environment?
Those that support recursion | |
Those that use dynamic scoping | |
Those that allow dynamic data structures | |
Those that use global variables |
Question 3 Explanation:
Dynamic memory is allocated on the heap by the system. So the languages which allow dynamic data structure require heap allocation at runtime.
Question 4 |
The use of multiple register windows with overlap causes a reduction in the number of memory accesses for
- I. Function locals and parameters
II. Register saves and restores
III. Instruction fetches
I only | |
II only | |
III only | |
I, II and III |
Question 4 Explanation:
I is true because when we make a function call there are some input registers and some output registers. If function F() is calling function G(), we can make the caller function F()'s output registers the same as the called procedure G()'s input registers this is done using overlapping register windows.This will reduce the memory accesses so that F()'s output need not be put into memory for G() to access again from memory.
II is false as register saves and restores would still be required for each and every variable.
III is also false as instruction fetch is not affected by memory access using multiple register windows.
II is false as register saves and restores would still be required for each and every variable.
III is also false as instruction fetch is not affected by memory access using multiple register windows.
There are 4 questions to complete.




