Option (D) is correct.
Explanation:
A bag size works when its prime factorisation is included in the prime factorisation of 180, counting repeated primes.
- 12=2×2×3: 180 has two 2s and a 3. Works (15 bags).
- 20=2×2×5: 180 has two 2s and a 5. Works (9 bags).
- 45=3×3×5: 180 has two 3s and a 5. Works (4 bags).
- 24=2×2×2×3: needs three 2s, but 180 has only two 2s. Does not work.
Check: 24×7=168, and 180−168=12 marbles would be left over.
Why the other options are wrong
- (A) 12 needs two 2s and one 3, and 180 has them: 180=12×15.
- (B) 20 needs two 2s and one 5, and 180 has them: 180=20×9.
- (C) 45 needs two 3s and one 5, and 180 has them: 180=45×4.