Did the professor say “Put down your pencils?” Janice asked.

I wrote this is it correct?

Two small problems:

You need a comma after say.

The question mark goes outside the quotation marks in this sentence.

Did the professor say, "Put down your pencils"? Janice asked.