Fora Financial Interview Question

how to optimize EF query,