If you've got a knack for coming up with smart comments on the fly, you're quick-witted. The most quick-witted students in a class are often the first to raise their hands to answer the teacher's question (or to supply a sarcastic remark).
Anyone whose mind is sharp can be called quick-witted, especially if they've got a great sense of humor and are speedy with a comeback. Being quick-witted is helpful during a debate or when you're playing a game with a time limit. Quick-witted comes from wit, which doesn't just mean "sense of humor," but also "intelligence."