Q: Does "lightning" have the same meaning in the following two sentences?

That tree was hit by lightning.

The lightning was hot enough to melt the sand.

A: the same meaning

Q: Does "cup" have the same meaning in the following two sentences?

He swore as the ball rimmed the cup and rolled away.

He drank a cup of coffee.

A: different meanings

Q: Does "rest" have the same meaning in the following two sentences?

He threw away the rest.

The boulder came to rest just behind the house after rolling down the mountain.

A:
different meanings