Unit 1 - Computational Thinking Flashcards

1
Q

What are errors?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are three types of errors

A

Syntax Error
Runtime Error
Logic Error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a syntax error?

A

This is a grammatical error in the code, it can be caused by things such as a missing bracket, colon or a misspelled word

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a runtime error?

A

This is something that stops the code whilst it is running or prevents it from running all together

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a broke error?

A

This occurs when a program is running and is asked to perform an impossible task such as multiplying something by zero

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a logic error?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where did the term ‘computer bug’ get its name?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a trace table?

A

A black table into which you can input the results of a program each time you run through it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why are trace tables helpful?

A

They allow us to predict the results of a programme and identify errors in it without actually running it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why are flowcharts helpful?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What pseudocode?

A

Pseudocode is a cross between a programming language such as python and English

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is pseudocode useful?

A

It can be understood by most people even if they do not understand coding so we can communicate complicated concepts effectively

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why do you need to be careful when using pseudocode?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why are search algorithms used?

A

They enable a program to identify a specific value in an array easily

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain how the binary search algorithm works

A
  1. The array must be sorted in ascending numerical order
  2. Identify the midpoint
  3. If Midpoint = Required Index, print
  4. If Midpoint > Required Index THEN End Of Array = Midpoint -1
  5. If Midpoint < Required Index THEN Start Of Array = Midpoint +1
  6. Go back to step two and LOOP until Required Index is identified
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

State one advantage and three disadvantages of the binary search search algorithm

A

Advantages:
1. Quicker for longer arrays and more efficient than a linear search
Disadvantages:
1. It is harder to program
2. It takes time to reorder it if an item is removed or added
3. It requires the array to be sorted

17
Q

Explain how the linear search algorithm works

A

The computer will iterate through each item in the array until it identified the required index

18
Q

State three advantages and two disadvantages of the linear search algorithm

A

Advantages:
1. Does not require items to be sorted therefore saves time
2. It is not affected by insertions or deletions
3. Works quicker on small lists, especially on today’s computers
Disadvantages:
1. Takes a long time on larger arrays
2. The item may be one of the last ones in the list

19
Q

Describe the bubble sort algorithm

A

Two items in an array are compared, if the first is larger than the second they are swapped so that they are in ascending numerical order; the program then iterates through the array multiple times in order to sort every number into the same order

20
Q

Describe the merge sort algorithm

A

The array is split into couplets, if those two numbers are not in ascending numerical order they are switched. They are then merged with another couplet and the same process repeats so that the whole array is combined again and in ascending numerical order

21
Q

What are operators?

A

Built in commands in python that allow us to perform specific function

22
Q

What are the three types of operator?

A

Logical, relation and arithmetic