Which of the following is not an infinite loop?A. while(1){ ....}B. for(;;){...}C. x=0;       do{ /*x unaltered within the loop*/       .....}while(x = = 0);D. # define TRUE 0     ...     while(TRUE){ ....}

This question is related to TCS Interview

Showing Answers 1 - 8 of 8 Answers

chhavi

  • Mar 21st, 2006
 

ans is c coz value of x is unaltered in loop so it will always be 0

  Was this answer useful?  Yes

abcd

  • Aug 29th, 2006
 

D

  Was this answer useful?  Yes

K.Rana Pratap

  • Jan 14th, 2007
 

It is not c) becoz  in while loop comparision takes place that is 0==0(which is true and returns the value 1) so while loop executes and it goes in infinite loop. The correct answer is (D) becoz in while loop condition becomes false with zero(0) and never enters into the loop.

  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