Weekend Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code = simple70

Pass the C++ Institute C++ Certified Professional Programmer CPA-21-02 Questions and answers with ExamsMirror

Practice at least 50% of the questions to maximize your chances of passing.
Exam CPA-21-02 Premium Access

View all detail and faqs for the CPA-21-02 exam


481 Students Passed

87% Average Score

91% Same Questions
Viewing page 1 out of 8 pages
Viewing questions 1-10 out of questions
Questions # 1:

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

#include

using namespace std;

int main (int argc, const char * argv[])

{

int tab[5]={1,2,3};

for (int i=0; i<5; i++)

cout <

return 0;

}

Options:

A.

compilation fails

B.

It prints: 12300

C.

It prints: 12345

D.

It prints: 00000

Questions # 2:

What will be the output of the program?

#include

#include

using namespace std;

int fun(int);

int main()

{

float k=3;

k = fun(k);

cout<

return 0;

}

int fun(int i)

{

i++;

return i;

}

Options:

A.

3

B.

5

C.

4

D.

5

Questions # 3:

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

#include

using namespace std;

int op(int x, int y);

float op(int x, float y);

int main()

{

int i=1, j=2, k;

float f=0.3;

k = op(i, j);

cout<< k << "," << op(0, f);

return 0;

}

int op(int x, int y)

{

return x+y;

}

float op(int x, float y)

{

return x?y;

}

Options:

A.

It prints: 3,1

B.

It prints: 3,?0.3

C.

It prints: 3,0

D.

It prints: 0,0

Questions # 4:

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

#include

using namespace std;

int main()

{

int i = 5;

do {

i??;

cout<

}

while(i >= 0);

return 0;

}

Options:

A.

It prints: 43210?1

B.

It prints: ?1

C.

It prints: 4321

D.

It prints: 1

Questions # 5:

What will happen when you attempt to compile and run the following code?

#include

#include

using namespace std;

string fun(string, string);

int main()

{

string s="Hello";

cout << fun(s, " World");

return 0;

}

string fun(string s1, string s2)

{

return s1+s2;

}

Options:

A.

It will print: Hello World

B.

It will print: Hello

C.

It will print: World

D.

It will print: HW

Questions # 6:

A condition expression used by if(), while(), and do-while() must evaluate to and only to:

Options:

A.

an int type value

B.

any value that can be treated as truth/falsehood

C.

a float type value

D.

a bool type value

Questions # 7:

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

#include

using namespace std;

namespace myNamespace1

{

int x = 5;

int y = 10;

}

namespace myNamespace2

{

float x = 3.14;

float y = 1.5;

}

int main () {

namespace newname = myNamespace1;

using namespace newname;

cout << x << " ";

cout << y;

return 0;

}

Options:

A.

It prints: 5 1.5

B.

It prints: 3.14 1.5

C.

It prints: 5 10

D.

It prints: 5

Questions # 8:

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

#include

using namespace std;

int main()

{

union un

{

int x;

char c;

};

union un u1 = {10};

union un u2 = {'a'};

union un u3 = {20, 'a'};

cout<

cout<

cout<

return 0;

}

Options:

A.

It prints: 10aa

B.

It prints: 10a20a

C.

It prints: 1a

D.

Compilation error

Questions # 9:

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

Question # 9

Options:

A.

It causes a compilation error

B.

It prints: Tesc failed

C.

.It prints: failed

D.

It prints: Tesc

Questions # 10:

The following declaration:

int i = 0b10;

Options:

A.

is invalid

B.

sets variable i with an integer value equal to 10

C.

sets variable i with an integer value equal to 2 (10 binary)

D.

sets variable i with an integer value equal to 8 (10 octal)

Viewing page 1 out of 8 pages
Viewing questions 1-10 out of questions
TOP CODES

TOP CODES

Top selling exam codes in the certification world, popular, in demand and updated to help you pass on the first try.