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

how to swap 3 nos without using temporary variable

4 Answers   Satyam,


main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }

1 Answers  


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

2 Answers   HCL,


#define assert(cond) if(!(cond)) \ (fprintf(stderr, "assertion failed: %s, file %s, line %d \n",#cond,\ __FILE__,__LINE__), abort()) void main() { int i = 10; if(i==0) assert(i < 100); else printf("This statement becomes else for if in assert macro"); }

1 Answers  


main() { clrscr(); } clrscr();

2 Answers  






what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }

10 Answers  


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


how to return a multiple value from a function?

5 Answers   Wipro,


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  


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }

1 Answers   Honeywell,


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


Categories