Quiz 5
Quiz 5
A. 4
B. 7
C. 9
D. 16
A. -10
B. -2
C. 10
D. 2
6. Which of the following is a VALID function prototype for a C++ program that
receives an integer number and returns an integer number?
I. int f1 (int);
II. void f1 (int &);
III. void f1(int, int &);
A. I and II.
B. I and III
C. I only.
D. I, II and III
int number;
cin >> number;
if (functionX(number) == 1)
cout << “This is an odd number”;
else
cout << “This is an even number”;
Which of the following the most suitable function prototype for the
functionX()?
A. int functionX();
B. void functionX(float);
C. void functionX(int);
D. int functionX(int);
9. Which of the following is a valid function prototype for a C++ program that
receives two integer values and a float value and returns a float number for
function f3?
A. int f3 (int, int, float);
B. float f3 (int, int, float);
C. void f3 (int, int, float);
D. float f3 (int, int);
A. It is a grade C product.
B. It is a grade B product.
C. It is a grade A product.
D. No output
11. Given the following declaration:
int myArray [ 3 ] = { 4, 2, 7 };
A. banana
B. bananan
C. bananana
D. banananan
A. 3
B. 10
C. 11
D. 13
14. What is the correct statements for the following declaration of C++ program?
A. I and II
B. Ill and IV
C. II, III and IV
D. I, II, III and IV
15. Which of the following statements is TRUE about the number 10 used in the
program segments?
int list1[10]; //statement 1
temp[1] = temp[4];
temp[4] = temp[2];
temp[2] = temp[3] + temp[1];
A. 3 -1 8 4 5
B. -3 4 8 5 1
C. 3 4 8 -1 5
D. -3 5 8 3 1
A. 12
B. 11
C. 10
D. 9
18. Determine the output of the following program segment.
A. 6533
B. 6553
C. 6353
D. 6522
19. Which of the following statements declare a string called name that is able to hold
up to 19 characters?
A. char name;
B. char name = 20;
C. char name[20];
D. char[20] name;
A. i and ii
B. i and iii
C. ii and iii
D. All of the above