1) The electron configuration of Re is [Xe] 4f14 5d5 6s2
The ion Re (3+) has lost 3 electrons, so its configuration is [Xe] 4f14 5d4
Then, the number outer-shell d electrons is 4.
2) Sc: [Ar] 3d1 4s2
Sc (3+) has lost 3 electrons -> [Ar] which has not d electrons.
Then, the number of d electrons is 0
3) Ru: [Kr] 4d7 5s1
Ru (4+) has lost 4 electrons -> [Kr] 4d4
Then, the number of outer-shell d electrons is 4
4) Hg: [Xe] 4f14 5d10 6s2
Hg (2+) has lost 2 electrons -> [Xe] 4f14 5d10
Then, the number of outer-shell d electrons is 10