Prerequisite : Operators in C
Q.1 What is the output of this program?
Options
a) 10
b) 11
c) compile time error
d) run time error
ans: c
Explanation : lvalue required as increment operator operate only on
variables and not constant values.
Q.2 What is the output of this program?
Options
a) 1 1 2 3
b) 1 1 2 2
c) 0 1 2 2
d) 1 2 3 3
ans:- b
Explanation : Once the value of expression is true in OR, latter expression will not evaluated hence j = 1 is assigned to m .
Q.3 What is the output of this program?
Options
a) 11
b) 12
c) 13
d) none of above
ans: c
Explanation : and operator(&) is used so whole expression is evaluated even if the first part is true.
Q.4 What is the output of this program?
Options
a) i=1
b) i=0
c) i=10
d) none of these
ans:- b
Explanation : Not oprerator(!) has more precedence than greater than operator(>) so 0>14 is evaluated false.
Q.5 What is the output of this program?
Options
a) c=3 d=5
b) c=5 d=5
c) can't be determined
d) none of these
ans : a
Explanation : The precedence of '(' is greater as compared to ', ' so firstly a is assigned in c and then b is assigned in d.
Q.6 What is the output of this program?