Thank you. I corrected errors.

1. I will have taught Spanish for ten years by 2018.
2. I will have taught Spanish for ten years in 2018.
(Can we use both prepositions?)

3. Why is he late? He would have overslept.
4. Why is he late? He could have overslept.
5. Why is he late? He might have overslept.
(Are the three similar in meaning? Does 'would have pp' sometimes mean 'might have pp'? for "guessing" or "probablity")

1 and 2 now make good sense. Nice! And yes, either preposition works.

4 and 5 are very similar: "could have" and "might have" mean approximately the same thing.

The answer in 3 doesn't make sense to me for that question.