1.
(a)Write code to declare two 2-dimensional arrays of type float, each of size 16 × 13. The elements in the first array are equal to the square of the sum of their index variables, and the elements in the second array are three more than the positive differences between their index variables. (7 marks)
(b)Write the code to display the contents of each of the two arrays. (4 marks)
(c)Write the code to add the two arrays and store the result in another array and display its content. (4 marks)
2.
(a)Consider the following function:
int func1(int x, int y){
int flag = 1;
for(int j=1; j<abs(y); j++)
flag = flag*x;
return flag;
}
What is the output of the following C++ statements?
i. cout<<func1(3, 5)<<endl; (2 marks)
ii. cout<<func1(2, -3)<<endl; (2 marks)
What does the function func1 do? (2 marks)
(b)Mention four items a programmer needs to know when using a predefined function. (3 marks)
(c)Define the term function prototype and explain how it is used in C++ to avoid compilation error. (3 marks)
(d)State three ways in which a computer processes a program. (3 marks)
