If there is one, point out an error in the program
#include
using namespace std;
int main()
{
int c = 'a';
switch(i)
{
case '2':
cout<<"OK";
case '1':
cout<<"Error";
default:
break;
}
return 0;
}
A. No Error
B. Use of undeclared identifier 'i'
C. Illegal use of 'continue'
D. Illegal use of 'break'
What happens when you attempt to compile and run the following code?
A. It prints: 3.14
B. It prints: Scring
C. It causes a compilation error
D. It prints: x
Which of the following expressions decrement variable i by 2? (Choose two.)
A. i and= 0x03;
B. i ? 2;
C. i; i
;
D. i
;
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int f(int i);
int main()
{
int i=0;
i++;
for (i=0; i<=2; i++)
{
cout< } return 0; } int f(int a) { return a+a; } A. It prints: 202020 B. It prints: 012 C. It prints: 024 D. It prints: 0
What will variable "y" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
};
class B : public A {
string name;
public:
void Print() {
cout << name << age;
}
};
A. public
B. private
C. protected
D. None of these
What 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 First
{
public:
void Print(){ cout<< "from Second";}
};
void fun(First *obj);
int main()
{
First FirstObject; fun(andFirstObject); Second SecondObject; fun(andSecondObject);
} void fun(First *obj) { obj?>Print(); }
A. It prints: from First
B. It prints: from Firstfrom First
C. It prints: from Firstfrom Second
D. It prints: from Secondfrom Second
What will happen when you attempt to compile and run the following code?
#include
using namespace std;
#define A 1
int main()
{
#if A
cout<<"Hello";
#endif
cout<<"world";
return 0;
}
A. It will print: Helloworld
B. It will print: Hello
C. It will print: world
D. It will print: 0
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int i = 4;
while(i >= 0) {
cout<
i??;
}
return 0;
}
A. It prints:"43210"
B. It prints:"3210"
C. It prints: "3210?1"
D. None of these
What will be the output of the program?
#include
using namespace std;
int main()
{
const int y = 5;
const x = ?10;
cout< return 0; } A. ?10 5 B. 5 ?10 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 complex{
double re, im;
public:
complex() : re(1),im(0.3) {}
complex(double n) { re=n,im=n;};
complex(int m,int n) { re=m,im=n;}
complex operator+(complex andt);
void Print() { cout << re << " " << im; }
};
complex complex::operator+ (complex andt){
complex temp;
temp.re = this?>re + t.re;
temp.im = this?>im + t.im;
return temp;
}
int main(){
complex c1(1),c2(2),c3;
c3 = c1 + c2;
c3.Print();
}
A. It prints: 1 1.5
B. It prints: 2 1.5
C. It prints: 3 3
D. It prints: 0 0
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.