Question 7
AQA Computer Science June 2019 Paper 1GCSE8 marks
On the specification
- 7.1
- 3.2 Programming
- 7.2
- 3.2 Programming
- 7.3
- 3.2 Programming
- 7.4
- 3.2 Programming
- 7.5
- 3.2 Programming
Question text
7 A developer creates the algorithm shown in Figure 8 to provide support for users box of a new brand of computer monitor (display). • Line numbers are included but are not part of the algorithm. Figure 8 1 OUTPUT ꞌCan you turn it on?ꞌ 2 ans ← USERINPUT 3 IF ans = ꞌnoꞌ THEN 4 OUTPUT ꞌIs it plugged in?ꞌ 5 ans ← USERINPUT 6 IF ans = ꞌyesꞌ THEN 7 OUTPUT ꞌContact supplierꞌ 8 ELSE 9 OUTPUT ꞌPlug it in and start againꞌ 10 ENDIF 11 ELSE 12 OUTPUT ꞌIs it connected to the computer?ꞌ 13 ans ← USERINPUT 14 IF ans = ꞌyesꞌ THEN 15 OUTPUT ꞌContact supplierꞌ 16 ELSE 17 OUTPUT ꞌConnect it to the computerꞌ 18 ENDIF 19 ENDIF 7.1 Shade one lozenge to show which programming technique is used on line 3 of the algorithm in Figure 8. [1 mark] A Assignment B Iteration C Selection 7.2 Shade one lozenge to show the data type of the variable ans in the algorithm in Figure 8. [1 mark] A Date B Integer C Real D String 7.3 Regardless of what the user inputs, the same number of OUTPUT instructions will box always execute in the algorithm shown in Figure 8. State how many OUTPUT instructions will execute whenever the algorithm is run. [1 mark] 7.4 The phrase ꞌContact supplierꞌ appears twice in the algorithm in Figure 8. State the two possible sequences of user input that would result in ꞌContact supplierꞌ being output. [2 marks] Sequence 1: Sequence 2: 7.5 Another developer looks at the algorithm shown in Figure 8 and makes the following statement. “At the moment if the user enters ‘y’ or ‘n’ they will sometimes get unexpected results. This problem could have been avoided.” Explain why this problem has occurred and describe what would happen if a user entered ‘y’ or ‘n’ instead of ‘yes’ or ‘no’. You may include references to line numbers in the algorithm where appropriate. You do not need to include any additional code in your answer. [3 marks]