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

int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

0 Answers  


Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.

1 Answers  


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 Answers  


Write a program that find and print how many odd numbers in a binary tree

1 Answers  






how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!

8 Answers   GATE,


main() { int i = 3; for (;i++=0;) printf(“%d”,i); }

1 Answers   CSC,


main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


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

5 Answers   HCL,


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!

35 Answers   Tata Elxsi, TCS, VI eTrans,


Categories