2.1.1 Flashcards
Define the term abstraction
Abstraction is the process of separating ideas from particular instances. It is a means of hiding detail. It is a representation of reality using symbols to show real life features.
Why is abstraction needed
Reduces processing requirements
Simplifies programming
Reduces memory requirements
Reusable components
Components that have already been written debugged and tested. They can be transplanted into new systems to save development time
Name the three programming constructs
Sequence, branching and iteration
Which two categories of loop is iteration split up into
- Count-controlled
- Condition-controlled
Describe how the branching programming construct works
A certain block of code is run if a 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
Can be represented in fewer lines of code
Easier to express some functions recursively than using iteration
State a disadvantage of recursion
Inefficient use of memory
Danger of stack overflow
Difficult to trace
Give two pieces of information that are stored on the call stack
Parameters
Return addresses
Local variables
Define scope
The section of the program in which a variable is accessible
Give advantages of using local variables over global variables
Less memory is used
Self-contained so unaffected by code outside the subroutine
Take precedence over global variables with the same name
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 represented as an individual, self-contained module which performs a certain task
State two advantages of modular design
Makes a problem easier to understand and approach
Simpler to divide tasks between a team
Easier to manage project
Self-contained modules simplify testing and maintenance
Greater reusability