Which code, inserted at line 15, generates the output "5 Bob"?
#include
using namespace std;
class B;
class A {
int age;
public:
A () { age=5; };
friend void Print(A andob, B andso);
};
class B {
string name;
public:
B () { name="Bob"; };
//insert code here
};
void Print(A andob, B andso) {
cout< } int main () { A a; B b; Print(a,b); return 0; }
B. friend void Print(A andob, B andso);
C. friend void Print(A *ob, B *so);
D. None of these
What happens when you attempt to compile and run the following code? #include
using namespace std;
int main()
{
int a=5;
cout << ((a < 5) ? 9.9 : 9);
}
A. It prints: 9Which of the following statements may completely ignore their bodies (inner statements)? (Choose three.)
A. doWhat is the expected output of the following program?

What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(void)
{
string s;
s = "Test";
s.resize (s.size() ? 1);
cout<
return 0;
}
A. It prints: Test 4What is the output of the program?
#include
#include
using namespace std;
struct Person {
int age;
};
class First
{
Person *person;
public:
First() {person = new Person;
person?>age = 20;
}
void Print(){
cout << person?>age;
}
};
int main()
{
First t[2];
for (int i=0; i<2; i++)
t[i].Print();
}
A. It prints: 10What happens when you attempt to compile and run the following code? #include
using namespace std;
int min(int a, int b);
int main()
{
int b=10;
b = min(5,20);
cout << b;
return 0;
}
int min(int a, int b)
{
if (a
return(a);
else
return(b);
}
A. It prints: 10What happens when you attempt to compile and run the following code?
#include
using namespace std;
class BaseC
{
public:
int *ptr;
BaseC() { ptr = new int(10);}
BaseC(int i) { ptr = new int(i); }
~BaseC() { delete ptr; }
};
void fun(BaseC x);
int main()
{
BaseC *o = new BaseC(5);
fun(*o);
}
void fun(BaseC x) {
cout << "Hello:"<<*x.ptr;
}
A. It prints: Hello:50What happens when you attempt to compile and run the following code?
#include
using namespace std;
class First
{
public:
void Print(){ cout<<"from First";}
};
class Second
{
public:
void Print(){ cout<< "from Second";}
};
int main()
{
Second t[2];
for (int i=0; i<2; i++)
t[i].Print();
}
A. It prints: from FirstWhat happens when you attempt to compile and run the following code?
#include
using namespace std;
int s(int n);
int main()
{
int a;
a = 3;
cout << s(a);
return 0;
}
int s(int n)
{
if(n == 0) return 1;
return s(n?1)*n;
}
A. It prints: 4Nowadays, 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.