Chapter 7

1. A program written as a sequence of small program units
is easier to understand and thus easier to maintain.

2. Isolation means that a change in a variable value in one
program unit will not affect a variable with the same name in
another program unit.

3. (a) A function name can have a string value and in this case,
must end with a dollar sign.
(b) A subroutine name cannot include a dollar sign.

4. A function unit must include an assignment statement to
assign a value to the function name.

5. A local variable is a variable whose value is known only
within the program unit.

6. The variable Number will have a value of zero because local
variables in a procedure are initialized each time the procedure
is called.

7. A value is never assigned to a subroutine name.

8. The statement DECLARE FUNCTION Second$ must appear in function
First$, prior to the call of function Second$.

9. (a) WILLIAM is not a palindrome.
(b) HANNAH is a palindrome because it reads the same
backwards or forwards.
(c) BABY is not a palindrome.

10. The factorial value of 4 is 1*2*3*4 or 24.

11. The variable ONE in the main program unit and the variable ONE
in the external function refer to two different memory locations.

12. The term "pass by value" means that a value is passed
from the calling program unit to a variable parameter in the called
program unit. There is complete isolation between the two program
units.

13. (a) The last statement in an external function must be
END FUNCTION or END DEF.
(b) The last statement in an external subroutine must
be END SUB.

14. The word DEF may be used instead of the word FUNCTION.

15. The word EXTERNAL is optional in procedures that follow
the END statement of the main program unit.

16. A variable argument in the CALL statement and the
corresponding parameter in the subroutine heading statement refer
to the same memory location.

17. The term "pass by reference" means that a variable
argument in the CALL statement and the corresponding variable
parameter in the subroutine refer to the same address or memory
location. Information can be passed back to the calling program
unit from the called program unit using this address.

18. Values can be passed to an external subroutine through
variable parameters, constant parameters or expression parameters.

19. Values can be returned to a calling program unit from an
external subroutine only through variable parameters.

20. The first statement in a library file must be the word
EXTERNAL.

21. Variables declared in an internal function are known
throughout the entire main program unit.

22. (a) A PUBLIC variable is automatically a SHARED variable.
The value of a PUBLIC variable, declared in a module, is known
thoughout the entire program.
(b) A SHARED variable is not automatically a PUBLIC variable.
The value of a SHARED variable is known thoughout the module where
it is declared, but not outside that module.