Consider the following program written in generic pseudocode:
expression
What is the output printed to the console when this program is executed using call-by-value, call-by-reference, and call-by-copy-restore? The answer has three components, each of which is a list of integers to be entered below.
Output for call-by-value: | |
Output for call-by-reference: | |
Output for call-by-copy-restore: |
Since this program is not a SLang program, each value that is output to the console is an integer, not a SLang 2 denoted value.
Consecutive integers in each list must be separated by at least one blank space.
It may be helpful to trace the execution of this program on paper with the graphical representation of the memory that we used in class.
The correct answer is: Output for call-by-value: CallByValVsRefVsCR.byvalOutput Output for call-by-reference: CallByValVsRefVsCR.byrefOutput Output for call-by-copy-restore: CallByValVsRefVsCR.bycprOutput