2.1 Flashcards

1
Q

name the principles of computational thinking.

A
  • abstraction
  • decomposition
  • algorithmic thinking
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is abstraction?

A
  • the process of removing unnecessary details and including only the relevant details.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is decomposition?

A

The process by which a complex problem or system is broken down into parts that are easier to conceive, understand, program and maintain.

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

what is algorithmic thinking?

A

A way of getting to a solution by identifying the steps needed.

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

state an example of abstraction.

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

state an example of decomposition.

A

the steps taken in crossing a road

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

state an example of algorithmic thinking.

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

define problem inputs.

A

Any information or data which goes into a system

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

define problem processes.

A

Anything which happens to data during a system running e.g. performing calculations

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

define problem outputs.

A

Any information of data which leaves a system

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

why do we use trace tables?

A

We use trace tables to test algorithms, in order to make sure that no logical errors occur while the program is being processed, the table usually makes sure that no logical errors occur whilst the algorithm is being processed. The table usually has one column for each variable. Each row of the table shows how the various values held in variables change as the algorithm is running.

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

write a step by step guide on how to create a trace table.

A
  • take each line at a time and write out in a trace table the constant state of each variable.
  • note down any output the program produces.
  • each variable present in the program should have its own column in the trace table
  • a new row should be added under any column if the state of a variable changes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what are the three different types of errors?

A
  • syntax
  • logic
  • run time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

define syntax error.

A

Errors that break the grammatical rules of the programming language and stop it from being run.

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

define logic error.

A

Errors which produce unexpected output, but on their own, they won’t stop the program from running.

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

define runtime error.

A

A runtime error in a program is an error which occurs while the program is running after being successfully compiled.

17
Q

what is an example of a syntax error and how would you fix it?

A
  • missing indentation
  • add indentation
18
Q

what is an example of a logic error and how would you fix it?

A
  • using the same variable name more than once
  • using varied names to indicate different variables
19
Q

what is an example of a runtime error and how would you fix it?

A
  • a list out of range
  • correctly identify and fix it
20
Q

describe the flowchart symbols for the following:
- line
- process
- subprogram
- input/output
- decision
- terminal

A
  • arrow pointing right
  • rectangle
  • rectangle with lines as borders on the edges
  • parallelogram
  • rhombus
  • rectangle with curved corners
21
Q

how does binary search work?

A
  • calculate a mid-point in the data set.
  • check if that is the item to be found.
  • If not…
    -If the item to be found is lower than the mid-point, repeat on the left half of the data set.
    - If the item to be found is greater than the mid-point, repeat on the right half of the data set.
  • Repeat until the item is found or there are no items left to check.
22
Q

how does binary search require the data set to be?

A
  • in order of a key field
23
Q

which is faster- binary search or linear search?

A
  • binary search
24
Q

what are the main steps of writing the algorithm for binary search?

A
  • initialise starting states for variables, flags and pointers
  • enter a while loop
  • set the midpoint
  • check if we have found our item
  • if we haven’t, then check to see if the item we are looking for is greater than out midpoint item
  • if it is, then increment the left pointer
  • if its not, then decrement the right pointer
25
Q

how does linear search work?

A

Starting from the beginning of a data set, each item is checked in turn to see if it is the one being searched for.

26
Q

how does linear search require the data set to be?

A
  • doesn’t need it to be in order
  • will work on any type of storage device
27
Q

is linear search efficient for smaller or larger data sets?

A
  • can be efficient for smaller data sets
  • is very inefficient for large data sets
28
Q

what is an example of using linear search in everyday life?

A
  • looking for your favourite breakfast cereal on the shelves at a supermarket
29
Q

what are the main steps of writing the algorithm for linear search?

A
  • initialise starting states for variables and flags
  • enter a while loop until we find the item we are after or we reach the end of the data set
  • check to see if the item we are currently at is the one we are after
  • if it is then set our ‘found’ flag to true and output the item
  • if its not increment i
  • repeat the process
30
Q
A