Instructions

Directions for the next 2 questions: There are three bottles of water, A, B, C, whose capacities are 5 litres, 3 litres, and 2 litres respectively. For transferring water from one bottle to another and to drain out the bottles, there exists a piping system. The flow through these pipes is computer controlled. The computer that controls the flow through these pipes can be fed with three types of instructions, as explained below:

Initially, A is full with water, and B and C are empty.

Question 124

# Consider the same sequence of three instructions ‘and the same initial state mentioned above. Three more instructions are added at the end of the above sequence to have A contain 4 litres of water. In this total sequence of six instructions, the fourth one is DRAIN (A). This is the only DRAIN instruction in the entire sequence. At the end of the execution of the above sequence, how much water (in litres) is contained in C?

Solution

We know that after 3 operations A contain 1 ltr and 4 th operation is Drain(a) , so 1 ltr is drained and only 4 ltrs remain in all there cylinders. Also after 6 operations A should have all the 4 ltrs in it. hence the other 2 vessels must contain 0 ltrs because there is only one drain operation in the entire sequence.