5/5 - (1 vote)

Latest Mar 24, 2024 Real CPA-21-02 Exam Dumps Questions Valid CPA-21-02 Dumps PDF

C++ Institute CPA-21-02 Exam Dumps – PDF Questions and Testing Engine

NEW QUESTION 21
What happens if character 3 is entered as input?
#include <iostream>
using namespace std;
class A {
public:
int i;
};
int main () {
int c;
A obj;
obj.i = 5;
cin >> c;
try
{
switch (c)
{
case A. throw 20;
case B. throw 5.2f;
case C. throw obj;
default: cout<<“No exception”;
}
}
catch (int e)
{ cout << “int exception. Exception Nr. ” << e; }
catch (A e)
{ cout << “object exception. Exception Nr. ” << e.i; }
catch (…)
{ cout << “An exception occurred.”; }
return 0;
}

 
 
 
 

NEW QUESTION 22
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class A {
protected:
int y;
public:
int x;
int z;
A() { x=2; y=2; z=3; }
A(int a, int b) : x(a), y(b) { z = x ? y;}
void Print() {
cout << z;
}
};
int main () {
A a(2,5);
a.Print();
return 0;
}

 
 
 
 

NEW QUESTION 23
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int mul (int a, int b=2)
{
int r;
r=a*b;
return (r);
}
int main ()
{
cout << mul(1) << mul(2,4);
return 0;
}

 
 
 
 

NEW QUESTION 24
Which of the following operators accept integer arguments only? (Choose two.)

 
 
 
 

NEW QUESTION 25
Which code line inserted instead of the comment below will fix the program so that it produces the expected output and does not cause any memory leak?

 
 
 
 

NEW QUESTION 26
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public :
void print() {
cout << “A “;
}
};
class B {
public :
void print() {
cout << “B “;
}
};
int main() {
B sc[2];
A *bc = (A*)sc;
for (int i=0; i<2;i++)
(bc++)->print();
return 0;
}

 
 
 
 

NEW QUESTION 27
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int op(int x, int y);
int main()
{
int i=2, j=2, k;
float f=0.3;
k = op(i, j);
cout<< k << “,” << op(1, f);
return 0;
}
int op(int x, int y)
{
return x+y;
}

 
 
 
 

NEW QUESTION 28
What is the output of the program given below?
#include <iostream>
using namespace std;
int main (int argc, const char * argv[])
{
enum state { ok, error, warning};
enum state s1, s2, s3, s4;
s1 = ok;
s2 = warning;
s3 = error;
s4 = ok;
cout << s1<< s2<< s3<< s4;
return 0;
}

 
 
 
 

NEW QUESTION 29
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(){
int *i;
i = new int;
*i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4;
cout << *i;
return 0;
}

 
 
 
 

NEW QUESTION 30
Which statement should be added in the following program to make work it correctly?
using namespace std;
int main (int argc, const char * argv[])
{
cout<<“Hello”;
}

 
 
 
 

NEW QUESTION 31
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class BaseC
{
int *ptr;
public:
BaseC() { ptr = new int(10);}
BaseC(int i) { ptr = new int(i); }
~BaseC() { delete ptr; }
void Print() { cout << *ptr; }
};
int main()
{
BaseC *o = new BaseC(5);
o?>Print();
}

 
 
 
 

NEW QUESTION 32
Which of the following statements are correct about an array?
int tab[10];

 
 
 
 

NEW QUESTION 33
Which code lines inserted independently instead of the comment will make the following program work correctly? (Choose three.)

 
 
 
 

NEW QUESTION 34
What happens when you attempt to compile and run the following code?

 
 
 
 

NEW QUESTION 35
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
void Print(){ cout<<“A”;}
};
class B:public A {
public:
virtual void Print(){ cout<< “B”;}
};
class C:public B {
public:
void Print(){ cout<< “C”;}
};
int main()
{
A ob1;
B ob2;
C ob3;
B *obj;
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}

 
 
 
 

Reliable C++ Certified Professional Programmer CPA-21-02 Dumps PDF Mar 24, 2024 Recently Updated Questions: https://www.surepassexams.com/CPA-21-02-exam-bootcamp.html

         

Related Links: myportal.utt.edu.tt myportal.utt.edu.tt www.stes.tyc.edu.tw myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter the text from the image below