Question 11
AQA Computer Science June 2025 Paper 1B (8525/1B)GCSE14 marks
On the specification
- 11.1
- 3.2 Programming
- 11.2
- 3.2 Programming
- 11.3
- 3.2 Programming
- 11.4
- 3.2 Programming
- 11.5
- 3.2 Programming
Question text
11 A word game is being developed using Python. box A word is displayed as a series of asterisks (*) equal to the number of letters in the word. For example, the word apple would be displayed as ***** The player guesses one letter at a time. If the letter is in the word, the letter will replace the asterisk(s) wherever the letter occurs. For example, if the player enters p then the word apple will be displayed as Only lower-case letters are used in the word game. Figure 12 shows a subroutine used in the program for this word game. • Line numbers are included but are not part of the subroutine. Figure 12 1 def findLetter(word, letter, hidden): 2 newHidden = "" 3 for i in range(len(word)): 4 if word[i] == letter: 5 newHidden = newHidden + letter 6 else: 7 newHidden = newHidden + hidden[i] 8 return newHidden 11.1 The subroutine call findLetter("system", "s", "*y**em") is made. What is the value of the variable letter when line 4 is first executed? Shade one lozenge. [1 mark] A *y**em B s C sys**m D system 11.2 The subroutine call findLetter("system", "s", "*y**em")is made. box What is the value of the variable newHidden when line 6 is first executed? Shade one lozenge. [1 mark] A s B sys C sys**m D system 11.3 The subroutine call findLetter("system", "s", "*y**em") is made. Identify how many times the loop would iterate. Shade one lozenge. [1 mark] A 1 B 2 C 6 D 7 11.4 The subroutine call findLetter("system", "s", "*y**em") is made. What value is returned? Shade one lozenge. [1 mark] A s B sy*tem C sys*em D system 11.5 A Python program is being written to determine if a player wins or loses the word box game. • The player wins if they correctly guess all of the letters in the word within eight guesses or fewer. • The player loses if they have had eight guesses and there are still letters remaining that they have not guessed correctly. Figure 13 shows the beginning of the program. Figure 13 word = input() hidden = "" for i in range(len(word)): hidden = hidden + "*" Extend the program in Figure 13. Your program must: • keep repeating the following until the user has had eight guesses or there are no asterisks left in hidden o get the user to enter a letter o call the findLetter subroutine (from Figure 12) o update the value of hidden using the value returned from findLetter o display the new value of hidden • check if the new value of hidden contains any asterisks o if there are any asterisks in hidden display the message You lost o if there are no asterisks in hidden display the message You won The program you write must not use any built-in routines to check if a string contains another string/character or to count the number of asterisks. You should use indentation as appropriate, meaningful variable name(s) and Python syntax in your answer. The answer grid below contains vertical lines to help you indent your code accurately. [10 marks] word = input() hidden = "" for i in range(len(word)): hidden = hidden + "*"