What is the output of the following code: cout << (5 > 2) ? "True" : "False";
A. TRUE
B. FALSE
C. 5
D. 2
Answer: Option A
Solution (By Examveda Team)
The given code uses the ternary operator to evaluate a condition and print a result based on that evaluation.The code is:
cout << (5 > 2) ? "True" : "False";The expression
(5 > 2) evaluates to true because 5 is greater than 2.When the condition is true, the ternary operator returns the first value after the question mark (?). In this case, it returns
"True".Therefore, the correct output of the code is True.
Correct Answer: Option A: TRUE
Join The Discussion
Comments (1)
Related Questions on Introduction to C plus plus
What does the 'cin' object in C++ represent?
A. File output stream
B. File input stream
C. Standard output stream
D. Standard input stream

the correct answer is A . Ture