CPA C++ Certified Associate Programmer

Loading demo links...

Showing 7–9 of 15 questions

Question 7 (Volume A)

Which of the following statements are correct about an array?

int tab[10];

Select all that apply, then click Submit answer.

  • The array can store 10 elements.

  • The expression tab[1] designates the very first element in the array.

  • The expression tab[9] designates the last element in the array.

  • It is necessary to initialize the array at the time of declaration.

Question 8 (Volume A)

What happens when you attempt to compile and run the following code?

#include

using namespace std;

int main() {

float i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4 / 2;

cout << i;

return 0;

}

Select an option, then click Submit answer.

  • It prints: 0

  • It prints: 1

  • It prints: 2

  • It prints: 0.5

Question 9 (Volume B)

If there is one, point out an error in the program

#include

using namespace std;

int main()

{

int i=1;

for(;;)

{

cout<<>

if(i>5)

break;

}

return 0;

}

Select an option, then click Submit answer.

  • Error in “if” statement

  • Error in “for” loop

  • No error

  • Error in break statement