ExamVeda
Login
Home
Introduction to C plus plus
?

What is the output of the following code: cout << (5 > 2) ? "True" : "False";

Answer & Solution
Correct Answer: Option A
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
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Abdulkreim Seid
Abdulkreim Seid 2 years ago
the correct answer is A . Ture