ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions

N5 Computing Science 2021 Question 11

12 marks · Development process and analysis

Complete the table below by identifying three processes from the above description of the game. Input(s) User enters the word Process(es) Output(s) Play matching sound file through speaker. Display whether or not the user spelled the word correctly. Display the total number of correctly spelled words. The spelling game stores 20 words. State the data structure and data type that will be required to store the 20 words. Data structure Data type State where in the computer system the 20 words will be stored while the program is running. State the part of the processor that will compare the selected stored word with the user’s input. Part of the program code is shown below. … Line 27 REPEAT 20 TIMES Line 28 SET choice TO <a number between 0 to 19> Line 29 <load selected sound file> Line 30 SEND <sound file> TO <speaker> Line 31 RECEIVE usersWord FROM KEYBOARD Line 32 IF usersWord = NOT(storedWords[choice]) THEN Line 33 SEND "Sorry, the correct spelling is " & storedWords[choice] TO DISPLAY Line 34 ELSE Line 35 SEND "Well Done" to DISPLAY Line 36 SET correctGuesses TO correctGuesses + 1 Line 37 END IF Line 38 END REPEAT Line 39 SEND "You guessed " & correctGuesses & " words correctly" TO DISPLAY Identify the logical operator used in the above code. Using a programming language of your choice, re‑write Line 28 to show how the value stored in the variable choice would be generated. Your answer should use a function. When the above code was tested several times, it was found that the user was not asked to spell all 20 of the stored words. Explain why the program did not ask the user to spell every stored word. The first stored word is Animal State the number of bits required to store this word using extended ASCII. A spelling game stores 20 words. Each word has an accompanying sound file where an actor’s voice speaks the word. When the game is running the program repeats the following 20 times. • Selects one of the 20 words • Loads a sound file matching the selected word • Plays the sound file through a speaker • Asks the user to type in the word • Compares the user’s entry to the stored word • Informs the user if they have spelled the word correctly When the game is over the program displays the total number of words that have been spelled correctly by the user.

Marking scheme

Any three from • select a stored word • compare stored word to users input • increment the total if user is correct. • locates matching sound file • loads matching sound file One mark each for • Data structure - array • Data type - string One mark for either • RAM • Register Arithmetic Logic Unit ALU NOT One mark each for • random function • correct values created (0 to 19) The same word could be randomly selected more than once It is unlikely that the 20 random numbers generated will generate each of the 20 values once. 48 (bits) Accept 6*8

Previous question: N5 Computing Science 2021 Question 10

Next question: N5 Computing Science 2021 Question 12