BlackFriday 2024! 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 Topic 2 Question 83 Discussion

Actual exam question for C++ Institute's CPA exam
Question #: 83
Topic #: 2
[All CPA Questions]

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

#include

using namespace std;

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

{

enum state { ok, error, warning};

enum state s1, s2, s3;

s1 = ok;

s2 = warning;

s3 = error;

s4 = ok;

cout << s1<< s2<< s3;

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Tish
4 months ago
So, the correct answer must be B) compilation error.
upvoted 0 times
...
Tonja
4 months ago
Oh, then it might give a compilation error.
upvoted 0 times
...
Luisa
5 months ago
But it looks like there is no declaration for 's4'.
upvoted 0 times
...
Lynda
5 months ago
I agree, the code seems fine to me.
upvoted 0 times
...
Leatha
5 months ago
I think it will compile successfully.
upvoted 0 times
...
Dylan
5 months ago
I'm not sure but I think it will print ''123''.
upvoted 0 times
...
Abel
6 months ago
I think it will print ''132''.
upvoted 0 times
...
Flo
6 months ago
I believe it will print ''021''.
upvoted 0 times
...
Tish
6 months ago
I think it will print a compilation error.
upvoted 0 times
...

Save Cancel