Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute Exam CPA-21-02 Topic 5 Question 20 Discussion

Actual exam question for C++ Institute's CPA-21-02 exam
Question #: 20
Topic #: 5
[All CPA-21-02 Questions]

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;

}

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Paz
1 days ago
I think the answer is C because the preprocessor directive #if A evaluates to true since A is defined as 1.
upvoted 0 times
...
Antione
4 days ago
The answer is B) It will print: Hello. The #if preprocessor directive will evaluate A to be true, and so the 'Hello' message will be printed, followed by the 'world' message.
upvoted 0 times
...
Charlette
5 days ago
I believe the answer is B.
upvoted 0 times
...
Martha
14 days ago
I think the answer is A.
upvoted 0 times
...

Save Cancel