Lesson 4.4.3.1
4.4.3.1 Backus-Naur Form and syntax diagrams Quiz: AQA Computer Science, Unit 4
20 questions
In partnership with Revision Ninja
Lesson 4.4.3.1, Backus-Naur Form and syntax diagrams: 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 Backus-Naur Form (BNF) used for?
- Describing the syntax of a language with production rules
- Measuring processor speed
- Sorting lists of numbers
- Drawing pictures of the computer hardware used to run compiled programs
-
In BNF, what does the symbol ::= mean?
- Is an integer division
- Is greater than or equal to the number of rules in the grammar
- Is defined as, or can be replaced by
- Is a comment
-
In BNF, what do angle brackets such as <digit> enclose?
- Numbers only
- Final output characters only
- Comments that the compiler ignores when it builds the final output file
- Non-terminal symbols that can be replaced by further rules
-
What is a syntax diagram?
- A graphical representation of the syntax rules of a language
- A map of network routes
- A chart of program running times
- A diagram of computer hardware
-
Why can BNF represent some languages that regular expressions cannot?
- It can only handle numbers
- It is faster to process
- Its recursive rules allow nested structures of unbounded depth
- It uses more colours in its notation
-
With the rule <integer> ::= <digit> | <integer><digit> and <digit> from 0 to 9, which string is a valid integer?
- -5
- 12a
- an empty string
- 2024
-
Using the grammar <s> ::= 01 | 0<s>1, which string is generated?
- 0101
- 0110
- 1100
- 0011
-
In the grammar <s> ::= 01 | 0<s>1, how many production steps are needed to derive 000111?
- 4
- 2
- 6
- 3
-
Which production rule describes one or more letters?
- <word> ::= <word>
- <word> ::= <letter> | <word><letter>
- <word> ::= 1
- <word> ::= <letter>+<letter>
-
With the rule <expr> ::= <number> | <expr>+<expr> and <number> any integer, which string is valid?
- +1
- 1+
- 1 2
- 1+2+3
-
What is a production rule in a grammar?
- A rule that deletes all non-terminals
- A rule that counts characters
- A rule that sorts all the symbols in a string into alphabetical order
- A rule that replaces a non-terminal by terminals and non-terminals
-
In the grammar <s> ::= 01 | 0<s>1, which string cannot be generated?
- 0110
- 01
- 000111
- 0011
-
What is a terminal symbol in BNF?
- A symbol that is always replaced by another rule and never appears in the output
- A symbol that marks the end of a file
- A symbol used only for comments
- A symbol that appears in the final strings and cannot be replaced further
-
A grammar generates the strings aabb, ab and so on from <s> ::= a<s>b | ab. Which string is generated?
- abab
- aabb
- ba
- aab
-
With <p> ::= a | b | a<p>a | b<p>b, which string is generated?
- aba
- abb
- aa
- ab
-
Which construct is most naturally specified in BNF rather than with a regular expression?
- A string of exactly four characters
- A fixed list of three colours
- A single optional minus sign
- Arithmetic expressions with nested brackets
-
What does it mean for a grammar to be ambiguous?
- The grammar has no production rules at all and therefore produces nothing
- Some string has more than one valid parse tree
- The grammar cannot generate any strings
- The grammar uses only terminals
-
How many characters does the string derived by applying 0<s>1 twice and then 01 contain, using <s> ::= 01 | 0<s>1?
- 6
- 4
- 8
- 5
-
A syntax diagram contains a loop that returns back before an exit. What does the loop represent?
- Repetition of an element that may occur several times
- An error that must be fixed
- A comment in the code
- A variable that is undefined
-
Which statement about BNF and regular expressions is correct?
- BNF and regular expressions are unrelated
- BNF can only describe finite languages
- Regular expressions can describe any language that BNF can describe
- BNF can describe every regular language and also some languages that regular expressions cannot
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
- Regular expressions Quiz · 4.4.2.3 · 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