Question 7
AQA Computer Science June 2022 Paper 1 (7517/1)A level6 marks
On the specification
- 7.1
- 3.1 Fundamentals of programming3.2 Fundamentals of data structures
- 7.2
- 4.2 Fundamentals of data structures
- 7.3
- 4.2 Fundamentals of data structures
- 7.4
- 4.2 Fundamentals of data structures
Question text
7 This question is about the CardCollection class. 7.1 Figure 9 shows a pseudo-code version of part of the Shuffle subroutine. Figure 10 shows an alternative, incorrect version of the same part of the Shuffle subroutine. Figure 9 TempCard Cards[RNo1] Cards[RNo1] Cards[RNo2] Cards[RNo2] TempCard Figure 10 Cards[RNo1] Cards[RNo2] Cards[RNo2] Cards[RNo1] Explain why the Shuffle subroutine would not work if it used the method shown in Figure 10 instead of the method shown in Figure 9. [1 mark] The CardCollection class uses a list to store the cards. 7.2 State one reason why a set could not have been used instead of a list. [1 mark] 7.3 A hash table could have been used instead of a list. Describe how a card would be added to a hash table. [3 marks] 7.4 A hash table can be used to implement a dictionary data structure. Explain why a hash table is a suitable choice. [1 mark]