Here in the United States, critical thinking is one of the core values of our higher education system. This is a social and institutional value that is opposite to the values seen in many other cultures, where the professor is always right, even when s/he is wrong. A competent college professor in the US should always welcome skeptical comments from students. The word "skeptic" itself comes simply from the Greek verb "to think." If you're not being skeptical, you're not thinking.
Of course, these values are not universal. For example, the educational system in India is infamous for teaching by rote memorization and discouraging critical thinking.
As a professor, I've often made mistakes in class and been very grateful to students who corrected them. I often joke to my students that if I inadvertently wrote 2+2=5 on the board, I worry that they would come up to me after class and ask, "Professor, you wrote 2+2=5 on the board. I always thought it was 4, but is 5 the answer you want us to give on the test?"
You should not refrain from asking questions in class because of any fear that it will confuse other students or make the professor fall behind and not have time to finish the lecture. Mistakes are very confusing to other students until they're corrected, and the reason you have a textbook is so that you have a source of information for any topics that there wasn't enough time to cover in class.
Of course you should exercise normal tact, consideration, and humility. The goal is not to fight a battle with your teacher, it's to help yourself and everyone else in the class understand the subject correctly. There's the joke that at the age of 20, I knew everything, but now that I'm older I know a lot less. In computer science, there are basic principles that don't change much over time (a quick sort scales better than a bubble sort), but there's a lot of other random junk that amounts to styles and fads (choices of particular computer languages). Don't fall into the trap of thinking that there's something wrong with your professor just because he doesn't emphasize the flavor of the week.
he's been known to give lower grades to students who asked him too many questions he wasn't able to properly answer
It's hard for me to imagine how you would know this. It's not as though you have access to records of what these other students' grades were on every assignment and a side-by-side comparison with what the grades would have been if they hadn't asked questions. It seems just as likely that these students had overblown opinions of their own abilities and therefore felt their grades were unfair.