HW5_Key - Chapter 9: (Problem Set: pages 395-397) 9)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
١ Chapter 9: (Problem Set: pages 395-397) 9) Consider the procedure BIGSUB in Section 9.5.2.5. Change the two assignments to the LIST array to LIST [1]:= 3 LIST [2]:= 3 Hand-execute the new program under the following assumptions and compare the resulting values in the array LIST in BIGSUB after the return from SUB. a. Parameters are passed by value. LIST = {3, 1} b. Parameters are passed by reference. LIST = {5, 1} c. Parameters are passed by name. LIST = {3, 5} d. Parameters are passed by value-result. LIST = {5, 1} 11) Present one argument against providing both static and dynamic local variables in subprograms. Answer: In subprograms local variables can be static or dynamic; If local variable treated statically: This allows for compile-time allocation/ deallocation and ensures proper type checking but does not allow for recursion. And if local variables treated dynamically: This allows for recursion at the cost of run-time allocation/ deallocation and initialization because these are stored on a stack, referencing is indirect based on stack position and possibly time- consuming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/15/2010 for the course ICS ics103 taught by Professor Alvi during the Spring '07 term at King Fahd University of Petroleum & Minerals.

Page1 / 4

HW5_Key - Chapter 9: (Problem Set: pages 395-397) 9)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online