Study resource
Programming common mistakes
Study Programming with curriculum-aligned Common Mistakes resources, practice links, and exam-focused support.
At a glance
common mistakes
Resource type
Topic
Programming
Common mistakes
Supplying the wrong number of arguments
Calling a subroutine with fewer or more values than the number of parameters in its interface.
Fix itCompare the call with the subroutine definition and supply one appropriate argument for each required parameter, in the correct order.
Displaying instead of returning
Using a display or print statement inside the subroutine when the calling routine needs to use the result.
Fix itUse return to send the value back to the calling routine, then assign or use the result there.
Confusing local variables with variables available everywhere
Assuming that a variable declared inside a subroutine can be used by the rest of the program.
Fix itRemember that a local variable is accessible only within the subroutine that declares it and exists only while that subroutine is executing.
Confusing where a variable is defined with what data it stores
Assuming that a variable is local or global because it stores a particular type of data, such as text or a number.
Fix itClassify a variable by its scope and definition location. A local or global variable can store different kinds of data.
Confusing a stack frame with the whole stack
Saying that the stack frame stores information for every subroutine call in the program.
Fix itA stack frame belongs to one particular active call. Several frames may exist on the stack at the same time, with each one storing its own return address, parameters and local variables.
Missing or ineffective base case
Writing a recursive call without a condition that stops the calls, or using a condition that can never be reached.
Fix itIdentify the simplest input first, use it as the base case, and ensure each general-case call changes the input towards that case.
Related topics
