Quizzes in Computer Science Class
Tracing code, putting shuffled lines back in order, converting binary and busting myths: practical quiz questions for programming lessons, with the research on why reading code comes first.

In this post
Computer science has a reputation as a subject learned at the keyboard, and much of it is. But a lot of what makes a good programmer can be practised away from one: reading code and predicting what it does, putting the steps of an algorithm in order, knowing exactly what a term means. Those are the skills a quick quiz checks well, and they are often the ones students skip in their hurry to start typing.
Read before you write
Programming teachers have long suspected that many beginners try to write code they cannot yet read. A multinational study led by Raymond Lister tested that suspicion. First-year programming students at universities in several countries answered short multiple-choice questions that asked them to predict what small pieces of code would do, or to pick the line that completed them. Many struggled, and the authors argued that students who cannot reliably trace code are poorly placed to write it.
Tracing questions are cheap to write and quick to answer, which makes them ideal quiz material. A few at the start of every lesson build exactly the skill that debugging depends on.
“What does this code print?”
The single most useful question in a programming class shows a few lines of code and asks for the output. Show the code as a picture, with a large font and a light background, so it survives the projector. Five to ten lines is plenty for a timed question.

The wrong answers should be the outputs students actually get when they slip. In this example the loop runs over range(1, 4), which stops before 4, so the total is 6. A student who counts the 4 as well gets 10, and in this class two of the six did exactly that.

| The slip | A question that catches it |
|---|---|
| Off by one in a loop | What does a loop over range(1, 4) add up to? |
| = confused with == | What does a condition that assigns instead of compares do? |
| Text joined instead of added | What is "2" + "3"? |
| Whole-number division | What is 7 // 2? |
| Indentation | Which lines run inside the loop, and which only once? |
Put the steps in order
An ordering question gives students up to eight items to drag into the right order. In computing that covers a lot of ground: the steps of an algorithm such as a binary search, the stages of the software development cycle, or what happens between typing an address into a browser and seeing the page.

Shuffled lines of code are the best version of all. Programming educators call these Parsons problems, and they have some evidence on their side: Barbara Ericson and colleagues found that students who solved Parsons problems learned about as much as students who fixed or wrote the same code, in much less time. Students have to understand what each line does and which lines depend on others, without the blank page or the syntax errors.
Each item in its right place earns part of the points, so a nearly right program still scores. Give these questions a full minute: reading six lines of code and dragging them is slow work.
Numbers: binary, hex and more
Conversions have one exact answer, which makes them a natural fit for a question where students type a number. They also have a classic wrong answer: reading the binary digits in the wrong direction.
Conversion questions, with answers
- What is binary 1011 in decimal? (11. Read backwards, 1101, it would be 13.)
- What is binary 11111111 in decimal? (255.)
- What is hexadecimal FF in decimal? (255.)
- What is hexadecimal 1A in decimal? (26.)
- How many different values can 4 bits store? (16.)
For a quicker round, or a younger class, let students pick the number from tiles instead of typing it, and make the wrong numbers the results of the usual slips.
True or false for computing myths
Computing is full of beliefs that sound right. A true-or-false question brings each one into the open, and a one-line explanation at the reveal deals with it.
- “x = x + 1 is impossible, because no number equals itself plus one.” (False: = assigns a new value; it is not a statement of equality.)
- “A variable keeps the same value for the whole program.” (False.)
- “The computer can run the lines of a program in any order it likes.” (False.)
- “Deleting a file always wipes its data from the disk straight away.” (False: usually the space is only marked as free.)
- “A bigger number always needs more bits.” (False: 9 and 15 both fit in four bits.)
Terms, matching and blanks
Computing has a lot of vocabulary: variable, loop, function, array, compiler, algorithm. A matching question asks students to connect up to eight terms with definitions or examples, which is a fast way to review the language of a unit between harder questions. A fill-in-the-blank question works for definitions too: “A ___ repeats a block of code while a condition is true.”
For drilling the basics, such as conversions and keywords, play the set in Giga Quizzes’ Hacker mode. Students answer at their own pace, the questions come round again when they reach the end, and by the third time a conversion comes round most of the class has it. The guide to every question type shows each format in the editor.
Sources
- Lister, R., Adams, E. S., Fitzgerald, S., Fone, W., Hamer, J., Lindholm, M., McCartney, R., Moström, J. E., Sanders, K., Seppälä, O., Simon, B. & Thomas, L. (2004). A multi-national study of reading and tracing skills in novice programmers. ACM SIGCSE Bulletin, 36(4), 119–150.
- Ericson, B. J., Margulieux, L. E. & Rick, J. (2017). Solving Parsons problems versus fixing and writing code. Proceedings of the 17th Koli Calling International Conference on Computing Education Research, 20–29.
Try it in Giga Quizzes
Free, in the browser, and nothing for your students to install. These guides show each step on the real screens.
New to Giga Quizzes?
Free live quizzes in the browser. Students join from any phone, with no app.
Make your first quiz →

