Interview Questions on C - Operators
1. What are all arithematic operators?
+ * / - % ++ --
2. What is difference b/w postfix and prefix incremental operators.
Post fix:- increment happens after executing the expression.
Prefix:- increment happens before executing the expression.
3. K++ is faster than K+1 why?
K++ simply increase the counter variable. Whi ch is only one action
K+1 perform addition and then assign to K. which has two actions. That is why k++ is faster than K+1.
4. What is the operator we use to get the reminder?
%
5. What are relational operators?
= =, <=, >=, !=, < , >
6. What are the logical operators?
&&, || and !
7. What is Shorthand operaators.
Instead of writing a=a+3 we can simply write a+=3. This is ‘+=’ called short hand operators.
8. How to know the size of particular variable?
By using sizeof().
9. How to get address of particular variable?
By using &
10. How to access value of pointer?
By using *
11. while evaluating the expression, if both operators have same operator precedence then how to evaluate?
Use associative rule. Whether left to right or right to left.