47.4k views
1 vote
What would the value of y be if x is 8

2 Answers

4 votes

Answer:

I think it might be -2....

User Varun Malhotra
by
5.7k points
1 vote

The value of y is 4

From the information given, we have that the expression y = (x > 6 ? 4:6) is a ternary conditional operator in programming, which evaluates the condition x > 6

Now , we can deduce from the expression that;

  • if the given value x is greater than 6, then the y get assigned to 4.
  • if the x value is not greater than 6 then y get assigned to 6.

Since, we have that x=8 and the statement 8>6 is true, therefore y get assigned to 4.

y=4.

Complete question:

y = (x > 6 ? 4:6); What will be the value of y if x = 8?

User Looki
by
5.4k points