COMPILER DESIGN

INTERMEDIATE CODE GENERATION

SYNTAX TREES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which one of the following is true?
A
a compiler using static memory allocation can be written for L
B
a compiler cannot be written for L ; an interpreter must be used
C
a compiler using dynamic memory allocation can be written for L
D
none of these
Explanation: 

Detailed explanation-1: -Memory can be allocated for data variables after the program begins execution. This mechanism is known as runtime memory allocation or dynamic memory allocation.

Detailed explanation-2: -Static memory allocation is also known as Compile-time memory allocation because the memory is allocated during compile time. In this type of memory allocation, the memory that the program can use is fixed i.e. we can not allocate or deallocate memory during the program’s execution.

Detailed explanation-3: -3. Choose the statement which is incorrect with respect to dynamic memory allocation. Explanation: Execution of the program using dynamic memory allocation is slower than that using static memory allocation. This is because in dynamic memory allocation, the memory has to be allocated during run time.

There is 1 question to complete.