Computer Organization Questions and Answers for Entrance exams on “Parameter Passing and Stack Frame”.
1. The private work space dedicated to a subroutine is called as ________
a) System heap
b) Reserve
c) Stack frame
d) Allocation
Answer: c
Clarification: This work space is where the intermediate values of the subroutines are stored.
2. If the subroutine exceeds the private space allocated to it then the values are pushed onto _________
a) Stack
b) System heap
c) Reserve Space
d) Stack frame
Answer: a
Clarification: If the allocated work space is exceeded then the data is pushed onto the system stack.
3. ______ pointer is used to point to parameters passed or local parameters of the subroutine.
a) Stack pointer
b) Frame pointer
c) Parameter register
d) Log register
Answer: b
Clarification: This pointer is used to track the current position of the stack being used.
4. The reserved memory or private space of the subroutine gets deallocated when _______
a) The stop instruction is executed by the routine
b) The pointer reaches the end of the space
c) When the routine’s return statement is executed
d) None of the mentioned
Answer: c
Clarification: The work space allocated to a subroutine gets deallocated when the routine is completed.
5. The private space gets allocated to each subroutine when _________
a) The first statement of the routine is executed
b) When the context switch takes place
c) When the routine gets called
d) When the Allocate instruction is executed
Answer: c
Clarification: When the call statement is executed, simultaneously space also gets allocated.
6. _____ the most suitable data structure used to store the return addresses in the case of nested subroutines.
a) Heap
b) Stack
c) Queue
d) List
Answer: b
Clarification: None.
7. In the case of nested subroutines, the stack top is always _________
a) The saved contents of the called sub routine
b) The saved contents of the calling sub routine
c) The return addresses of the called sub routine
d) None of the mentioned
Answer: a
Clarification: None.
8. The stack frame for each subroutine is present in ______
a) Main memory
b) System Heap
c) Processor Stack
d) None of the mentioned
Answer: c
Clarification: The memory for the work space is allocated from the processor stack.
9. The data structure suitable for scheduling processes is _______
a) List
b) Heap
c) Queue
d) Stack
Answer: c
Clarification: The Queue data structure is generally used for scheduling as it is two directional.
10. The sub-routine service procedure is similar to that of the interrupt service routine in ________
a) Method of context switch
b) Returning
c) Process execution
d) Method of context switch & Process execution
Answer: d
Clarification: The Subroutine service procedure is the same as the interrupt service routine in all aspects, except the fact that interrupt might not be related to the process being executed.