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
the correct answer is A . Ture