Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

A helicopter drops two trains, each on a parachute, onto a
straight infinite railway line. There is an undefined
distance between the two trains. Each faces the same
direction, and upon landing, the parachute attached to each
train falls to the ground next to the train and detaches.
Each train has a microchip that controls its motion. The
chips are identical. There is no way for the trains to know
where they are. You need to write the code in the chip to
make the trains bump into each other. Each line of code
takes a single clock cycle to execute.

You can use the following commands (and only these);

MF - moves the train forward

MB - moves the train backward

IF (P) - conditional that's satisfied if the train is next
to a parachute. There is no "then" to this IF statement.

GOTO

Answer Posted / vinayak

MF
IF (P)
GOTO B
GOTO A
-----
B: MF
GOTO B
Explanation: The first line simply gets them off the
parachutes. You
need to get the trains off their parachutes so the back
train can find
the front train's parachute, creating a special condition
that will
allow
it to break out of the code they both have to follow
initially. They
both loop through A: until the back train finds the front
train's
parachute, at which point it goes to B: and gets stuck in
that loop.
The front
train still hasn't found a parachute, so it keeps in the A loop.
Because each line of code takes a "clock cycle" to execute,
it takes
longer
to execute the A loop than the B loop, therefore the back train
(running
in the B loop) will catch up to the front train.

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The price of sugar increases by 20%, by what % should a housewife reduce the consumption of sugar so that expenditure on sugar can be same as before ?

1334


One guy (some name) has Rs. 100/- in hand. He has to buy 100 balls. One football costs Rs. 15/, One Cricket ball costs Re. 1/- and one table tennis ball costs Rs. 0.25 He spend the whole Rs. 100/- to buy the balls. How many of each balls he bought?

2280


The ratio of no. of boys & girls in a school is 3:2 Out of these what % the boys & 25% of girls are scholarship holders. % of students who are not scholarship holders.?

1254


A fruit seller had some balls. He sells 40% balls and still has 420 balls. How many balls he had initially?

1529


the bucket size is 10KB.it takes 0.0001 KB/milisec to fill bucket.the bucket takes 100 or 1000 milisec to reach to destination.it takes 100 milisec to pass acknowledgement from dest to source.so calculate how much time will it take to pass N KB ,write formula. i don't remember the exact figures of bucket transmission time from source to dest

1372


Find the next series number 0, 6, 24, 120, 210, ---, ----

1223


If DBMDVUUB = CALCUTTA Then BOMBAY = ?

2263


A bus started from bustand at 8.00am, and after staying for 30 minutes at a destination, it returned back busstand. The destination is 27 miles from the busstand. The speed of the bus is 18mph. During the return journey bus travels with 50% faster speed.At what time does it return to the busstand?

1326


there is a 4 inch cube painted on all sides. this is cut into no of 1 inch cubes. what is the no of cubes which have no pointed sides.

1290


Hello My name is vijay right now I'm preparing for SBI po, I am good at aptitude but not better. I am lagging time you know competitive exams are to answer in span of time. So any website regarding aptitude short cuts or tricks Pls post to my mail. I am waiting

2160


In a colony there are some families. Each of them have children but different in numbers.Following are conditions ano of adult>no of sons>no of daughters>no of families. b>each sister must have atleast one brother and should have at the most 1 sister. no of children in one family exceeds the sum of no of children in the rest families. Tell the no of families.

1580


One day the Finance minister decides that the country should have only 33 paise and 56 paise.If there are two traders having enough change in the two denominations, what is the minimum amount for which they can transact?

1361


Find the Series number: 0,2,3,5,8,10,15,17,24,26,..

1273


Current/most recent employer (Please state full names and address including Country and post code) Current Position Held When would you be available to start work? ONLINE INTERVIEW [INSTRUCTIONS: Give brief answers to all the under listed questions] QUESTIONS ANSWER SPACE 1) What are your years of experience? 2) How do you approach a technical problem? Give an example. How long do you think it would be before you will make a significant contribution to the team/company?

1454


f(X)= 2X-1 + f(X-1) if X is not equal to zeroandiff(X=0)=0, Value of f(5)

1312