Star Trek: The Next Generation (1987) : The Last Outpost

Stardate: 41386.4. A powerful entity disables the Enterprise and a Ferengi ship. Their only means of escape is if they can correctly answer the riddles he asks.