PDF File

Latest C++ Institute CPA-21-02 Practice Questions BY Saunders

Question 1

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

#include

using namespace std;

void fun(int*);

int main()

{

int *x;

int i=2;

x=&i;

fun(x);

cout<

return 0;

}

void fun(int *i)

{

*i = *i * *i;

}

  • A. It prints: 2
  • B. It prints: 4
  • C. It prints: 0
  • D. It prints: 1
Question 2

Which code line instead of the comment below will cause the program to produce the expected output?

  • A. a = b * c;
  • B. return a = b * c;
  • C. return a = b * *c;
  • D. a = b * *c;