Student Activities

1.  Students create some code that are examples of the use of

a)  Global Variables - create a procedure using a Global Variable
b)  Local Variables -  create a procedure using a local variable that overrides the Global Variable value.
c)  Procedures passing Parameters to a SubRoutine

Consider using a simple coding platform - such as Python

04 Set 5D - Commonly Executed Code - Questions


SET 5D (Davis Textbook) 

1. What is generally considered to be the 
most common and best way to pass 
variables between modules?
(A) The use of parameters.
(B) The use of sharing variables.
(C) The use of function calls.
(D) The use of procedure calls.

2. Variables that are available to all other 
modules within the software project are 
referred to as:
(A) actual parameters.
(B) global parameters.
(C) function variables.
(D) global variables.

3. What is the name given to a subroutine 
when its identifier has a data type and a 
value of this type is returned to the 
calling subroutine?
(A) A procedure.
(B) A function.
(C) A call.
(D) A variable.

4. With regards to variables, what is meant 
by the term ‘Scope’?
(A) The extent or range of operation.
(B) A call that specifies the routine to 
be executed.
(C) Where in a program, a given 
identifier may be accessed.
(D) Both A and C.

5. When developing code for reuse, it is 
important to develop generic code 
because:
(A) It will then be suitable for inclusion 
in a library of code.
(B) It will have been thoroughly tested 
at time of creation and therefore 
should only need minimal, if any 
modification for use in a new
project.
(C) Programming time is saved.
(D) All of the above.

6. To invoke a subroutine in a 
programming language is known by 
what term?
(A) Process.
(B) Parse.
(C) Pass.
(D) Call.

7. A subroutine can either be a:
(A) procedure or function.
(B) procedure or parameter.
(C) function or variable.
(D) parameter or variable.

8. Routines suitable for inclusion in a 
library of code should:
(A) use global variables.
(B) use parameters.
(C) call other modules.
(D) always be compiled.

9. What is normally used to communicate 
data to subroutines?
(A) Local variables.
(B) Global variables.
(C) All variables.
(D) Parameters.

10. Which of the following statements is 
correct?
(A) A global variable is available to 
other subroutines and is destroyed 
only when the program ends.
(B) A global variable is available to 
other subroutines and is created 
and destroyed each time a 
subroutine calls it.
(C) A global variable is available only 
to a single subroutine but is 
destroyed only when the program 
ends.
(D) A global variable is available to 
other subroutines and is never 
destroyed to ensure its availability.

11. Dynamic Link Libraries, Active X controls and the Windows API are all compiled modules 
of code. What advantages and disadvantages does this have for software developers?


12. How can altering the scope of a variable, be used to allow other modules access to required 
data items. Discuss.


13. Procedures and functions are different types of subroutines. What is the difference between 
the two in terms of how they are called by higher-level routines? Discuss.









Ċ
Joseph Lai,
16 Aug 2015, 15:31
Comments