Oct 28, 2010

What is the time??

A watch was set accurately at 8.30am and then lost 2 seconds for every 5 minutes. What time was indicated on the watch at 6.30pm on the same day?

Answer:
6.26pm

Explanation:
As given the question, the watch will lost 2 seconds for every 5 minutes,
therefore, for 10min = 4 sec
                     20min = 8 sec
                     40min = 16 sec
                     60min (1 hour)= 24 sec
                     10 hours = 240 sec which is 4 min.
Therefore after 10 hours, 4 min delay will occur i.e at 6.30pm it will show 6.26pm.

Find the output.

main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
}



Answer:
-1


Explanation:
Unary + is the only dummy operator in C. So it has no effect on the expression and now the while loop is, while(i--!=0) which is false and so breaks out of while loop. The value –1 is printed due to the post-decrement operator.