Home/c institute/Free C++ Institute CPA-21-02 Actual Exam Questions

Free C++ Institute CPA-21-02 Actual Exam Questions

The questions for this exam were last updated on January 7, 2026

Dumps Box (DumpsBox) offers up-to-date practice exam questions for CPA-21-02 certification exam which are developed and validated by C++ Institute subject domain experts certified in C++ Institute CPA-21-02 . These practice questions are update regularly as we keep an eye on any recent changes in CPA-21-02 syllabus, and when there is update our team quickly adjusts the questions. This commitment to providing the best quality exam prep material to certification aspirants is what makes DumpsBox.com the best certification exam prep website. On top of that, our strong, yet strictly moderated, community based feedback keeps the content clean and current. Each question has helpful community discussion that provides it extra perspective and introduces helpful resources for better exam preparation. This also saves students from other outdated practice questions or illicit exam dumps that can have adverse affects on career. Browse through our C++ Institute CPA-21-02 exam questions and pass your exam on first try.

Question No. 1
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main(){
int i, j;
for(i = 0, j = 1; j < 2, i < 4; i++, j++);
cout << i << " " << j;
return 0;
}
Select one option, then reveal solution.
Question No. 2
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int f(int i, int b);
int main()
{
int i=0;
i++;
for (i=0; i<=2; i++)
{
cout<}
return 0;
}
int f(int a, int b)
{
return a+b;
}
Select one option, then reveal solution.
Question No. 3
Which of the following statements are correct about an array?
int tab[10];
Select all that apply, then reveal solution.
Question No. 4
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class myClass : public exception
{
virtual const char* what() const throw()
{
return "My exception.";
}
} obj;
int main () {
try
{
throw obj;
}
catch (exception& e)
{
cout << e.what() << endl;
}
return 0;
}
Select one option, then reveal solution.
Question No. 5
What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input?
#include
#include
using namespace std;
void f();
int main()
{
f();
return 0;
}
void f()
{
char c;
c = cin.get();
cout << c;
if(c != '\n')
f();
}
Select one option, then reveal solution.
Question No. 6
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class complex{
double re;
double im;
public:
complex() : re(0),im(0) {}
complex(double x) { re=x,im=x;};
complex(double x,double y) { re=x,im=y;}
void print() { cout << re << " " << im;}
};
int main(){
complex c1;
double i=2;
c1 = i;
c1.print();
return 0;
}
Select one option, then reveal solution.
Question No. 7
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main(){
int i = 1;
for(i=10; i>-1; i/=2) {
if(!i)
break;
}
cout << i;
return 0;
}
Select one option, then reveal solution.
Question No. 8
What is the output of the program?
#include
#include
using namespace std;
int main()
{
char str[] = "Hello\0\World\0";
cout << str;
return 0;
}
Select one option, then reveal solution.
Question No. 9
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int x=5;
static int y;
int i=0;
void static myFunction()
{
y=x++ + ++i;
}
int main (int argc, const char * argv[])
{
x++;
myFunction();
cout<}
Select one option, then reveal solution.
Question No. 10
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class A {
public:
string s;
A(string s) { this?>s = s; }
};
class B {
public:
string s;
B (A a) { this?>s = a.s; }
void print() { cout<};
int main()
{
A a("Hello world");
B b=a;
b.print();
}
Select one option, then reveal solution.
Question No. 11
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class A {
int x;
protected:
int y;
public:
int z;
A() { x=1; y=2; z=3; }
};
class B : public A {
string z;
public:
void set() {
y = 4;
z = "John";
}
void Print() {
cout << y << z;
}
};
int main () {
B b;
b.set();
b.Print();
return 0;
}
Select one option, then reveal solution.
Question No. 12
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int fun(int x) {
return 2*x;
}
int main(){
int i;
i = fun(1) & fun(0);
cout << i;
return 0;
}
Select one option, then reveal solution.
Question No. 13
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int x=2, *y;
y = &x;
cout << *y + x;
return 0;
}
Select one option, then reveal solution.
Question No. 14
What happens when you attempt to compile and run the following code?
#include
using namespace std;
void fun(int &i);
int main()
{
int i=2;
fun(i);
cout<return 0;
}
void fun(int &i)
{
i+=2;
}
Select one option, then reveal solution.
Question No. 15
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int op(int x, int y);
int main()
{
float *pf;
float f=0.9;
pf=&f;
cout << op(1, *pf);
return 0;
}
int op(int x, int y)
{
return x*y;
}
Select one option, then reveal solution.