Answer:
the formula to calculate modified duration of bonds:
modified duration = [1 - (1 + y)⁻ⁿ] / y
since this bond pays semiannual interest,
modified duration = [1 - (1 + 5%)⁻⁸] / 5%
modified duration = (1 - 1.05⁻⁸) / 5% = 6.4632 semiannual periods
modified duration in years = 6.4632 / 2 = 3.2316 years
if you want to determine the Macaulay duration = modified duration x (1 + yield) = 3.2316 years x 1.05 = 3.39318 years