As Jonathan notes below, DNI James Clapper has apologized for his “clearly erroneous” testimony before Congress about NSA surveillance. The underlying question is a tricky one, though: How can you have public testimony about classified activities? Senator Wyden had been briefed about the NSA program, and he knew the answer to the question. So he intentionally asked Clapper the question to pressure Clapper to disclose the classified program. Clapper had three choices: Disclose the classified program, give “clearly erroneous” testimony, or clam up and say that he couldn’t answer (effectively saying “yes”). The only way to avoid being placed in that dilemma was not to testify at all. No good options there, at least if you accept that we want open testimony, that witnesses should tell the truth, and that classified programs should stay classified.
Another way to look at it is that the real check here is inside the Intelligence Committee before you get to the hearing. The members of the Intelligence Committee get classified briefings, and if they are upset by what they learn they can put witnesses in that uncomfortable spot during testimony. If the government keeps members of the Committee happy, the Committee members presumably will avoid such questions. Of course, whether that check works depends on the members of the Committee, and the kinds of things that make them sufficiently annoyed or upset so that they will ask those kinds of questions.
UPDATE: I have changed the post a bit to clarify its meaning.