Amount in compound interest = p(1 + r/t)^nt where p is the initial deposit, r = rate, t = number of compunding in a period and n = period.
Here, Amount after 4 years = 500(1 + (2/100)/3)^(4 x 3) = 500(1 + 0.02/3)^12 = 500(1 + 0.0067)^12 = 500(1.0067)^12 = 500(1.083000) = $541.50