What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
int a=5;
cout << ((a < 5) ? 9.9 : 9);
}
Suggested Answer: A
Get Premium CPA-21-02 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
13 comments · newest first
WI
Willard
2 days ago
No compilation error here, just a simple ternary operation.
CA
Catrice
7 days ago
Wait, why would it print 9.9? That doesn't make sense.
AG
Agustin
12 days ago
Totally agree, option A is correct!
RO
Rosalia
17 days ago
It prints: 9
CA
Carlene
22 days ago
I thought it would throw a compilation error, but I guess not!
NO
Norah
27 days ago
I think it compiles fine, just outputs 9.
GE
Gerald
1 month ago
Wait, why would it print 9.9? That doesn't make sense.
KR
Kristel
1 month ago
Definitely A, no doubt about it!
MO
Mozell
1 month ago
It prints: 9
JU
Jules
2 months ago
I have a feeling there might be a compilation error, but I can't recall why exactly.
KA
Karan
2 months ago
I practiced a similar question, and I believe it compiles fine, so I'm leaning towards option A.
PA
Pamela
2 months ago
I'm not entirely sure, but I remember something about the ternary operator. Could it be that it prints 9.9?
KA
Kathryn
2 months ago
I think it should print 9 because a is not less than 5.