Define the programming construct Sequence
All instructions are executed once in the order in which they appear.
Define the programming construct Iteration
A section of code loops or a group of statements/instructions are executed repeatedly for a set number of times or until a condition is met.
Define the programming construct Selection
A condition is used to determine which of the sections of code (if any) will be executed. As a result some instructions may not be executed.
What is Recursion?
When a function/procedure calls itself from within the function.
What are some features of a recursive function
List some advantages of using recursive function rather than an iterative function
List some disadvantages of using recursive function
Define a Global Variable
A variable that is usually declared and defined at the start of a program outside subprograms. Is visible and available everywhere throughout the whole program in all modules including functions and procedures.
Define a Local Variable
When is a Local Variable Destroyed?
When the subprogram is exited
When is a Global Variable Destroyed?
When the whole program ends
Explain what is meant by ‘Scope’ in relation to Global and Local Variables.
Disadvantages of Global Variables
What is an advantage of a local variable
The same variable names within two different modules will not interfere with one another to allow the same identifier to be used for different purposes without overwriting values or causing errors
What is Modularity
Explain the advantages of using a modular approach.
What is a function?
A piece of code that uses local variables to perform specific tasks or calculations; returning a single data type value
What is a procedure?
A piece of code that is given an identifier and performs a task using local variables but it does not necessarily have to return a value by parameter passing
Advantages of Subroutines
What is the main difference between a function and a procedure?
A procedure does not return a value /
A function has to return a value
Define the term Parameter
(A description of) an item of data that is passed to a subroutine and used as a variable within the
subroutine
What does it mean by passing a parameter by value?
What does it mean by passing a parameter by reference?
Explain Parameter Passing