Lesson 4.4.2.3

4.4.2.3 Regular expressions Quiz: AQA Computer Science, Unit 4

20 questions

In partnership with Revision Ninja

Lesson 4.4.2.3, Regular expressions: 20 multiple choice questions for the AQA Computer Science (7517), Unit 4: Theory of computation, written with Revision Ninja.

Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.

Host this setFree Play

The 20 questions

  1. What is the main purpose of a regular expression?

    • Describing string sets
    • Storing relational data
    • Defining hardware logic
    • Executing compiled code
  2. What does the metacharacter * represent in a regular expression?

    • One or more
    • Exactly one
    • Zero or more
    • Zero or one
  3. What does the metacharacter + represent in a regular expression?

    • One or more
    • Exactly two
    • Zero or more
    • Zero or one
  4. What does the metacharacter ? represent in a regular expression?

    • Zero or more
    • One or more
    • Exactly one
    • Zero or one
  5. What does the metacharacter | mean in a regular expression?

    • Alternation, meaning or
    • Concatenation
    • Grouping
    • Repetition
  6. Which of these strings is matched by the regular expression a(a|b)*?

    • bb
    • ba
    • abb
    • bba
  7. Which string is matched by a(a|b)*?

    • aba
    • bba
    • ba
    • b
  8. Which string is matched by the regular expression ab+?

    • ba
    • a
    • bb
    • abbb
  9. Which string is matched by the regular expression colou?r?

    • colouurr
    • color
    • colr
    • colouur
  10. Which string is matched by (01)*?

    • 010
    • 0110
    • 1010
    • 0101
  11. Which string is matched by 0(0|1)*0?

    • 0111
    • 1001
    • 0110
    • 0101
  12. Which regular expression matches one or more a followed by an optional b?

    • a*b+
    • a|b?
    • (ab)+
    • a+b?
  13. Which string is matched by a(b|c)?

    • ab
    • a
    • b
    • abc
  14. What is the relationship between regular expressions and finite state machines?

    • Equivalent
    • Unrelated
    • Inverse
    • Hierarchical
  15. Which set of binary strings forms a regular language?

    • Matching nested brackets
    • Palindromic sequences
    • Equal 0s and 1s
    • Ending in 1
  16. Why is the language {0^n 1^n | n ≥ 1} not a regular language?

    • Has fixed length
    • Requires unbounded memory
    • Contains binary digits
    • Uses multiple symbols
  17. In a regular expression, what does the metacharacter * represent?

    • One or more
    • Zero or one
    • Zero or more
    • Exactly one
  18. Which regular expression matches binary strings containing at least one 1?

    • 0*
    • (0|1)*1(0|1)*
    • 1+0+
    • (0|1)*
  19. Which string is matched by both a* and (a|b)+?

    • ab
    • b
    • aa
    • ba
  20. In regular expressions, which metacharacter denotes alternation?

    • ?
    • +
    • |
    • *

All AQA Computer Science quizzes