What happens when you attempt to compile and run the following code?
#include
using namespace std;
#define DEF_A 0 #define
DEF_B DEF_A+1 #define
DEF_C DEF_B+1
int main(int argc, char *argv[]) {
cout << DEF_C;
return 0;
}
A. It prints: 2
B. It prints: 10
C. It prints: 0
D. It prints: 1
Which code, inserted at line 10, generates the output "Hello World"? #include
#include
using namespace std;
string fun(string, string);
int main()
{
string s="Hello";
string *ps;
ps = ands;
//insert code here
return 0;
}
string fun(string s1, string s2)
{
return s1+s2;
}
A. cout << fun(" World");
B. cout << fun(*ps);
C. cout << fun("Hello");
D. cout << fun("Hello", " World");
What is the output of the program given below?
#include
using namespace std;
int main (int argc, const char * argv[])
{
int i=10;
{
int i=0;
cout<
}
cout<
return 0;
}
A. 1010
B. 100
C. 010
D. None of these
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int *t; t = new int[2];
for (int i=0; i<2; i++) {
t[i]=0;
}
cout << t[1];
}
A. It prints: 0
B. It prints: 1
C. It prints: 2
D. It prints: 3
What happens when you attempt to compile and run the following code?
#include
using namespace std;
struct {
int x;
char c;
union {
float f;
int i;
};
} s;
int main (int argc, const char * argv[])
{
s.x=10;
s.i=0;
cout << s.i << " " << s.x;
}
A. It prints: 0 10
B. It prints: 11
C. Compilation error
D. None of these
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();
}
A. It prints: Hello world
B. It prints: Hello
C. Compilation error
D. None of these
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class complex{
double re;
double im;
public:
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;
c1 = 3.0;
c1.print();
return 0;
}
A. It prints: 0 0
B. It prints: 1 1
C. It prints: 3 3
D. Compilation error
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:
void Print(){ cout<< "B";}
};
int main()
{
A *obj;
A ob1;
obj = andob1;
obj?>Print();
B ob2;
obj = andob2;
obj?>Print();
}
A. It prints: AB
B. It prints: AA
C. It prints: BA
D. It prints: BB
How could you pass arguments to functions?
A. by value
B. by reference
C. by pointer
D. by void
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;
}
A. It prints: 4 5
B. It prints: 2 3
C. It prints: 3 2
D. It prints: 4 3
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.