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 1 Question 39 Discussion

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

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

#include

using namespace std;

int main(){

int i = 1;

if (i++==1) {

cout << i;

} else {

cout << i-1;

}

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Tegan
16 days ago
I think it prints 2 because the post-increment operator is used.
upvoted 0 times
...
Freeman
21 days ago
I'm not sure, but I think it's A.
upvoted 0 times
...
Keshia
26 days ago
I believe it prints 2.
upvoted 0 times
...
Brock
29 days ago
I think the answer is B.
upvoted 0 times
...

Save Cancel