Respect database prefix in quiz module

Hi Matt,

I have a couple of sites that don't use mdl_ as the database prefix. Those sites turned up a couple of spots in your code where that prefix is still hardcoded. This patch fixes them. I think it can be cherry-picked to 2.4 and 2.3 without changes.