Tackling Pseudocode/Flowchart Questions
Pseudocode
- To be able to tackle any pseudocode question at GCSE, it helps if you at least have a working knowledge of AQA’s pseudocode syntax (especially as they will only mark you against their syntax). Note that you will not get a copy of the syntax in the exam, so you really do need to know it.
- Similarly, you should know the difference between the 4 types of loop syntax they accept (the differences are explained in Control Flow):
FOR...ENDFOR
WHILE...ENDWHILE
DO...UNTIL
REPEAT...UNTIL
Tackling the question with pseudocode
- Firstly, read the question and ensure you know specifically what it is that they are asking you to do.
- Then, if it will help, add line-by-line “comments” to the space they give you (starting each line with a ‘#’), detailing the structure of your code. By doing this, not only will the examiner be able to see though your process and thus be able to understand what your aim is through you code, but your coding becomes nothing more than filling in the gaps. For example:
# Ask the user for their option
# If the option is not 1
# Multiply the option by 54
# Output the result to the console
# Else
# Output the number 678 to the console
# End the if statement
- Following this, check your comments against the requirements and make sure that you have covered everything asked for in the question.
- Then, if you are certain that you have covered everything, use AQA’s pseudocode syntax to fill in the code:
# Ask the user for their option
option <- USERINPUT
# If the option is not 1
IF option != 1 THEN
# Multiply the option by 54
result <- option * 54
# Output the result to the console
OUTPUT result
# Else
ELSE
# Output the number 678 to the console
OUTPUT 678
# End the if statement
ENDIF
- Make sure that you leave your “comments” in so that, when you come to check your code, you know what the function of each line is.
Flowcharts
- For many pseudocode questions, you also have the option of drawing a flowchart to solve the problem.
- This option is usually better if you cannot remember the AQA pseudocode syntax.
- For this however, you need to know the 4 different symbols for flowcharts:
- Just make sure that you write in each box what is happening (and that you use the right number of arrows for conditionals!)