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 ?    30 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 ?    3 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

What is data _null_? ,Explain with code when u need to use it in data step programming ?

0 Answers   Abbott,


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


Implement a t9 mobile dictionary. (Give code with explanation )

1 Answers   Amazon, Peak6, Yahoo,


Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false

1 Answers   Cognizant, lenovo,


main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

1 Answers  


How to read a directory in a C program?

4 Answers  


main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }

1 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  


Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

1 Answers   GoDB,


main() { int i=10; i=!i>14; Printf ("i=%d",i); }

1 Answers  


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  


Write a single line c expression to delete a,b,c from aabbcc

2 Answers   Microsoft,


Categories