That Blue Square Thing

This page includes tooltips. Mouse over them to get a brief explanation of what something means.
Tootips might not work so well on phones or tablets. Sorry.

AQA Computer Science GCSE

This page is up to date for the new AQA 8525 syllabus for the 2022 exam. Make sure you check the revision pages to see which topics will be on the 2022 exam.

Programming Exam Question - Password checker

This is a five mark paper 1 programming question. It was question 6 on the specimen exam paper.

I suggest trying to write an answer by hand first and then attempting to program your answer. Does it work? What did you get wrong?

The Question:

Write a Python program that inputs a password and checks if it is correct.

Your program should work as follows:

You should use meaningful variable name(s), correct syntax and indentation in your answer.

The answer grid contains vertical lines to help you indent your code accurately.

[5 marks]


You can uncover a set of hints below.

With a pencil and some paper. Really: try and do this by hand first. That way when you try it in Python the syntax errors will get picked up and you'll learn from your mistakes. Lots of people find writing code by hand difficult. The only way to learn is to do it.
This is a classic programming task that is referenced in the syllabus, so you should have done it or something like it. It's the second programming question on the exam paper, so it's fairly simple. Some things to note:
  • the first thing to do is to get the user to enter a value and store it in a variable - this is worth 1 mark by itself! I have a page about how to input (and output) values if you need it
  • you will need to use selection - if you construct this properly you'll get a mark even if your logic is wrong
  • there is a mark for outputting the two outputs - but you must spell the words correctly!
  • there's a mark for using a meaningful variable name even if you get the program very wrong indeed
  • you don't need to add anything to the program: no need for a title, fancy outputs or anything like that. Just do the things the question wants
I might get around to putting up a solution and a markgrid at some point, but I'm not going to do that yet. Some people might know where the markschemes are anyway. That's fine - but I'd try and do the task first
You don't need it. Just use a piece of paper and make sure your indents are clear

Suggested Test Data:

I'd suggest the following as simple tests:

Test type Test data Expected result
Normal data secret Welcome - this is the correct password
Normal data banana Not welcome - this is the wrong password
Normal data Secret Not welcome - the case is wrong, so the password is wrong. You could also try SECRET and other variations
Boundary data Not welcome - this is testing an empty string, which is always a good idea to test as odd things can happen

A note about copyright

The question text has been published openly on the web by AQA. That is copyrighted to them. The other words on this page are mine.

I'm using this here because the children I teach need to work on how they write exam answers - and are a cohort massively impacted by COVID. I think, given that the questions have been published openly, that there is a fair-use educational rationale for putting them up here.

Note that I'm not putting them in a book, selling them on the TES or gaining any advertising revenue or being paid in any other way for running this website. But I am aware that I'm in a copyright grey area. If that's a problem, contact me.