Paper 2 - Incorrect Answers Flashcards
What is meant by problem recognition?
Identifying there is a problem to be solved and what the problem is.
What is a difference between a tree and a graph?
A graph has cycles.
A graph can be directed/undirected.
A graph can be weighted.
What are two advantages of visualisation?
Visualisations benefit humans rather than computers.
They present the information in a simpler form to understand.
They can best explain complex situations.
Describe how a 1D array can be set up and used to push and pop items as a stack. [4 marks]
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 can a program be amended to make sure the items and queue still exist and are used the next time the program is run?
Store the items and queue to an external file.
Load the items and queue from the file when it starts
Describe what is meant by the term ‘linked list’ [3 marks]
A dynamic data structure where each node consists of data and a pointer. The pointer gives the location of the next node.
Explain why a linked list is being used for the ordering system. [2 marks]
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.
Why would a linear search be used over a binary search?
Items do not have to be in a specific order in a linear search. In a binary search they have to be in order.
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]
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.
Describe two advantages of splitting the problem into sub-procedures. [4 marks]
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.
Explain the difference between a depth-first and a breadth-first traversal. [4 marks]
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.
Explain how backtracking is used. [3 marks]
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.
What three things should a recursive function contain?
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
State the main features of a tree. [3 marks]
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.
Describe what is meant by caching and explain how it can be used within the simulation. [2 marks]
Data that has been stored in cache/RAM in case it is needed again. It allows faster access for future use.