What is the expected output of the following program?
A. It prints: 432
B. It prints: 321
C. It prints: 4321
D. It prints: 3210
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;
b.set();
b.Print();
return 0;
}
A. It prints: 42
B. It prints: 44
C. It prints: 22
D. It prints: 2
What happens when you attempt to compile and run the following code?
#include
using namespace std;
void set(struct person*);
struct person
{
char name[25];
int age;
};
int main()
{
struct person e = {"Steve", 30};
set(ande);
cout<< e.name << " " << e.age;
return 0;
}
void set(struct person *p)
{
p?>age = p?>age + 1;
}
A. Error: in prototype declaration unknown struct person
B. Error: in structure
C. It prints: Steve 31
D. None of these
What happens when you attempt to compile and run the following code?
A. It prints: 10
B. It prints: 2+32+3
C. It prints: 7
D. It prints: 22+3
What happens when you attempt to compile and run the following code?
A. It causes a compilation error
B. It prints: Tesc failed
C. .It prints: failed
D. It prints: Tesc
What happens when you attempt to compile and run the following code?
A. It prints: 33
B. It prints: ?1
C. It prints: ??
D. It prints: ?3
What happens when you attempt to compile and run the following code?
A. It prints: T
B. It prints an empty line
C. It prints: Tesc
D. It prints: st
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);
b.Print();
return 0;
}
A. It prints: 10
B. It prints: 2
C. It prints: 5
D. It prints: 1
Analyze the code below. If it contains an error, indicate its place in the program.
A. Error in the for loop
B. Error in the break statement
C. No error
D. Error in the if statement
What 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:50
B. It prints: Hello:10
C. It prints: Hello:5
D. Compilation error
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.