And no, the judge is not going to say "you must only answer the question" if you answer that way; "when did you stop beating your wife?" doesn't actually work in a court of law.
Regardless, even if you did have a contractual obligation to pay, but found it impossible to cancel (assuming you're allowed to cancel without penalty), you could pretty safely answer "Yes" to that last question, and then your own lawyer would then expose the whole impossible-to-cancel situation when it's their turn to question you. Court of law isn't this "haha, gotcha!" thing.