Subroutines & Nesting Questions and Answers – Computer Architecture

1. The return address of the Sub-routine is pointed to by _______
a) IR
b) PC
c) MAR
d) Special memory registers

Answer: b

Explanation: The return address from the subroutine is pointed to by the PC.

2. The location to return to, from the subroutine is stored in _______

a) TLB
b) PC
c) MAR
d) Link registers

Answer: d

Explanation: The registers store the return address of the routine and is pointed to by the PC.

3. What is subroutine nesting?

a) Having multiple subroutines in a program
b) Using a linking nest statement to put many subroutines under the same name
c) Having one routine call the other
d) None of the mentioned

Answer: c

Explanation: Subroutine nesting is a common Programming practice In which one Subroutine call another Subroutine.

4. The order in which the return addresses are generated and used is ______

a) LIFO
b) FIFO
c) Random
d) Highest priority

Answer: a

Explanation:  The order in which the return addresses are generated and used is LIFO which is the routine called first is returned first.

5. In case of nested subroutines the return addresses are stored in ______

a) System heap
b) Special memory buffers
c) Processor stack
d) Registers

Answer: c
Explanation: In this case, there will be more number of return addresses it is stored on the processor stack.

6. The appropriate return addresses are obtained with the help of ____ in case of nested routines.

a) MAR
b) MDR
c) Buffers
d) Stack-pointers

Answer: d

Explanation: The pointers are used to point to the location on the stack where the address is stored.

7. When parameters are being passed on to the subroutines they are stored in ______

a) Registers
b) Memory locations
c) Processor stacks
d) All of the mentioned

Answer: d

Explanation: In the case of, parameter passing the data can be stored on any of the storage space.

8. The most efficient way of handling parameter passing is by using _____

a) General purpose registers
b) Stacks
c) Memory locations
d) None of the mentioned

Answer: a

Explanation: By using general purpose registers for the parameter passing we make the process more efficient.

9. The most Flexible way of logging the return addresses of the subroutines is by using ____

a) Registers
b) Stacks
c) Memory locations
d) None of the mentioned

Answer: b

Explanation: The stacks are used as Logs for return addresses of the subroutines.

 

10. The wrong statement/s regarding interrupts and subroutines among the following is/are ______

i) The sub-routine and interrupts have a return statement
ii) Both of them alter the content of the PC
iii) Both are software oriented
iv) Both can be initiated by the user

a) i, ii and iv
b) ii and iii
c) iv
d) iii and iv

Answer: d

Leave a Comment

Your email address will not be published.