Question 4
AQA Computer Science June 2022 Paper 1C (8525/1C)GCSE3 marks
On the specification
- 4.1
- 3.1 Fundamentals of algorithms
- 4.2
- 3.1 Fundamentals of algorithms
Question text
4 The two VB.Net programs in Figure 5 output the value that is equivalent to adding box together the integers between 1 and an integer entered by the user. For example, if the user entered the integer 5, both programs would output 15 Figure 5 Program A Console.Write("Enter a number: ") Dim num As Integer = Console.ReadLine() Dim total As Integer = 0 For i = 1 To num total = total + i Next Console.WriteLine(total) Program B Console.Write("Enter a number: ") Dim num1 As Integer num1 = Console.ReadLine() Dim num2 As Integer = num1 + 1 num2 = num1 * num2 num2 = num2 \ 2 Console.WriteLine(num2) 4.1 Shade one lozenge to indicate which of the statements is true about the programs in Figure 5. [1 mark] A Both programs are equally efficient. B Program A is more efficient than Program B. C Program B is more efficient than Program A. 4.2 Justify your answer for Question 04.1. [2 marks]