Computer Organization Questions and Answers – Subroutines and Nesting

This set of Computer Organization and Architecture Multiple Choice Questions & Answers (MCQs) focuses on “Subroutines and Nesting”.

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

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
View Answer

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
View Answer

Answer: c
Explanation: None.
advertisement
advertisement

4. The order in which the return addresses are generated and used is _________
a) LIFO
b) FIFO
c) Random
d) Highest priority
View Answer

Answer: a
Explanation: That 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
View Answer

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
View Answer

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
View Answer

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

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
View Answer

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
View Answer

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

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
View Answer

Answer: d
Explanation: None.

Sanfoundry Global Education & Learning Series – Computer Organization and Architecture.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.