Question 7
OCR Computer Science November 2021 Computer systems (H446-01)A level24 marks
On the specification
- (a)(i)
- 1.4 Data types, data structures and algorithms
- (a)(ii)
- 1.4 Data types, data structures and algorithms2.3 Algorithms
- (b)(i)
- 1.4 Data types, data structures and algorithms2.3 Algorithms
- (b)(ii)
- 1.4 Data types, data structures and algorithms2.3 Algorithms
- (b)(iii)
- 2.3 Algorithms1.4 Data types, data structures and algorithms
- (b)(iv)
- 1.4 Data types, data structures and algorithms2.3 Algorithms
- (c)(i)
- 2.2 Problem solving and programming
- (c)(ii)
- 2.2 Problem solving and programming
Question text
7 A business uses an array with the identifier wNames to store workers’ names. A variable with the identifier top is used to store the index of the last element to be added to the array, which is also the element which will next be removed. wNames 1 2 3 4 5 6 Kirstie Martyn Louise Alex Anna top 4 (a) (i) State the name of the type of data structure described above. [1] (ii) Using pseudocode, write an algorithm that allows the user to enter a name which is then pushed onto the data structure above, checking first that the data structure is not full. [4] (b) The same workers’ names are stored in a binary search tree which is ordered alphabetically. Kirstie is set as the root node, with Martyn, Louise, Alex and Anna added one by one. Kirstie (i) Complete the tree diagram above to show where Martyn, Louise, Alex and Anna would be added to this binary search tree. [4] (ii) Describe the process of using the binary search tree above to search for the name “Zoe”. [3] (iii) Compare the efficiency of a binary search tree to a linked list when searching for data. [2] (iv) Compare the efficiency of a binary search tree to a hash table when searching for data. [2] (c) An object oriented system is implemented to organise further information about each worker’s attendance. Classes, objects, methods and attributes are used in this system. (i) State the meaning of each of the following terms: Object Method Attribute [3] Each worker has a name and an attendance figure which can be between 0 and 100. (ii) Write a definition for a fully encapsulated customer class, providing both get and set methods for all attributes. You do not have to write code for the constructor method. [5]