Deck 6: Syntax
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 6: Syntax
1
In a regular expression,curly braces are used to indicate a range of characters.
False
2
Most modern languages are in a completely fixed format.
False
3
Derivation is the process that replaces left-hand sides by choices of right-hand sides appearing in prior rules.
True
4
Abstract syntax trees abstract the essential structure of the parse tree.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
Productions are in Backus-Naur form if they are given using only the metasymbols "<" and ">".
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
Reserved words,or keywords,are not considered to be a typical token category.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
In extended Backus-Naur form,square brackets [ ] indicate optional parts of the syntax.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
Backus-Naur forms are used to describe the syntax of programming languages such as Algol60.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Regular expressions can be used to describe tokens.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
The description of simple integer arithmetic expressions with addition and multiplication cannot be represented by a context-free grammar.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
The curly bracket { } notation used in extended Backus-Naur form stands for "at least one or more repetitions of."
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
The lexical structure of a programming language is the structure of its tokens,or words.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The start symbol is used to identify the start of the grammar.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
A recognizer is a program that accepts or rejects strings based on whether they have occurred before.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
White space is an example of a token delimiter.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
A grammar for which two distinct parse trees are possible for the same string is considered to be ambiguous.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
Words or tokens are called terminals,since they cannot be broken down further.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
The process of associating the semantics of a construct to its syntactic structure is called syntax-directed semantics.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
Ordinary syntax is sometimes called concrete syntax to distinguish it from abstract syntax.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
A left-recursive rule for an operation causes it to left-associate.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Recursive-descent parsers turn the nonterminals into a group of mutually recursive procedures whose actions are based on the right-hand side of the BNFs.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
Shift-reduce parsers shift tokens onto a stack before reducing strings to nonterminals.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
____ are symbols used to distinguish between parts of a rule.
A) Distinguishers
B) Identifiers
C) Metasymbols
D) Abstract characters
A) Distinguishers
B) Identifiers
C) Metasymbols
D) Abstract characters
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
In a regular expression,repetition is indicated by ____.
A) an exclamation mark
B) a vertical bar
C) a hyphen
D) an asterisk
A) an exclamation mark
B) a vertical bar
C) a hyphen
D) an asterisk
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
A language is considered to be ____ when format has no effect on the program structure (other than to satisfy the principle of longest substring).
A) open-format
B) free-format
C) loose-format
D) fixed format
A) open-format
B) free-format
C) loose-format
D) fixed format
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
Grammar rules are also called ____.
A) productions
B) compilations
C) instructions
D) documentation
A) productions
B) compilations
C) instructions
D) documentation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
____ are phrase structures that are broken down into further phrase structures.
A) Nonterminals
B) Complex grammars
C) Compressed structures
D) Terminals
A) Nonterminals
B) Complex grammars
C) Compressed structures
D) Terminals
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following is not considered to be a token category?
A) reserved word
B) identifier
C) literal
D) white space
A) reserved word
B) identifier
C) literal
D) white space
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
____ languages require all tokens to occur in prespecified locations on the page.
A) Free-format
B) Precise-format
C) Fixed-format
D) Specified-format
A) Free-format
B) Precise-format
C) Fixed-format
D) Specified-format
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
Predictive parsing allows tokens that begin optional parts of the syntax to also appear after the optional part.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
During its ____ phase,a translator collects sequences of characters from the input program and forms them into tokens.
A) parsing
B) analyzing
C) generating
D) scanning
A) parsing
B) analyzing
C) generating
D) scanning
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
The lexical structure of a programming language is the structure of its ____.
A) variables
B) tokens
C) comments
D) references
A) variables
B) tokens
C) comments
D) references
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
A context-free grammar consists of a series of ____.
A) grammar rules
B) positional rules
C) semantic rules
D) algebraic expressions
A) grammar rules
B) positional rules
C) semantic rules
D) algebraic expressions
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A conflict between syntax and semantics arises when languages require certain strings to be predefined identifiers rather than reserved words.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
____ have been given an initial meaning for all programs in the language but are capable of being redefined.
A) Predefined identifiers
B) Keywords
C) Global literals
D) Constants
A) Predefined identifiers
B) Keywords
C) Global literals
D) Constants
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
____ are descriptions of patterns of characters.
A) Syntax diagrams
B) Regular expressions
C) Canonical diagrams
D) Variable expressions
A) Syntax diagrams
B) Regular expressions
C) Canonical diagrams
D) Variable expressions
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The principle of ____ takes the longest possible string of nonblank characters into a single token.
A) greatest aggregate
B) maximized grouping
C) longest substring
D) multipass parsing
A) greatest aggregate
B) maximized grouping
C) longest substring
D) multipass parsing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
During the ____ phase,the translator processes the tokens,determining the program's syntactic structure.
A) generation
B) parsing
C) implementation
D) scanning
A) generation
B) parsing
C) implementation
D) scanning
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
A context-free grammar has a special nonterminal called the ____ symbol which stands for the entire top-level phrase being defined.
A) initial
B) start
C) forward
D) abstract
A) initial
B) start
C) forward
D) abstract
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
A bottom-up parser constructs derivations and parse trees from the leaves to the root.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
The use of a single token to direct a parse is called single-symbol ____.
A) interpretation
B) prediction
C) directives
D) lookahead
A) interpretation
B) prediction
C) directives
D) lookahead
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
The purpose of a(n)____ is to apply grammar rules to a source program and report syntax or lexical errors,without performing any additional analysis.
A) parsing shell
B) interpreter
C) verifying shells
D) reducing shells
A) parsing shell
B) interpreter
C) verifying shells
D) reducing shells
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
____ automatically translate a BNF description into a parser.
A) Shift-reduce parsers
B) Scanners
C) Parser generators
D) Syntax generators
A) Shift-reduce parsers
B) Scanners
C) Parser generators
D) Syntax generators
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
A grammar is considered to be context-free if ____.
A) each terminal can be replaced by any right-hand side choice, no matter where it appears
B) each nonterminal can be replaced by any right-hand side choice, no matter where it appears
C) context strings appear on the left-hand sides of grammar rules
D) the grammar also expresses the semantics of the language
A) each terminal can be replaced by any right-hand side choice, no matter where it appears
B) each nonterminal can be replaced by any right-hand side choice, no matter where it appears
C) context strings appear on the left-hand sides of grammar rules
D) the grammar also expresses the semantics of the language
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
A ____ is the standard graphical depiction of syntax-directed semantics.
A) flow chart
B) UML diagram
C) chained list
D) parse tree
A) flow chart
B) UML diagram
C) chained list
D) parse tree
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
A parser that commits itself to a particular action based only on a lookahead is called a(n)____ parser.
A) foresight
B) insightful
C) predictive
D) exhaustive
A) foresight
B) insightful
C) predictive
D) exhaustive
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
The simplest form of a parser is a(n)____.
A) recognizer
B) translator
C) compiler
D) interpreter
A) recognizer
B) translator
C) compiler
D) interpreter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
A requirement that a sentence must start with a capitalized letter is an example of a ____.
A) terminal
B) nonterminal
C) grammar rule
D) positional property
A) terminal
B) nonterminal
C) grammar rule
D) positional property
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
A ____ rule must be stated to overcome ambiguous grammars.
A) clarifying
B) disambiguating
C) specifying
D) overriding
A) clarifying
B) disambiguating
C) specifying
D) overriding
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The processing of white space is generally handled by a ____.
A) parser
B) scanner
C) predictive parser
D) parser generator
A) parser
B) scanner
C) predictive parser
D) parser generator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck