Operators And Expressions(C Program ) Questions and Answers
Explanation:-
Answer: Option C. -> 2Here unary minus (or negation) operator is used twice. Same maths rules applies, ie. minus * minus = plus.
Note: However you cannot give like --2. Because -- operator can only be applied to variables as a decrement operator (eg., i--). 2 is a constant and not a variable.
Explanation:-
Answer: Option B. -> 1 1 2 2In an expression involving || operator, evaluation takes place from left to right and will be stopped if one of its components evaluates to true(a non zero value).
So in the given expression m = i++ || j++ || k++.
It will be stop at j and assign the current value of j in m.
therefore m = 1 , i = 1, j = 2 and k = 2 (since k++ will not encounter. so its value remain 2)
Explanation:-
Answer: Option D. -> II and IVExplanation:-
Answer: Option C. -> 13All the three condition in if is true.
if(y++>9 && y++!=10 && y++>11) such as
1st condition : 10++ > 9 is true and value of y is increase by 1 i.e y =11
2nd condition : 11++ != 10 is also ture and value of y is increase by 1 i.e y =12
3rd condition : 12++ > 11 is also ture and value of y is increase by 1 i.e y =13
Therefore if is excuted and print the value of y = 13