InterviewSolution
| 1. |
Which combination of the integer variables a, b and c makes the variable m get the value 4 in the following expression ? m = (a> b)? (a>c)? a: c):((b>c)?b:c) |
|
Answer» B‐E‐DM‐AS or P‐E‐DM‐AS • B/P : Bracket or Parenthesis ( ) – In C, only ( ) used for expression – Curly braces {}, and square bracket [] used for some other purpose. • Again [] may involves in expression as in the form of array ACCESS • E : Exponentiation Exponentiation • DM: Division and Multiplication • AS : ADDITION and SubtractionPrecedence & Associativity ( ) Evaluated Evaluated first. If nested (embedded), innermost first. * / % Evaluated Evaluated second. If there are several, evaluated left to right. + ‐ E L td va uated THI dr . If there are several, evaluated left to right. = EVAL d uate last, right to l f e t. |
|