Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


main()

{

if ((1||0) && (0||1))

{

printf("OK I am done.");

}

else

{

printf("OK I am gone.");

}

}

a. OK I am done

b. OK I am gone

c. compile error

d. none of the above

Answers were Sorted based on User's Feedback



main() { if ((1||0) && (0||1)) { printf("OK I am done."); ..

Answer / guest

a)

Is This Answer Correct ?    26 Yes 3 No

main() { if ((1||0) && (0||1)) { printf("OK I am done."); ..

Answer / govind verma

OK I am done. reason bollean expression in if evaluate in such manner first (1||0) will execute and first expresiion of this boolean expression is one so control will not goes to chek any thing i.e whole expression evaluate as (1||0)as 1(true) now expression becom like dis if(1&&(0||1))
now (0||1) expressiion will evaluate in this expression value of left hand side of || operator is 0(false) so control goes to check further and right hand side it recieve 1 then the value of wholl expression becom 1 thn nw orignal expression looks like if(1&&1)
nw (1&&1) is evalute in this case control check both the value of the operator(&&) is one then this return 1 otherwise return 0 then orignal expression like this if(1)
1 is nonzero value this mean condition is true then code of if block will be execute which is OK I am done.

Is This Answer Correct ?    2 Yes 1 No

main() { if ((1||0) && (0||1)) { printf("OK I am done."); ..

Answer / naveen kumar

ok i am gone...because in this case the condition if((1||0)
&&(0||1)
always remain true. hence the answer is ok i am done...i.e.
(a

Is This Answer Correct ?    1 Yes 1 No

main() { if ((1||0) && (0||1)) { printf("OK I am done."); ..

Answer / priti soni

d

Is This Answer Correct ?    1 Yes 4 No

main() { if ((1||0) && (0||1)) { printf("OK I am done."); ..

Answer / karthi

c.compile error

Is This Answer Correct ?    3 Yes 7 No

Post New Answer



More C Code Interview Questions

program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?

2 Answers  


Printf can be implemented by using __________ list.

3 Answers  


main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above

2 Answers   HCL,


main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

1 Answers  






int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)

4 Answers   HCL,


program to find magic aquare using array

4 Answers   HCL,


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,






Categories