Tootips might not work so well on phones or tablets. Sorry.
AQA Computer Science GCSE
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:
- input a password and store it in a suitable variable
- if the password is equal to secret display the message Welcome
- if the password entered is not equal to secret display the message Not welcome
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]
Hints
You can uncover a set of hints below.
- 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
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 |
You could try and write a program that's a lot more complicated, forcing the use of standard password protocols – minimum length, capital letters, numbers, special characters etc... None of this is required for this exam question, but would make an excellent programming task.
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 the groups I published them for originally were cohorts 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, 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.