• edited by
4,399 views
2 2 votes

Consider the following statements:
S1 : Static allocation can not support recursive function.
S2 : Stack allocation can support pointers but can not deallocate storage at run-time.
S3 : Heap allocation can support pointers and it can allocate or deallocate storage at run-time.
Which of the above statements are true?

a S1 and S2

b S2 and S3

c S3 and S1

d  S1, S2 and S3

4 Answers

0 0 votes
ANS is C
FOR S2
int **p = new int*;

In this case you reserve a portion of memory for a pointer to int in the heap, but the pointer that can reference such location is still a stack variable.

0 0 votes

TRUE   S1 : Static allocation can not support recursive function.

FALSE  S2 : Stack allocation can support pointers but can not deallocate storage at run-time.

Stack memory is allocated during compilation time execution. This is known as static memory allocation.

https://iq.opengenus.org/static-memory-allocation-c/

TRUE   S3 :  Heap allocation can support pointers and it can allocate or deallocate storage at run-time.

 

Position:
Show:

Related questions

2 2 votes
4 4 answers
2.9k
2.9k views
rahul sharma 5 asked Jan 24, 2018
2,877 views
Match the following with respect to activation record fields:A 1 → A, D; 2 → B, CB 1 → A, C; 2 → B, DC 1 → B, C; 2 → A, DD 1 → B, D; 2 → A, CDoubt:- Control link points t...
1 1 vote
2 answers 2 answers
2.5k
2.5k views
Prince Sindhiya asked Dec 27, 2018
2,455 views
The two basic operations that are often performed with the symbol table are:1.Set and reset 2.Set and insert 3. Insert and lookup 4.Reset and lookup
1 1 vote
1 1 answer
1.6k
1.6k views
Na462 asked Oct 8, 2018
1,569 views
Which of the Following is True ?A. Symbol table Construction is during the analysis part of the Compiler.B. Type checking is Done during Syntax Analysis phaseC. SDD with ...
0 0 votes
0 0 answers
548
548 views
Misbah Ghaya asked Aug 18, 2022
548 views
Please list out the best free available video playlist for Runtime Environments from Compiler design as an answer here (only one playlist per answer). We'll then select t...