Free C++ Institute CPA-21-02 Exam Actual Questions

The questions for CPA-21-02 were last updated On Nov 20, 2024

Question No. 1

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

Show Answer Hide Answer
Correct Answer: C

Question No. 2

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

#include

using namespace std;

int fun(int x) {

return x<<2;

}

int main(){

int i;

i = fun(1) / 2;

cout << i;

return 0;

}

Show Answer Hide Answer
Correct Answer: C

Question No. 3

How many times will "HELLO" be printed?

#include

using namespace std;

int main()

{

for(int i=?1; i<=10; i++)

{

if(i < 5)

continue;

else

break;

cout<<"HELLO";

}

return 0;

}

Show Answer Hide Answer
Correct Answer: C

Question No. 4

Which of the following operations is INCORRECT?

Show Answer Hide Answer
Correct Answer: C

Question No. 5

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

#include

using namespace std;

int main()

{

const int x=20;

const int *ptr;

ptr = &x;

*ptr = 10;

cout<<*ptr;

return 0;

}

Show Answer Hide Answer
Correct Answer: C