Ask Question
25 August, 18:12

What is x after evaluating?

x = (2>3) ? 2 : 3;

A. 2

B. 3

C. 4

D. none of the above

+4
Answers (1)
  1. 25 August, 19:16
    0
    3

    Explanation:

    In programming, there is a lot of conditional operators.

    like NOT (&&) operator, OR (||) operator.

    similarly, there is an operator called the ternary operator. It takes three operands and it behaves like the if-else statement.

    syntax:

    (condition) ? expression 1 : expression 2;

    Working:

    If the condition is true, then it executes the expression 1 and if the condition is false, then it executes the expression 2.

    let see the Question,

    x = (2>3) ? 2 : 3;

    the condition (2 > 3) is false, 2 always less than 3 not greater than 3.

    Therefore, it executes the value 3 and assigns to x.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is x after evaluating? x = (2>3) ? 2 : 3; A. 2 B. 3 C. 4 D. none of the above ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers