You might have misunderstood the question. It can be read as a meaningful exercise problem.
Capacitor stored energy is E = 0.5*C*V². There will be a residual capacitor voltage after discharge and less than unity boost converter efficiency to be considered.
It's a 16V rated capacitor, putting 40V across it isn't a good idea. If the question is how much current would discharge it in 30 seconds, the implication is a 40V boost converter is needed so it's efficiency and ability to regulate it's output (minimum input voltage) must be known before a calculation can be made.