What happens when you attempt to compile and run the following code?
#include
using namespace std;
class First
{
public:
virtual void Print(){ cout<<"from First";}
};
class Second:public First
{
public:
void Print(){ cout<< "from Second";}
};
void fun(First *obj);
int main()
{
First FirstObject;
fun(andFirstObject);
Second SecondObject;
fun(andSecondObject);
}
void fun(First *obj)
{
obj?>Print();
}
A. It prints: from FirstWhich definitions are correct?
A. int age;What happens when you attempt to compile and run the following code?
#include
using namespace std;
class First
{
public:
First() { cout << "Constructor";}
~First() { cout << "Destructor";}
void Print(){ cout<<"from First";}
};
int main()
{
First FirstObject;
FirstObject.Print();
}
A. It prints: Constructorfrom FirstWhat happens when you attempt to compile and run the following code?
#include
using namespace std;
class A
{
public:
virtual void Print()=0;
};
class B:public A
{
public:
virtual void Print(){ cout<< "B";}
};
int main()
{
B ob2;
A *obj;
obj = andob2;
obj?>Print();
}
A. It prints: BWhat is the output of the program if character "1" is supplied as input?
#include
using namespace std;
int main () {
int c;
cin >> c;
try
{
switch (c)
{
case 1:
throw 20;
case 2:
throw 5.2f;
case 3:
throw 'a';
}
}
catch (int e)
{ cout << "int exception. Exception Nr. " << e; }
catch (float e)
{ cout << "float exception. Exception Nr. " << e; }
catch (...)
{ cout << "An exception occurred."; }
return 0; }
A. It prints: float exception. Exception Nr. 5.2What is the output of the program?
#include
#include
using namespace std;
union t
{
char c;
int i;
};
class First
{
union t u;
public:
First() {
u.c
= 'A';
}
void Print(){
cout << u.c;
}
};
int main()
{
First *t = new First();
t?>Print();
}
A. Garbage valueWhat 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;
};
class B : private A {
string name;
public:
void set() {
x = 1;
}
void Print() {
cout << x;
}
};
int main () {
B b;
b.set();
b.Print();
return 0;
}
A. It prints: 123Which code line inserted instead of the comment below will fix the program so that it produces the expected output and does not cause any memory leak?

Which code, inserted at line 14, generates the output "3.14 10"?
#include
using namespace std;
namespace myNamespace1
int x = 5;
int y = 10;
} namespace myNamespace2 { float x = 3.14; float y = 1.5; } int main () { //insert code here cout << x << " " << y; return 0; }
A. using myNamespace2::y; using myNamespace1::x;How many times will "HELLO" be printed?
#include
using namespace std;
int main()
{
for(int i=?1; i<=10; i++)
{
if(i < 5)
continue;
else
break;
cout<<"HELLO";
}
return 0;
}
A. 1Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only C++ Institute exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your CPA-21-02 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.