When a subroutine is called, the address of the instruction following the CALL…
2021
When a subroutine is called, the address of the instruction following the CALL instructions is stored in/on the
- A.
Stack
- B.
Accumulator
- C.
Program Counter (PC)
- D.
Stack pointer
- E.
Question not attempted
Attempted by 157 students.
Show answer & explanation
Correct answer: A
When a subroutine is called, the processor needs to remember where to return after the subroutine finishes. This is done by storing the address of the next instruction (the return address) in a specific location.
The return address is typically pushed onto the stack, and the stack pointer is updated to point to the new top of the stack. After the subroutine completes, the return address is popped from the stack, and the program resumes execution from that address.
The Program Counter (PC) is responsible for holding the address of the next instruction to be executed. During a subroutine call, the PC is updated to point to the start of the subroutine, and the return address is saved so that the PC can be restored correctly.
The stack pointer is used to manage the stack, but it does not store the return address directly. Instead, it points to the location where the return address is stored on the stack.
The accumulator is used for arithmetic and logic operations and is not involved in storing return addresses.
हिन्दी उत्तर:
जब किसी उपकार्य को बुलाया जाता है, तो प्रोसेसर को याद रखना होता है कि उपकार्य समाप्त होने के बाद किस निर्देश पर जारी रखना है। इसके लिए अगले निर्देश का पता (रिटर्न एड्रेस) एक विशिष्ट स्थान पर संग्रहीत किया जाता है।
रिटर्न एड्रेस आमतौर पर स्टैक पर डाला जाता है, और स्टैक पॉइंटर को स्टैक के नए शीर्ष पर इंगित करने के लिए अपडेट किया जाता है। उपकार्य समाप्त होने के बाद, रिटर्न एड्रेस को स्टैक से निकाला जाता है, और प्रोग्राम उस एड्रेस से निर्देश निष्पादन जारी रखता है।
प्रोग्राम काउंटर (PC) अगले निर्देश के पते को रखने के लिए जिम्मेदार होता है। उपकार्य कॉल के दौरान, PC को उपकार्य की शुरुआत के पते पर अपडेट किया जाता है, और रिटर्न एड्रेस संग्रहीत किया जाता है ताकि PC को सही तरीके से बहाल किया जा सके।
स्टैक पॉइंटर स्टैक का प्रबंधन करने के लिए उपयोग किया जाता है, लेकिन यह रिटर्न एड्रेस को सीधे संग्रहीत नहीं करता है। इसके बजाय, यह उस स्थान को इंगित करता है जहाँ रिटर्न एड्रेस स्टैक पर संग्रहीत होता है।
एक्यूमुलेटर अंकगणित और तार्किक ऑपरेशन के लिए उपयोग किया जाता है और रिटर्न एड्रेस को संग्रहीत करने में शामिल नहीं होता है।