Unit 1 - Computational Thinking Flashcards
What are errors?
An error is something that disrupts the program or occurs unintentionally within it, it can also cause an unwanted outcome in the program even if it still runs
What are three types of errors
Syntax Error
Runtime Error
Logic Error
What is a syntax error?
This is a grammatical error in the code, it can be caused by things such as a missing bracket, colon or a misspelled word
What is a runtime error?
This is something that stops the code whilst it is running or prevents it from running all together
What is a broke error?
This occurs when a program is running and is asked to perform an impossible task such as multiplying something by zero
What is a logic error?
This occurs when there is a fault in the logic or structure of the program - it does not usually cause the program to stop completely but it can cause an unexpected result from the computer
Where did the term ‘computer bug’ get its name?
In 1947 a group of computer scientists noticed unexpected results coming from their machines, they found that it was due to a moth trapped inside of a one machine and they were forced to literally ‘debug’ the machines
What is a trace table?
A black table into which you can input the results of a program each time you run through it
Why are trace tables helpful?
They allow us to predict the results of a programme and identify errors in it without actually running it
Why are flowcharts helpful?
They allow programmers to see the distinct steps which need to be carried out in order to reach a desired outcome and layout the structure of the code
What pseudocode?
Pseudocode is a cross between a programming language such as python and English
Why is pseudocode useful?
It can be understood by most people even if they do not understand coding so we can communicate complicated concepts effectively
Why do you need to be careful when using pseudocode?
Everyone writes pseudocode differently but you need to ensure that your rules are consistent throughout .e.g. you cannot decide that all variables are written in capitals halfway through
Why are search algorithms used?
They enable a program to identify a specific value in an array easily
Explain how the binary search algorithm works
- The array must be sorted in ascending numerical order
- Identify the midpoint
- If Midpoint = Required Index, print
- If Midpoint > Required Index THEN End Of Array = Midpoint -1
- If Midpoint < Required Index THEN Start Of Array = Midpoint +1
- Go back to step two and LOOP until Required Index is identified