What does the following function print?func(int i){if(i%2)return 0;else return 1;}main(){int =3;i=func(i);i=func(i);printf("%d",i);}A. 3B. 1C. 0D. 2

This question is related to TCS Interview

Showing Answers 1 - 4 of 4 Answers


  • Jun 12th, 2005

Ans. C

  Was this answer useful?  Yes

K.Rana Pratap

  • Jan 14th, 2007

Answer is B

First it returns 0 so i value becomes zero. With the same value it enters if loop and becomes false....so it returns 1.

  Was this answer useful?  Yes


  • Jun 1st, 2007

The answer is zero and i do not see any second loop performing anything after the return statement.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions