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.
Describe how a merge sort differs from a bubble sort. [4 marks]
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.
Explain how a private attribute improves the integrity of data.
Properties can only be accessed through their methods.
So it cannot be changed accidentally.
Identify two features of the problem that make it solvable by computational methods. [2 marks]
Involves calculations.
Has inputs, processes and outputs.
Involves logical reasoning.
Explain parameter passing [5 marks]
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
Describe the use of local variables [4 marks]
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
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]
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
What is the syntax for closing an external file in pseudocode?
file.close()
Define the term parameter. [2 marks]
An item of data that is passed to a subroutine when it is called.
It is used as a variable within the subroutine.
Explain the term procedural programming language. [2 marks]
High-level language that gives a series of instructions in a logical order.