The professor told John that he passed the exam.

Who is "he" in this prior sentence?
John
The boy lent his friend a pencil because the teacher told him to share.

Who is "him" in this prior sentence?
The boy
Excalibur spent time with the stone because it needed a place to wait.

Who is "it" in this prior sentence?

Excalibur