What happens when you attempt to compile and run the following code?
#include
using namespace std;
class A {
public:
void Print(){ cout<<"A";}
};
class B:public A {
public:
virtual void Print(){ cout<< "B";}
};
class C:public B {
public:
void Print(){ cout<< "C";}
};
int main()
{
A ob1;
B ob2;
C ob3;
B *obj;
obj = andob2;
obj?>Print();
obj = andob3;
obj?>Print();
}
A. It prints: BBWhat will happen when you attempt to compile and run the following code?
#include
using namespace std;
int getValue();
int main()
{
const int x = getValue();
cout< return 0; } int getValue() { return 5; }
B. The code will not compile.
C. It will print 5
D. It will print garbage value
What is the output of the program given below?
#include
using namespace std;
int main (int argc, const char * argv[])
{
float f=?10.501;
cout<<(int)f;
}
B. 11What is the output of the program?
#include
#include
using namespace std;
class First
{
string name;
public:
First() {
name = "Alan";
}
void setName(string n) {this?>name = n;}
void setName() {this?>name = "John";}
void Print(){
cout << name;
}
};
int main()
{
First ob1,*ob2;
ob2 = new First();
First *t;
t = andob1;
t?>setName();
t?>Print();
t = ob2;
t?>setName("Steve");
ob2?>Print();
}
A. It prints: JohnSteveWhich of the following statements are true? (Choose two.)
A. Class A's friend's friend is also a friend of class AWhat happens when you attempt to compile and run the following code? #include
#include
using namespace std;
class A {
public:
int x;
};
class B : public A {
public:
B() { x=1;}
B(int x) {this?>x = x;}
};
int main () {
B c1;
B c2(10);
cout << c1.x;
cout << c2.x;
return 0;
}
A. It prints: 010What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class A {
public:
A() { cout << "A0 ";}
A(string s) { cout << "A1";}
};
class B : public A {
public:
B() { cout << "B0 ";}
B(string s) { cout << "B1 ";}
};
class C : private B {
public:
C() { cout << "C0 ";}
C(string s) { cout << "C1 ";}
};
int main () {
B b1;
C c1;
return 0;
}
A. It prints: A0 B0 A0 B1 A0 C0 A0 C1Which code line inserted instead of the comment below will cause the program to produce the expected output?

What happens when you attempt to compile and run the following code?
#include
using namespace std;
class A {
public :
void print() {
cout << "A ";
}
};
class B {
void print() {
cout << "B ";
}
};
int main() {
B sc[2];
A *bc = (A*)sc;
for (int i=0; i<2;i++)
(bc++)->print();
return 0;
}
A. It prints: A AWhat happens when you attempt to compile and run the following code?

Nowadays, 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.