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: 9
B. It prints: 9.9
C. Compilation error
D. None of these
Which code, inserted at line 18, generates the output "AB"
#include
using namespace std;
class A
{
public:
void Print(){ cout<< "A";}
void Print2(){ cout<< "a";}
};
class B:public A
{
public:
void Print(){ cout<< "B";}
void Print2(){ cout<< "b";}
};
int main()
{
B ob2;
//insert code here
ob2.Print();
}
A. ob2?>A::Print();
B. ob2.B::Print();
C. ob2?>B::Print();
D. ob2.A::Print();
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class A {
protected:
int y;
public:
int x, z;
A() : x(1), y(2), z(0) {}
A(int a, int b) : x(a), y(b) { z = x * y;}
void Print() { cout << z; }
};
class B : public A {
public:
int y;
B() : A() {}
B(int a, int b) : A(a,b) {}
void Print() { cout << z; }
};
int main () {
A b(2,5);
A. Print(); return 0; }
B. It prints: 10
C. It prints: 2
D. It prints: 5
E. It prints: 1
What is the output of the program?
#include
using namespace std;
#define PRINT(i) cout<
int main()
{
int y=2, z=3;
PRINT(y);
PRINT(z);
return 0;
}
A. It prints: 123
B. It prints: 23
C. It prints: 3
D. It prints: 2
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int i=5;
switch(i)
{
case 1:
cout<<"Hello";
break;
case 2:
cout<<"world";
break;
case 3:
break;
default:
cout<<"End";
}
return 0;
}
A. It prints: Hello
B. It prints: world
C. It prints: End
D. It prints: Helloworld
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int *a= new int;
*a=100;
cout << *a;
delete a;
}
A. It prints: 1
B. It prints: 100
C. It prints: 0
D. It prints: 10
Which of the following operations is INCORRECT?
A. int i=15;
B. long int k=123
C. float f=12,2;
D. double d=12;
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class A {
protected:
int y;
public:
int x,z;
A() : x(2), y(2), z(1) { z = x + y; }
A(int a, int b) : x(a), y(b) { z = x + y;}
void Print() { cout << z; }
};
class B : public A {
public:
int y;
B() : A() {}
B(int a, int b) : A(a,b) {}
void Print() { cout << z; }
};
int main () {
A b;
A. Print(); return 0; }
B. It prints: 4
C. It prints: 0
D. It prints: 3
E. It prints: 2
What is the output of the program if character 3 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.
B. It prints: int exception. Exception Nr.
C. It prints: An exception occurred.
D. It prints: float exception. Exception Nr.
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 {
public:
void set() {
y = 4; z = 2;
}
void Print() {
cout << y << z;
}
};
int main () {
B b;
A. set();
B. Print(); return 0; }
C. It prints: 42
D. It prints: 44
E. It prints: 22
F. It prints: 2
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 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.