Answer Q1(a) and Q1(b)(i)-Q1(b)(x) based on the information given in Figure Figure Q1 Write the output for the program i
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Answer Q1(a) and Q1(b)(i)-Q1(b)(x) based on the information given in Figure Figure Q1 Write the output for the program i
Write the output for the program in Figure Q1. (10 marks) Determine whether each of the following statements is TRUE or FALSE. (i) The callme1 () and callme3 () functions benefit from the use of recursive implementation. (2 marks) (ii) The callMe3 () function is a non-recursive implementation of callMe2 () function. (2 marks) (iii) Given a value n, both callme2(n) and callMe4(n) will return same result. (2 marks) (iv) Given x=5, both callme2 (x,3) and callme4 (5,n1−1) will return same result. (2 marks) (v) Given a value n, both callme2 (n) and callme4 (n) will return same result. (2 marks) (vi) Given a value n, both callmel (n,3) and callme 4(n,3) will return same result. (2 marks) (vii) The callme1 () and callme2 () subroutines demonstrate implementation of recursive functions. (2 marks) (viii) The callme1 () and callme2 () subroutines demonstrate implementation of recursive functions because both return a single value only. (2 marks) (ix) The callme3 () and callme4 () subroutines demonstrate implementation of non-recursive functions. (2 marks) (x) The callme3 () and callme4 () subroutines demonstrate implementation of non-recursive functions because both have valid parameters. (2 marks)