Skip to content

Course home

Representing algorithms

Representing algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
Question 62

Develop an algorithm, using either pseudo-code or a flowchart, that:

  • initialises a variable called validAccess to False
  • sets the variable validAccess to True if the string contained in the variable tokenID is exactly 3 characters in length, begins with a lowercase 'k', has an uppercase 'A' as its second character, and has a single numeric digit as its third character

Examples:

  • If the value of tokenID is "kA7" or "kA0", then validAccess should be True
  • If the value of tokenID is "KA7", "ka7", "kA77", or "kAB", then validAccess should be False

You may wish to use the following in your answer:

  • The subroutine isDigit(ch) which returns True if the character ch is a digit (e.g., "0" to "9") and False otherwise.
  • The function length(string) which returns the number of characters in a string.
[3]
Markscheme

Representing algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Representing algorithms

208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank