Question 7

AQA Computer Science June 2020 Paper 1GCSE6 marks

On the specification

7.1
3.1 Fundamentals of algorithms3.2 Programming
7.2
3.2 Programming
Question text

7.1 Four subroutines are shown in Figure 7. Figure 7 SUBROUTINE main(k) OUTPUT k WHILE k > 1 IF isEven(k) = True THEN k ← decrease(k) ELSE k ← increase(k) ENDIF OUTPUT k ENDWHILE ENDSUBROUTINE SUBROUTINE decrease(n) result ← n DIV 2 RETURN result ENDSUBROUTINE SUBROUTINE increase(n) result ← (3 * n) + 1 RETURN result ENDSUBROUTINE SUBROUTINE isEven(n) IF (n MOD 2) = 0 THEN RETURN True ELSE RETURN False ENDIF ENDSUBROUTINE Complete the table showing all of the outputs from the subroutine call main(3) The first output has already been written in the trace table. You may not need to use all rows of the table. [4 marks] Output 3 7.2 Describe how the developer has used the structured approach to programming in Figure 7. [2 marks]