What will be the output of

int x = 20, y = 10;

var result = x > y ? "x is greater than y" : "x is less than or equal to y";

Console.WriteLine(result);

 Posted by Rajnilari2015 on 6/13/2016 | Category: C# Interview questions | Views: 957 | Points: 40
Select from following answers:
  1. x is greater than y
  2. x is less than or equal to y
  3. This is not a valid C# program
  4. All of the above
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Sindhuasit on: 7/7/2016 | Points: 10
A clear visualization for operator precedence can be done in this question. Very good information. Also I got a new idea while printing with "Console.WriteLine(result);" It is helpful in answering interview questions on C#.

Login to post response