**For First bag,**

Total marbles = 2 + 2 = 4

We are taking out two marbles one after another without replacement,

So, total possible ways of getting two blue marbles = 2 x 1 = 2

Total possible ways of getting two red marbles = 2 x 1 = 2

Possibility of getting same colour marbles = 2 + 2 = 4

But, possible ways of getting any two marbles = 4 x (4-1) = 4 x 3 = 12

So, probability of getting same colour marbles both times = 4/12 = 1/3

**For second bag,**

Total marbles = 2 + 2 + g = 4 + g

We are taking out two marbles one after another without replacement,

So, total possible ways of getting two blue marbles = 2 x 1 = 2

Total possible ways of getting two red marbles = 2 x 1 = 2

Total possible ways of getting two red marbles = g x (g-1)

Possibility of getting same colour marbles = 2 + 2 + g(g-1) = 4 + g² - g

But, possible ways of getting any two marbles = g+4 x [(g-1)+4] = (g+4)(g+3)

So, probability of getting same colour marbles both times = 4 +g² - g/ (g+4)(g+3)

≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

Now, given that the probabilities are same for both the bags,

1/3 = 4 +g² -g/(g+4)(g+3)

1/12+3g² - 3g = 1/(g+4)(g+3)

12+3g² - 3g = (g+4)(g+3)

12+3g² - 3g = g² +7g + 12

2g² = 10g

0 = 2g² - 10g

0 = 2g(g-5)

By factor theorem,

g = 0

g = 5

Since, it's given that g > 0, g = 5 in this case.

**So, the answer is (B) 5. **