In which sentence is the word barn used as the OBJECT OF A PREPOSITION?

B. The barn owl flies silently through the night.
C. John found the dog asleep in the barn.
D. Close the barn door when you leave

The word "barn" is used as the object of a preposition in sentence D: "Close the barn door when you leave."

The word barn is used as the object of a preposition in sentence D. "Close the barn door when you leave."