Free CPA Exam Braindumps (page: 17)

Page 16 of 56

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

#include <iostream>

using namespace std;

int main()
{
int x=2, *y;
y = &x;
cout << *y + x;
return 0;
}

  1. It prints: 1
  2. It prints: 2
  3. It prints: 4
  4. It prints: 0

Answer(s): C



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

#include <iostream>
using namespace std;

int main(){
int *i;
i = new int;
*i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4;
cout << *i;
return 0;
}

  1. It prints: 0
  2. It prints: 1
  3. It prints: 2
  4. It prints: 0.5

Answer(s): C



Which of the following statements are correct about an array?
int tab[10];

  1. The array can store 10 elements.
  2. The expression tab[1] designates the very first element in the array.
  3. The expression tab[9] designates the last element in the array.
  4. It is necessary to initialize the array at the time of declaration.

Answer(s): A,C



Which of the following is a logical operator?

  1. &
  2. &&
  3. ||
  4. !

Answer(s): B,C,D






Post your Comments and Discuss C++ Institute CPA exam with other Community members: