35Medium
0/3

Determine the output from the program in Figure 1 when the user enters the number 5.

Figure 1

1  n = int(input())
2  x = 2
3  y = 1
4  for i in range(1, n):
5      temp = x
6      x = 2 * x + 3 * y
7      y = temp
8  print(x)
[3]

Programming concepts Questions

Practise AQA GCSE Computer Science Programming concepts with exam-style questions for GCSE Computer Science. 100 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts