How should teachers respond to student questions when engaging in coding activities?

Steven Floyd

When students engage in coding activities they often ask many questions. The way the teacher responds to these questions can have a dramatic impact on the learning that takes place in the classroom.

When should teachers provide the students with direct answers and when should teachers guide students towards finding the answer themselves?

When guiding students toward independent solutions, how much information should the teacher provide?

In this article we explore a few scenarios to see the impact on teacher driven or student driven problem solving in coding activities.


A student asks the teacher to help them with their program. Their program is generating incorrect output and the teachers notices that the student has mixed up their “greater than” and “less than” symbols.

How should the teacher respond?

  • “You’ve mixed up your greater than and less than symbols, they need to be switched around.”
  • “I wonder if it has something to do with the greater than and less than symbols?”
  • “There must be something wrong with your conditional statements, take a closer look.”
  • “Looks like a logic error, get your elbow partner to take a look.”


A student has incorrectly placed a semi colon at the end of their conditional statement.

How should the teacher respond?

  • “You don’t need semi-colons at the end of conditional statements.”
  • “Double check to make sure that the if statement is executing properly, maybe add some output statements in there.”
  • “It must be the conditional statement, take a closer look.”

In these scenarios, the teacher has the opportunity to provide detailed information or to allow the student to discover the answer by re-evaluating their error independently. This is evident in the types of questions the teacher can ask.

When responding to student questions during coding, three things should be considered:

  • the type of question being asked
  • the learning goals of the lesson
  • the student themselves
  1. Consider the type of question that is being asked:
    Students might have questions related to the syntax of a command or in block coding, where a command is found. On the other hand, students might have questions related to the logic or algorithms involved in their program. Syntax questions can be answered quickly, whereas logic and algorithm questions depend on higher order thinking and may require more time from the teacher for a response.  Teachers should carefully consider what type of question is being asked. Students might also be able to respond to their own questions when prompted to reflect on it further.
  2. Consider the learning goals of the lesson:
    Imagine teaching a lesson where the goal is to have students develop an algorithm to determine whether a number is prime. It might be wise to quickly respond to student questions related to syntax errors so that they can focus on the problem-solving and algorithm design components of the lesson.
  3. Consider the student themselves:
    Each of our students has different needs and strengths. It might be wise to respond to students in a manner that will allow them to use their strengths to further develop their weaknesses.Example:Student: “The program runs but the answer makes no sense. It seems to be off by a factor of 100.”
    Teacher: “You’ve really been developing your tracing and debugging skills, why don’t you output values after each step of your rounding algorithm, maybe the problem is somewhere in there.”

Within my classes students have commented (good-naturedly) on the way I respond, or fail to respond, to questions. I’ve heard them say “You used to answer these questions for us” and “You answered the same question for him, why won’t you answer it for me.” If each coding lesson has an end goal in mind, then teachers can think carefully about how their responses to questions can help each student reach their own end goal.


Steven Floyd is a high school computer science and computer engineering teacher. He is a recipient of the 2017 Computer Science Teachers Association Award for Teaching Excellence in Computer Science ( Steven is also a co-host of TVO Teach Ontario’s Coding and Computational Thinking in the Classroom hub (https://www.teachontario.(