HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A door lock asks for a password until the right one, Open, is typed…
HardComputer ScienceHigh School (9–10)Computer Science › Algorithms and Problem-SolvingNumericalcodingIGCSE

A door lock asks for a password until the right one, Open, is typed…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A door lock asks for a password until the right one, Open, is typed. It then outputs how many tries were needed.

  1. Describe a flowchart for this algorithm, shape by shape, with the shape name for each step.
  1. The inputs are pass, OPEN and Open. How many tries are output?
  1. Write the algorithm in pseudocode.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Flowchart symbols: terminator (START, STOP), process (rectangle), input/output (parallelogram), decision (diamond, two exits Yes and No), subroutine (rectangle with a line inside each end), flow line (arrow). A flow line back to an earlier shape makes a loop. Conditions are written precisely, such as Count > 10.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. The flowchart.

  1. Terminator: START.
  2. Process: Tries ← 0.
  3. Input/output: INPUT Password.
  4. Process: Tries ← Tries + 1.
  5. Decision: Password = "Open"? No: flow line back to step 3. Yes: go on.
  6. Input/output: OUTPUT Tries.
  7. Terminator: STOP.

Step 2. The inputs. pass is try 111, not equal. OPEN is try 222, not equal, because the capital letters differ. Open is try 333, equal. The output is 333.

Step 3. Pseudocode. The test comes after the input, so a REPEAT loop fits.

pseudocode
Tries ← 0
REPEAT
    INPUT Password
    Tries ← Tries + 1
UNTIL Password = "Open"
OUTPUT "Tries: ", Tries

Answer: (b) 333 tries.

Check. The loop body always runs at least once, which is right: the user must type at least one password.

Log in to save this for later
← All Problems
← A flowchart works like this. Start. Set Big to 0 and Loops to 0…A flowchart inputs two numbers, A and B… →
More onComputer Science › Algorithms and Problem-Solving

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. FlowchartsPlanning a Program: Life Cycle, Decomposition and Flowcharts

More on this topic

  1. This is the kind of long scenario question that ends Paper 2…Hard
  2. A delivery company adds a check digit to each parcel number…Medium
  3. Name the check in each case. Say whether it is validation or verification…Easy
A bubble sort is changed so that it sorts in descending order: the comparison becomes IF…Hard
  • A shop stores the colours of the ten bicycles in its window in an array Colours: red, blue, red…Medium
  • All problems on this topic →