How do professors view a student who has good grades but always asks stupid questions?
Students often have a highly distorted perception of themselves with respect to the feelings of their professors.  The differential in both power and experience between student and professor is just so large that it's quite common for a student to confuse the very distinct attributes of professorial attitude, personal affection, and intellectual respect.  

As such, I would suggest that you really don't know what your professors think of you until you ask them.  Maybe you are reading them correctly, but maybe not: many professors are quite pleased to have a student who carefully advocates to improve their understanding of material, even if they might wish to be getting on with the lecture in the moment.

My recommendation is to tell the professor you're thinking of applying to Ph.D. programs and ask them something like:


  Do you think that you would be able to write a strong letter of recommendation for me?


The "strong" is important here, because that's what will get you the honest opinion of whether the professor thinks well of you or not, and you don't want letters that are not strong.