Query on c programming


#1

Consider the following fragment
if a<b printf(“a<b”);
else printf(“elsepart”);
printf(“a<=b”);
a<=b will be printed if:
a)a<b
b)a>b
c)a==b
d)all the above


#2

D all of the above since the else block is not enclosed in brackets so else block only consists of 1 line i.e followed by else statement rest statement is not treated as else block statement


#3

D all the above because no block is closed with brace so above all statements are true


#4

Yes the answer is all of the above because the statement does not belong to the if block. So it will be executed without depending on the conditions present in if else block