What is the value of y in the following code?x=7;y=0;if(x=6) y=7;else y=1;A. 7B. 0C. 1D. 6

This question is related to TCS Interview

Showing Answers 1 - 7 of 7 Answers

nitin

  • Oct 8th, 2005
 

Look at the code carefully

if(x =6) and not if(x==6).

So after this instruction x will be made equal to 6 and next instruction will follow which will make y = 7. So the ans is 7..

  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