Please enable JavaScript.
Coggle requires JavaScript to display documents.
Comp Sci 2 - Final Exams - Coggle Diagram
Comp Sci 2 - Final Exams
2.1
2.1.1
Abstraction is the removal of less important information/complexities to focus on the more important details.
Decomposition is the process of breaking down larger, more complex problems into smaller, more manageable sub-problems.
Algorithmic thinking is the process of going through an algorithm in steps in hopes of achieving the desired outcome.
2.1.2
A syntax error is an error that that does not allow the program to run, it is caused by the programmer not following the rules of the programming language.
-
-
For a flowchart:
- Line = Line
- Parallelogram = Input/Output
- Rectangle = Process
- Rhombus = Decision
- 3 Rectangles = Sub-program
- Stadium = Terminal
2.1.3
A binary search works by picking 3 pointers (LB, UB and a MB). If the number being searches for is greater than the MB, the lower half of the list is removed and the new LB is the MB + 1. This continues until the number is found. List must be ordered.
A linear search works by checking the list element by element and comparing it to the value being searched for, this will continue until the end of the list is reached.
Bubble sorts compare items in pairs, rearranging the pairs is necessary, this will continue until a sorted list is achieved.
Merge sorts break down a list into smaller components and sort them by placing them back together. Insertion sorts divide a list into a sorted and unsorted list, inserting items into the sorted list in the correct place.
2.2
2.2.1
-
Constants are an identifier for a memory location that cannot change during the running of a program. Using constants can allow for values to be changed without having to alter every line containing the constant.
-
2.2.3
-
An array is, generally, a fixed/static structure that stores information of one data type.
-
Functions are sub-programs that return a value, procedures do not return a value.
2.3
2.3.1
Input validation techniques:
- Type check
- Format check
- Length check
- Range check
- Presence check
Iterative testing involves testing each new module as it is written. Program branches are checked for functionality and it is ensured that they do not introduce new errors.
Terminal testing tests to see if all modules work together and that they meet the given requirements with real data.
A syntax error will occur when the rules of the programming language are broken. The program will not run if these errors exist. A logic error occurs when an unexpected output is given.
Data of the incorrect type is referred to as erroneous. Data that should be accepted but is outside of the validation boundary is known as invalid data. Data that should be accepted by the program is known as normal data and data that lies on the program's boundary are known as boundary data.
2.5
2.5.1
-
Assembly language is specific to one type of processor, is hard to write and understand, is memory efficient and code is fast to execute.
Source code is written in high-level programming languages. These languages use commands that are like English.
Compiler (object then machine code, creates executable file):
- +:
- Do not need translation software at runtime.
- Speed of execution is faster.
- Code is often optimised.
- Original source code is kept hidden.
- -:
- Will not run with syntax errors.
- Code needs to be recompiled before being run.
- Designed for a specific type of processor.
Interpreter:
- +:
- Easy to write source code as the program will always run with syntax errors.
- Does not need to be recompiled.
- -:
- Translation software is required at runtime.
- Slower execution speeds.
- Not optimised.
- Source code is needed.
2.5.2
Features of IDEs:
- Breakpoints.
- Stepping.
- Tracing variables.
- Error highlighting.
- Auto-complete.
- Runtime environment.
- Find and replace.
- Commenting.
- Indentation.