Question

There are 5 bags labeled 1 to 5. All the coins in a given bag have the same weight. Some bags have coins of weight 10 gm, others have coins of weight 11 gm. I pick 1, 2, 4, 8, 16 coins respectively from bags 1 to 5. Their total weight comes out to 323 gm. Then the product of the labels of the bags having 11 gm coins is ___.

Official answer and solution
Official answer
12
From
Official GATE 2014 answer key

Solution

Formulate a binary weight equation for the excess weight above the baseline 10 gm weight.

Let the 5 bags be labeled 1,2,3,4,51, 2, 3, 4, 5.
The number of coins picked from bags 1 to 5 are 1,2,4,8,161, 2, 4, 8, 16 respectively.
Total number of coins picked = 1+2+4+8+16=311 + 2 + 4 + 8 + 16 = 31 coins.

If all 31 coins had weight 10 gm each, the total weight would be:

31×10=310 gm31 \times 10 = 310\text{ gm}

Each coin of weight 11 gm adds (11−10)=1 gm(11 - 10) = 1\text{ gm} of excess weight.
The actual measured total weight is 323 gm323\text{ gm}.
Therefore, the excess weight is:

323−310=13 gm323 - 310 = 13\text{ gm}

Let xi∈{0,1}x_i \in \{0, 1\} indicate whether bag ii has 11 gm coins (xi=1x_i = 1) or 10 gm coins (xi=0x_i = 0):

1⋅x1+2⋅x2+4⋅x3+8⋅x4+16⋅x5=131 \cdot x_1 + 2 \cdot x_2 + 4 \cdot x_3 + 8 \cdot x_4 + 16 \cdot x_5 = 13

Expressing 13 in binary base 2:

13=8+4+1=23+22+2013 = 8 + 4 + 1 = 2^3 + 2^2 + 2^0

So:

  • x1=1x_1 = 1 (bag 1 has 11 gm coins)
  • x2=0x_2 = 0
  • x3=1x_3 = 1 (bag 3 has 11 gm coins)
  • x4=1x_4 = 1 (bag 4 has 11 gm coins)
  • x5=0x_5 = 0

The bags containing 11 gm coins are bags 1, 3, and 4.
The product of their labels is:

1×3×4=121 \times 3 \times 4 = 12
Final answer

12

Common trap

Summing the labels (1+3+4=81 + 3 + 4 = 8) instead of multiplying them (1×3×4=121 \times 3 \times 4 = 12).

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2014 Computer Science and Information Technology (CS) Session 1
Question
47 of 65, printed as CS Q.37
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.