In medieval academia, quodlibet ("any question whatever") was a day when a professor (typically of theology) would open his class and answer questions on absolutely any topic. The general public was welcome to come in and pose a question - any question, as long as it was framed in a yes-no format - which the professor would be required to answer.
Questions ranged from the riddle-culous ("Were there rainbows before the Deluge?") to the sublime ("Is God good if he allows great evils to occur?"). Some theologians refused to do quodlibets, while others loved them. Transcripts of quodlibets by Thomas Aquinas and William of Ockham are still in publication.
Later, building on the notion of a free-for-all that could range across many modes and moods, the word came to be applied to a type of musical composition in which varied tunes and fragments were cleverly grafted to each other to create a musicological joke, riddle, or amusing pastiche. J.S. Bach was the first (known) composer to employ the device, in his Goldberg Variations.