Consider the following code segment: int x = 22, y = 15; x = (x > y) ? (x + y)…

KVS TGT/PGT 2018Kendriya Vidyalaya Sangathan 2018

Consider the following code segment:

int x = 22, y = 15;
x = (x > y) ? (x + y) : (x - y);

What will be the value of x after the code is executed?

  1. A.

    22

  2. B.

    37

  3. C.

    7

  4. D.

    37 and 7

Attempted by 666 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…