Paper 1 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

[PPQ] What is representational abstraction?

A

Removing unnecessary details until the problem is represented in a way that is possible to solve

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

[PPQ] What is abstraction by generalisation?

A

Grouping by common characteristics

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

For which type of graph would the bottom half of the matrix also need to be used?

A

Directed graph

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

What is a Turing machine?

A

A machine that reads a tape one square at a time. The tape encodes a problem that must be solved

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

Describe the basic operation of a Turing machine

A

The tape is divided into a number of cells, and is used as memory
Each cell contains a symbol (blank is denoted by a square)
Acceptable symbols are known as the alphabet
The read-write head can read the cell, write to it, or erase it
The machine enters the halting state when the entire input has been processed

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

How do you draw a Turing machine diagram?

A

Like an FSM but A,B,C on the arrows
A = current state
B = write
C = direction

So 0,1,R means if 0 is read, write 1 and move to the right

This can also be written as a table (current state, read symbol, write symbol, move, next state)

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

What is a transition function?

A

Another way of expressing state transitions

δ(current state, input symbol) = (next state, output symbol, movement)

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

What is a universal Turing machine?

A

A machine that reads the description M of a Turing machine and executes the same instructions that Turing machine would. M is written at the beginning of the tape, followed by D. Anything a Turing machine can compute, a real computer can compute, so it provides a definition of what is computable

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

What is decomposition?

A

Breaking a problem into a number of sub-problems

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

What is automation?

A

Models are put into action to solve problems

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

What is composition?

A

Combining procedures into compound procedures

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

Syntax for creating a new class in Python

A
class Tile:
    def \_\_init\_\_(self, status, position):
        ## insert code here. This is called whenever a new Tile is created
    def statusSwitch(self, newStatus):
        ## insert code here

Tile(0, 0) ## Creates a new file

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

Advantage of using constants

A

Makes program clearer and easier to understand

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

What is the definition of “algorithm”?

A

A sequence of steps that can be followed to

complete a task and that always terminates.

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

What is a tractable problem?

A

A problem solvable by a polynomial-time algorithm. Untractable problems can be solved, but take an unreasonable amount of time. Problems cannot change from being tractable to untractable

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

[PPQ] What approaches could be taken to “solve” an untractable problem?

A

Heuristics (an experienced-based educated guess) that provides an approximation of the solution
Relax some of the constraints on the solution

17
Q

[PPQ] What is a universal Turing machine?

A

A Turing machine that can simulate the behaviour of any other Turing machine, and perform the same operations on data that the original machine does

18
Q

Which Backus-Naur Form rules cannot be defined using a regular expression?

A

Ones which contain recursive self-references to the rule itself

19
Q

[PPQ] Explain why a linear-search has the order of time complexity O(n)

A

As the size of the list increases the time taken to search for an item increases at the same rate
A linear search checks each item in the list in turn until the target is found, so if there are n items in the list the worst case would be n comparisons

20
Q

[PPQ] Advantage of Reverse Polish Notation over infix notation

A

Easier for a computer to evaluate and does not require brackets

21
Q

Complexity of merge sort

A

O(nlog(n))

22
Q

Complexity of bubble sort

A

O(n^2)

23
Q

[PPQ] What is the difference between a static and a dynamic data structure?

A

Static data structures have storage size determined when the program is compiled, meaning they can waste memory if they’re not holding much data
Dynamic data structures require memory to store pointers to the next items. They do not store data in consecutive memory locations

24
Q

[PPQ] What is the halting problem?

A

Determining if a program will halt for a specific input, without running the program. No algorithm exists that can do this

25
Q

Name the components of a Turing machine

A

Read/write head, transition rules, tape, alphabet

26
Q

Why can a Universal Turing Machine be considered to be more powerful than any computer that you can purchase?

A

It has an infinite amount of tape

27
Q

Why are Turing machines important?

A

Turing machines provide a (general/formal) model of computation and provide a definition of what is computable.

28
Q

What is a regular language?

A

It can be represented with a regular expression and understood by an FSM

29
Q

Backus-Naur form

A

::= “A” | “B” | “C” …..
::= |
::= |

30
Q

What is procedural abstraction?

A

Abstracting away the actual values used in a computation, to get a procedure

31
Q

What is functional abstraction?

A

Taking a procedure and disregarding the particular computational method to get a function

32
Q

What is data abstraction?

A

The details of how data is stored are hidden, allowing new kinds of data objects to be constructed from previously defined types of data objects. For example, a stack could be implemented as an array and a pointer for top of stack

33
Q

What are the operations of a stack?

A

pop: Remove an item from the front
push: Add an item to the back
peek: Look at the first item without removing it
Check if stack is empty
Check if stack is full

34
Q

RegEx

A
* (0 or more repetitions)
\+ (1 or more repetitions)
? (0 or 1 repetitions, ie optional)
| (alternation, ie or)
( ) to group regular expressions.