There are three bottles of water A, B, C whose capacities are 5 liters, 3 liters and 2 liters respectively. For transferring water from one bottle to another and to drain out the bottle, there exists a piping system. The flow thorough 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
Instruction type | Explanation of the instruction |
FILL (X, Y) | Fill bottles labeled X from the water in bottle labeled Y, where the remaining capacity of X is less than or equal to amount of water in Y. |
EMPTY (X,Y) | Empty out the water in bottle labeled X into bottle labeled Y, where the amount of water in X is less than or equal to remaining capacity of Y. |
DRAIN (X) | Drain out all the water contained in bottle labeled X. |
Initially A is full with water and B and C are empty.
Q1. After executing a sequence of three instruction bottle A contains one liter of water. The first and the third of these instructions is given below
First instruction FILL (C, A)
Third instruction FILL (C,A)
Which of the following statesman about the instruction is true?
i) The second instruction is FILL (B,A)
ii) The second instruction is Empty (C,B)
iii) The second instruction transfer water from B to C
iv) The second instruction involves using the water in bottle A.
Q2. 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 liters 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 is contained in C?
i) 1
ii) 2
iii) 0
iv) None of these