Read the following code# define MAX 100# define MIN 100        ....        ....if(x>MAX)x=1;else if(x<MIN)x=-1;x=50;if the initial value of x=200,what is the value after executing this code?A. 200B. 1C. -1D. 50

This question is related to TCS Interview

Showing Answers 1 - 5 of 5 Answers

mehul

  • Jul 17th, 2005
 

how can i know about open interview of TCS? 
Please send me ans on my email

  Was this answer useful?  Yes

priya

  • Apr 17th, 2006
 

hi all

 ans is-50

because of value of x change to 50 after evaluating the value

  Was this answer useful?  Yes

prakash

  • Mar 14th, 2007
 

Ans C
Because the initial value of x is 200 so first execute the if condition (x>max)
Then the condition is satisfied the ans x=1

  Was this answer useful?  Yes

vasu0040

  • Aug 31st, 2010
 

200>100 true first the answer is 1 but compiler jumps to x=50;
so the final value is 50
because the else part has no paranthasis{ }

  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