Short answer questions are probably the best style for testing multiple concepts in isolated settings on a quiz or exam. They should be relatively easy to grade, although it is always more work to try to look at student’s work when they make a mistake. Some students won’t “show their work” when tracing through code, and so one consideration to make before quizzing students in this style is to train them on how to properly demonstrate their thought process working through a code segment.
The question below is aimed at looking for student comprehension of a while loop with a Boolean condition.
What will be printed out when the following loop has finished executing?
x = 90 while x > 3: x = x / 2 print x
This question can be used to test several concepts: while loops; integer arithmetic; assignment; Boolean expressions. It would be difficult to ask an interesting question about while loops without including some previously learned concepts. In this case, the key to understanding student conceptions about loops is to instruct them on how to show what is happening during each iteration. A common way to do this involves using a table. The table can show the value of each variable involved in the code segment during each iteration. An example table for exploring this code segment is shown below.
Giving a student the table headers without any rows at all allows the student to trace through the code on the quiz or test so that their thought process can be evaluated. Mistakes in calculations can be ignored, which is an approach that is lost when using a multiple choice item. For students that need more scaffolding, some of the rows can be provided. This allows students to think through how the process proceeds from one step to the next. The important take-away is to make sure to model the behavior that is expected of students on the exam. Using this style of table can actually aid during instruction, as well as during assessment.