Skip to content

Course home

Representing algorithms

Representing algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
Question 86

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

  • initialises a variable called activeSensor to False
  • sets the variable activeSensor to True if the string contained in the variable sensorID is exactly 3 characters in length, begins with a lowercase 'w', has a lowercase 's' as its second character, and has a single numeric digit as its third character

Examples:

  • If the value of sensorID is "ws0" or "ws7", then activeSensor should be True
  • If the value of sensorID is "Ws7", "ws", "ws7a", or "ws78", then activeSensor 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