Algorithm design and problem solving (paper2) Flashcards
What are the 4 stages of the program development life cycle?
-Analysis
-Design
-Coding
-Testing
What is the analysis stage?
Abstraction, decomposition of the problem, identification of the problem and the requirements
What is the design stage?
Decomposition, structure diagrams, flowcharts, pseudocode
What is the coding stage?
Writing the program code and iterative testing
What is the testing stage?
Testing the program code with the use of test data
What is abstraction?
Abstraction involves identifying the key parts of the problem and removing any unnecessary detail so it becomes easier to solve
What is decomposition?
Decomposition means breaking down a complex problem into smaller, manageable parts which are easier to solve
What are the 3 types of error?
-Syntax error
-Logic error
-Runtime error
What is a syntax error?
An error caused by a spelling or grammar mistake
What is a logic error?
An error where the program still runs but the output may be incorrect for example a > symbol rather than a < symbol
What is a runtime error?
An error that is detected whilst the program is still running. A division by zero will cause a runtime error
What are the steps involved in decomposition?
-Identifying the main problem
-Identifying the component parts of inputs, processes outputs and storage
-List the main sub-problems, sub-systems, functions or tasks
-Break these down into similar smaller sub-problems or sub-tasks which can then be completed separately
What can be used to show the structure of a problem in the program development life cycle?
Structure diagrams
What symbol represents a flow line in a flowchart? (Draw it)
An arrow
What symbol represents a decision in a flowchart? (Draw it)
Diamond
What symbol represents an input/output in a flowchart? (Draw it)
Paralleogram
What symbol represents a subroutine in a flowchart? (Draw it)
Square with 2 lines
What symbol represents a process in a flowchart? (Draw it)
Square
What symbol represents a terminator in a flowchart? (Draw it)
Square with rounded sides
How does a linear search work?
Each item will be checked one by one in the list until the item is found - if the item isn’t there then the list will be searched without success
Write pseudocode for a linear search
How does a bubble sort work?
A bubble sort works by repeatedly going through the list to be sorted, swapping adjacent elements if they are in the wrong order
Write pseudocode for a bubble sort
What are the types of validation checks?
-Range check
-Length check
-Type check
-Presence check
-Format check
-Check digit check
What is a range check?
Data must lie within a given range
What is a length check?
A string input must be greater than or equal to a minimum length
What is a type check?
Data must be of the correct data type
What is a presence check?
A string must not be empty
What is a format check?
A postcode must conform to one of a number of set formats
What is a check digit check?
-A check digit is an additional digit at the end of a product code
-It is designed to check that a valid product code has been entered
What is a double entry verification?
-The input of data twice
-The 2 entries are compared and if they match the entry is accepted as valid
-Setting a password uses this verification
What are the types of test data?
-Normal (typical) data
-Extreme data
-Boundary data
-Abnormal or erroneous data
What is normal data?
Using examples of typical data that the program is designed to handle
What is extreme data?
Largest and smallest acceptable value
What is boundary data?
Includes both ends of the allowed range as well as invalid data that should not be allowed, just outside the range
E.G if the range is 0-50 then the boundary data would be -1, 0, 50, 51
What is abnormal/erroneous data?
Data of the wrong type
E.G. Non numerical characters is a numeric field