What is y value of the code if input x=10y=5;if (x==10)else if(x==9)else y=8;A.9B.8C.6D.7

This question is related to TCS Interview

Showing Answers 1 - 4 of 4 Answers

sahadev

  • Feb 9th, 2007
 

hey i think so y =5 is correct but i m not sure just see the logic what they are given if x=10 then it will go into that loop then it will not go into any other if lese loops so according to my knowledge is 5 but there is no option as 5

  Was this answer useful?  Yes

naresh

  • Feb 22nd, 2007
 

absolutely ans is 5 b'coz defaultly y is initialised to 5.........
as x==10 os true then it never enters into another loops below of tht and the value is 5...........

  Was this answer useful?  Yes

akshit

  • Jul 30th, 2013
 

Nothing has been returned by the loop that is no expression is governing the iterative statement so wrong question

Code
  1.  

  Was this answer useful?  Yes

Chinnu Ann Jose

  • Aug 21st, 2013
 

5

  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