Free CPA-21-02 Exam Braindumps (page: 4)

Page 4 of 65

Which statement should be added in the following program to make work it correctly?

using namespace std;
int main (int argc, const char * argv[])
{
cout<<"Hello";
}

  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include <iostream>
  4. #include<conio.h>

Answer(s): C



What is the output of the program?

#include <iostream>

using namespace std;

int main()
{
int tab[4]={10,20,30,40};
tab[1]=10;
int *p;
p=&tab[0];

cout<<*p;
return 0;
}

  1. It prints: 10
  2. It prints: 20
  3. It prints: 11
  4. It prints: 30

Answer(s): A



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

#include <iostream>
using namespace std;

int fun(int x) {
return 2*x;
}

int main(){
int i;
i = fun(1) & fun(0);
cout << i;
return 0;
}

  1. It prints: 0
  2. It prints: 1
  3. It prints: -1
  4. Compilation error

Answer(s): A



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

#include <iostream>
using namespace std;

class A {
public:
virtual void Print()=0;
};
class B:public A {
public:

virtual void Print() { cout<< "B"; }
};
class C:public A {
public:
virtual void Print() { cout<< "C"; }
};
int main()
{
B ob2;
C ob3;
A *obj;
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}

  1. It prints: BC
  2. It prints: CB
  3. It prints: CC
  4. It prints: BB

Answer(s): A



Page 4 of 65



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

Subash commented on October 21, 2024
I am planning to take this exam. Are these 257 questions enough to clear it? Also, does each section have a passing percentage, or is it based on the overall ?
INDIA
upvote