Question 5 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:
FILL (X, Y) - Fill bottle labeled X from the water in bottle labeled Y, where the remaining capacity of X is less than or equal to the 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.
1) After executing a sequence of three instructions, bottle A contains one litre of water. The first and the third of these instructions are shown below:
First instruction: FILL (C, A)
Third instruction FILL (C, A)
Then which of the following statements about the instruction is true?(adsbygoogle = window.adsbygoogle || []).push({});
a. The second instruction is FILL (B, A)
b. The second instruction is EMPTY (C, B )
c. The second instruction transfers water from B to C
d. The second instruction involves using the water in bottle A.
2) 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?
a. One
b. Two
c. Zero
d. None of these (CAT 2000)