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.
The 20 questions
-
What is a regular expression?
- A compact way of describing a set of strings
- A compiled program
- A hash function
- A type of sorting algorithm
-
What does the metacharacter * mean in a regular expression?
- Exactly one repetition, which is required once and never more
- Alternation
- Zero or more repetitions
- One or more repetitions
-
What does the metacharacter + mean in a regular expression?
- One or more repetitions
- Grouping
- Zero or more repetitions
- Optional
-
What does the metacharacter ? mean in a regular expression?
- Two repetitions of the preceding item, one after the other
- The start of a string
- Any single character
- Zero or one repetition, meaning optional
-
What does the metacharacter | mean in a regular expression?
- Alternation, meaning or
- Concatenation
- Grouping
- Repetition
-
Which set of strings does a(a|b)* describe?
- Strings of even length only
- Strings containing no a
- Strings beginning with a, followed by any number of a or b
- Strings containing no a at all and any number of b characters after it
-
Which string is matched by a(a|b)*?
- aba
- bba
- ba
- b
-
Which string is matched by the regular expression ab+?
- ba
- a
- bb
- abbb
-
Which string is matched by the regular expression colou?r?
- colouurr
- color
- colr
- colouur
-
Which string is matched by (01)*?
- 010
- 0110
- 1010
- 0101
-
Which string is matched by 0(0|1)*0?
- 0111
- 1001
- 0110
- 0101
-
Which regular expression matches one or more a followed by an optional b?
- a*b+
- a|b?
- (ab)+
- a+b?
-
Which string is matched by a(b|c)?
- ab
- a
- b
- abc
-
Regular expressions and finite state machines are what?
- Equivalent ways of defining a regular language
- Only used for graphics
- Methods of sorting lists
- Unrelated concepts
-
Which of these languages is regular?
- Balanced brackets of any depth
- Palindromes over the alphabet a and b
- The strings 0^n 1^n for n of at least 1
- All strings of 0s and 1s ending in 1
-
Is the language {0^n 1^n | n >= 1} regular, and why?
- Yes, because the language is finite
- No, an FSM would need to count an unbounded number of 0s
- Yes, because it has a regular expression
- No, because it contains the symbol 1
-
Which description gives a machine that accepts exactly the language of a(a|b)*?
- A start state that loops on b and an accepting state with a dead end on every input
- Two states with no transitions
- A start state with an a transition to an accepting state that loops on a and b
- An accepting start state that rejects a
-
Which regular expression matches binary strings containing at least one 1?
- 0*
- (0|1)*1(0|1)*
- 1+0+
- (0|1)*
-
Which string is matched by both a* and (a|b)+?
- ab
- b
- aa
- ba
-
Which example best illustrates the metacharacters used in a regular expression for string matching?
- Compiling to machine code
- Searching a binary tree
- Grouping with brackets, alternation with a bar, and repetition with star or plus
- Sorting with a bubble pass
Related quizzes
- Problem-solving and algorithms Quiz · 4.4.1.1 · 20 questions
- Abstraction Quiz · 4.4.1.3 · 20 questions
- Problem reduction and decomposition Quiz · 4.4.1.8 · 20 questions
- Composition Quiz · 4.4.1.10 · 20 questions
- Automation Quiz · 4.4.1.11 · 20 questions
- Finite state machines Quiz · 4.4.2.1 · 20 questions
- Backus-Naur Form and syntax diagrams Quiz · 4.4.3.1 · 20 questions
- Comparing algorithms Quiz · 4.4.4.1 · 20 questions
- Order of complexity Quiz · 4.4.4.3 · 20 questions
- Limits of computation and computable problems Quiz · 4.4.4.4 · 20 questions