MDL-42957 (2) quiz statistics : Hardcoded sql LIMIT clause

Fixing some typos and adding some tests.