A) Does subroutine know whether it will be part of a nested subroutine call or not ?
Subroutine nesting is a programming practice In which one subroutine call another subroutine. A subroutine does not know if its a part of another subroutine. The link register holds the return address of the currently calling subroutine. This is done using the stack data structure when nested calls are involved. So, when a nested call is made to a subroutine, its address is added to the stack data structure. This is how stack memory works.
The diagram below shows this representation. The subroutine does not know whether it will be a part of a nested subroutine call or not since only one subroutine is being processed at a time, which is managed by the stack memory.
Get Answers For Free
Most questions answered within 1 hours.