Paper 2 - Incorrect Answers Flashcards

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

What is meant by problem recognition?

A

Identifying there is a problem to be solved and what the problem is.

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

What is a difference between a tree and a graph?

A

A graph has cycles.

A graph can be directed/undirected.

A graph can be weighted.

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

What are two advantages of visualisation?

A

Visualisations benefit humans rather than computers.

They present the information in a simpler form to understand.

They can best explain complex situations.

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

Describe how a 1D array can be set up and used to push and pop items as a stack. [4 marks]

A

The array size is defined.

A stack pointer is used to point to the top of the stack.

When an item is pushed to the stack, the pointer is incremented.

When an item is popped from the stack, the pointer is decremented.

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

How can a program be amended to make sure the items and queue still exist and are used the next time the program is run?

A

Store the items and queue to an external file.

Load the items and queue from the file when it starts

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

Describe what is meant by the term ‘linked list’ [3 marks]

A

A dynamic data structure where each node consists of data and a pointer. The pointer gives the location of the next node.

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

Explain why a linked list is being used for the ordering system. [2 marks]

A

Orders can be processed in the order they are in the queue.

A linked list is dynamic which allows orders to be added and deleted.

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

Why would a linear search be used over a binary search?

A

Items do not have to be in a specific order in a linear search. In a binary search they have to be in order.

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

Identify three features of an IDE that the programmer would use when writing the code and describe how the features benefit the programmer. [6 marks]

A

Auto Complete - Can view identifiers/avoid spelling mistakes.

Colour Coding - Identify features quickly.

Stepping - Run one line at a time and check result.

Breakpoints - Stop the code at a set point to check the value of variables.

Variable Watch - Check values of variables and how they change during execution.

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

Describe two advantages of splitting the problem into sub-procedures. [4 marks]

A

Procedures can be reused which saves time as there is no need to program them twice.

Speeds up completion time as multiple procedures worked on concurrently.

Easy to test and debug as each model can be tested on its own.

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

Explain the difference between a depth-first and a breadth-first traversal. [4 marks]

A

Depth first traversal goes to left child node when it can and if there is no left child it goes to the right. Where there are no child nodes, it backtracks to the parent node.

Breadth first traversal visits all nodes directly connected to the root node and then visits all nodes directly connected to those nodes.

Depth first uses a stack whereas breadth-first uses a queue.

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

Explain how backtracking is used. [3 marks]

A

When a node doesn’t have any node to visit, the algorithm goes back to the previous visited node to check for further nodes to visit.

This repeats until a new node can be visited or all nodes have been visited.

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

What three things should a recursive function contain?

A

A stopping condition (base case)

For any input value other than the stopping condition, the subroutine should call itself

The stopping condition should be reachable within a finite number of times

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

State the main features of a tree. [3 marks]

A

A data structure that consists of nodes that have children nodes. The first node is called the root node and the lines that join nodes are called branches.

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

Describe what is meant by caching and explain how it can be used within the simulation. [2 marks]

A

Data that has been stored in cache/RAM in case it is needed again. It allows faster access for future use.

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

Describe how a merge sort differs from a bubble sort. [4 marks]

A

Merge sort splits the data. It then sorts the split data as it is put back together.

Bubble sort moves through the data in a linear way and it moves through data repeatedly.

Merge sort is more efficient with larger volumes of data to sort but merge sort may require more memory space.

17
Q

Explain how a private attribute improves the integrity of data.

A

Properties can only be accessed through their methods.

So it cannot be changed accidentally.

18
Q

Identify two features of the problem that make it solvable by computational methods. [2 marks]

A

Involves calculations.

Has inputs, processes and outputs.

Involves logical reasoning.

19
Q

Explain parameter passing [5 marks]

A

Parameters can be passed by value or reference

By value is where a local copy of the data is used and then discarded so the value of the original data is unchanged

By reference is where the location of the data is used so changes may be made to the value of data

20
Q

Describe the use of local variables [4 marks]

A

Defined within one module and can only be accessed inside that module.

They can be used as parameters

Data is lost at the end of the module

It can overwrite global variables with the same name

21
Q

A programmer is developing an ordering system for a fast food restaurant. When a member of staff inputs an order, it is added to a linked list for completion by the chefs.

Explain why a linked list is being used for the ordering system [2 marks]

A

Orders can be processed in the order they are in the queue

The linked list is dynamic and therefore it allows orders to be added/removed

22
Q

What is the syntax for closing an external file in pseudocode?

A

file.close()

23
Q

Define the term parameter. [2 marks]

A

An item of data that is passed to a subroutine when it is called.

It is used as a variable within the subroutine.

24
Q

Explain the term procedural programming language. [2 marks]

A

High-level language that gives a series of instructions in a logical order.

25
Q

Describe the use of local variables. [4 marks]

A

Local variables are defined within one subroutine are are only accessible inside that subroutine.

They can overwrite global parameters of the same name and the same variable name can be used in other modules without causing errors.

They can be used as parameters.

26
Q

State two features of global variables that distinguish them from local variables. [2 marks]

A

They are defined at the start of the program.

They exist throughout the program.

Allows data to be shared by modules.

27
Q

Explain what is meant by ‘scope’ in relation to global and local variables. [2 marks]

A

A range of procedures that a variable is valid for.

A local variable takes precedence over a global variable of the same name.

28
Q

Describe what is meant by the term IDE (Integrated Development Environment) [2 marks]

A

A single program used for developing programs made from a number of components

29
Q

What are the drawbacks of caching?

A

The nature of predictive logic means caching algorithms can be very complicated to implement

The wrong data is often fetched and cached, and subsequently it has to be removed or flushed

Maintaining the correct sequence of instructions or data items in these circumstances can be problematic

30
Q

Describe how an insertion sort is performed [3 marks]

A

One item at a time is moved into its correct position until all items in the list are checked.

31
Q

What does a linear time complexity mean and how does this link to a bubble sort?

A

The time grows at the same rate as the number of items.

For a bubble sort, this is a best case when the list is already in order.

32
Q

What does a polynomial time complexity mean and how does this link to the bubble sort?

A

Polynomial means that the time taken is proportional to the square of the number of elements.

This occurs for the average and worst case for the bubble sort and the worst case is that the list is in reverse order.

33
Q

What does a constant space complexity mean and how does it link to a sorting algorithm?

A

The space required is independent of the number of data items.

It will always take the same amount of memory regardless of the numbers of items.

34
Q

Explain how a data item is removed from a linked list. [4 marks]

A

Traverse the list to the item immediately prior to the item to be deleted.

Find the pointer value of the item to be removed.

Set the pointer of the item prior to the item to be removed to the pointer of the data item to be removed.

35
Q

Explain how decomposition can aid the design of this program. [2 marks]

A

The problem can be split into smaller sub-problems.

This makes the problem more manageable and simple to maintain and each sub-problem can be tackled independently.

36
Q

In programming, what is pipelining?

A

The result from one procedure feeding into the next.

37
Q

Explain why an insertion sort might use less memory than a merge sort. [2 marks]

A

Merge sort creates a new array each time it splits and merges. It is usually also implemented recursively which places additional data onto the stack.

Insertion sort doesn’t use any additional arrays.

38
Q

Explain the need for abstraction in the production of this program. [3 marks]

A

It reduces the complexity of the design and programming.

It reduces processing requirements.