cmsc 331 final review quizzes 1-6 with
correct answers
T/F: In a parse tree, the operator with the lowest precedence must appear at the
| | | | | | | | | | | | | | |
lowest level of the tree. - CORRECT ANSWER✔✔-false
| | | | | | |
T/F: A BNF grammar is a generative mechanism. - CORRECT ANSWER✔✔-true
| | | | | | | | | |
T/F: The string 0b_0011_1111_0100_1110 belongs to the language specified by
| | | | | | | | | |
the following context-free grammar.
| | |
bininteger = "0" ("b" | "B") ["_"] bindigit { ["_"] bindigit }
| | | | | | | | | | |
bindigit = "0" | "1" - CORRECT ANSWER✔✔-true
| | | | | | |
T/F: The syntax analyzer verifies whether the tokens in a program are correct. -
| | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
lexical analyzer verifies whether tokens in a program are correct. the syntax
| | | | | | | | | | | |
analyzer verifies whether the program follows the correct grammar
| | | | | | | |
T/F: A grammar rule with both left recursion and right recursion always generates
| | | | | | | | | | | | |
the same parse tree. - CORRECT ANSWER✔✔-false
| | | | | |
,T/F: The Python and C++ languages implement the same associativity for
| | | | | | | | | | |
arithmetic operators. - CORRECT ANSWER✔✔-true
| | | |
T/F: A context-free grammar is a recognizer mechanism. - CORRECT ANSWER✔✔-
| | | | | | | | | |
true
T/F: BNF notation uses curly brackets, i.e. "{" and "}" symbols, to indicate zero or
| | | | | | | | | | | | | | |
more repetition of a symbol. - CORRECT ANSWER✔✔-false
| | | | | | |
EBNF uses "{" and "}" symbols, to indicate zero or more repetition of a symbol
| | | | | | | | | | | | | |
T/F: EBNF notation allows for a more concise grammar compared to an equivalent
| | | | | | | | | | | |
grammar in BNF notation. - CORRECT ANSWER✔✔-true
| | | | | | |
T/F: A rule with both left recursion and right recursion makes the grammar
| | | | | | | | | | | | |
ambiguous. - CORRECT ANSWER✔✔-true
| | |
T/F: In a BNF grammar a terminal symbol can be replaced by other symbols. -
| | | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
T/F: To implement left associativity for an operator we use left recursion. -
| | | | | | | | | | | | |
CORRECT ANSWER✔✔-true |
T/F: Denotational semantics are specified based on first order logic concepts. -
| | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
, T/F: There is only one non-terminal on the RHS of a rule in regular grammars. -
| | | | | | | | | | | | | | | |
CORRECT ANSWER✔✔-true |
T/F: Operational semantics present the meanings of language's constructs in the
| | | | | | | | | | |
form of smaller actions. - CORRECT ANSWER✔✔-true
| | | | | |
T/F: In a DFA, there can be more than one transition out from a state for an input.
| | | | | | | | | | | | | | | | |
- CORRECT ANSWER✔✔-false
| | |
T/F: In Axiomatic semantics, the strongest precondition is the one that is logically
| | | | | | | | | | | | |
implied by all other preconditions. - CORRECT ANSWER✔✔-false
| | | | | | |
T/F: The static semantics are mostly used to prove the correctness of programs. -
| | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
T/F: In regular grammars the epsilon symbol is a special non-terminal symbol
| | | | | | | | | | | |
which can be replaced with another symbol. - CORRECT ANSWER✔✔-false
| | | | | | | | |
it is a terminal. it cannot be replaced
| | | | | | |
In an attributes grammar an intrinsic attribute gets its value from ......
| | | | | | | | | | |
the children of the node
| | | |
the parent of the node
| | | |
the symbol table
| |
correct answers
T/F: In a parse tree, the operator with the lowest precedence must appear at the
| | | | | | | | | | | | | | |
lowest level of the tree. - CORRECT ANSWER✔✔-false
| | | | | | |
T/F: A BNF grammar is a generative mechanism. - CORRECT ANSWER✔✔-true
| | | | | | | | | |
T/F: The string 0b_0011_1111_0100_1110 belongs to the language specified by
| | | | | | | | | |
the following context-free grammar.
| | |
bininteger = "0" ("b" | "B") ["_"] bindigit { ["_"] bindigit }
| | | | | | | | | | |
bindigit = "0" | "1" - CORRECT ANSWER✔✔-true
| | | | | | |
T/F: The syntax analyzer verifies whether the tokens in a program are correct. -
| | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
lexical analyzer verifies whether tokens in a program are correct. the syntax
| | | | | | | | | | | |
analyzer verifies whether the program follows the correct grammar
| | | | | | | |
T/F: A grammar rule with both left recursion and right recursion always generates
| | | | | | | | | | | | |
the same parse tree. - CORRECT ANSWER✔✔-false
| | | | | |
,T/F: The Python and C++ languages implement the same associativity for
| | | | | | | | | | |
arithmetic operators. - CORRECT ANSWER✔✔-true
| | | |
T/F: A context-free grammar is a recognizer mechanism. - CORRECT ANSWER✔✔-
| | | | | | | | | |
true
T/F: BNF notation uses curly brackets, i.e. "{" and "}" symbols, to indicate zero or
| | | | | | | | | | | | | | |
more repetition of a symbol. - CORRECT ANSWER✔✔-false
| | | | | | |
EBNF uses "{" and "}" symbols, to indicate zero or more repetition of a symbol
| | | | | | | | | | | | | |
T/F: EBNF notation allows for a more concise grammar compared to an equivalent
| | | | | | | | | | | |
grammar in BNF notation. - CORRECT ANSWER✔✔-true
| | | | | | |
T/F: A rule with both left recursion and right recursion makes the grammar
| | | | | | | | | | | | |
ambiguous. - CORRECT ANSWER✔✔-true
| | |
T/F: In a BNF grammar a terminal symbol can be replaced by other symbols. -
| | | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
T/F: To implement left associativity for an operator we use left recursion. -
| | | | | | | | | | | | |
CORRECT ANSWER✔✔-true |
T/F: Denotational semantics are specified based on first order logic concepts. -
| | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
, T/F: There is only one non-terminal on the RHS of a rule in regular grammars. -
| | | | | | | | | | | | | | | |
CORRECT ANSWER✔✔-true |
T/F: Operational semantics present the meanings of language's constructs in the
| | | | | | | | | | |
form of smaller actions. - CORRECT ANSWER✔✔-true
| | | | | |
T/F: In a DFA, there can be more than one transition out from a state for an input.
| | | | | | | | | | | | | | | | |
- CORRECT ANSWER✔✔-false
| | |
T/F: In Axiomatic semantics, the strongest precondition is the one that is logically
| | | | | | | | | | | | |
implied by all other preconditions. - CORRECT ANSWER✔✔-false
| | | | | | |
T/F: The static semantics are mostly used to prove the correctness of programs. -
| | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
T/F: In regular grammars the epsilon symbol is a special non-terminal symbol
| | | | | | | | | | | |
which can be replaced with another symbol. - CORRECT ANSWER✔✔-false
| | | | | | | | |
it is a terminal. it cannot be replaced
| | | | | | |
In an attributes grammar an intrinsic attribute gets its value from ......
| | | | | | | | | | |
the children of the node
| | | |
the parent of the node
| | | |
the symbol table
| |