Name the three programming constructs.
Sequence, branching and iteration.
Which two categories of loop is iteration split up into?
- Condition-controlled
Describe how the branching programming construct works.
A certain block of code is run if specific condition is met, using IF statements.
What is recursion?
A programming construct in which a subroutine calls itself during its execution until the stopping condition is met.
What is the base case in recursion?
A condition that must be met in order for the recursion to end.
State two advantages of recursion.
- Easier to express some functions recursively than using iteration.
State a disadvantage of recursion.
Give two pieces of information that are stored on the call stack.
Two from:
Define scope
The section of the program in which a variable is accessible.
Give two advantages of using local variables over global variables.
Two from:
What is top-down design?
A technique used to modularise programs in which the problem is continually broken down into sub-problems, until each can be represented as an individual, self-contained module which performs a certain task.
State two advantages of a modular design.
Two from:
Give another name for top-down design.
Stepwise refinement
What is the difference between procedures and functions?
Functions must always return a single value while a procedure does not always have to return a value.
What does it mean to pass a parameter to a subroutine by reference?
The address in memory of the parameter is passed to the subroutine so it’s value outside of the subroutine will be updated.
State two features of IDEs
Two from:
What does IDE stand for?
Integrated Development Environment
What is encapsulation in object-oriented programming?
When attributes are declared as private so can only be accessed and edited by public methods.
Describe the purpose of encapsulation in object-oriented programming.
Program complexity is reduced by protecting data from being accidentally edited by other parts of the program.