Deck 10: Compilers and Language Translation

Full screen (f)
exit full mode
Question
The code a compiler produces should be efficient and concise.
Use Space or
up arrow
down arrow
to flip the card.
Question
If a parser cannot produce a parse tree for a high-level language statement, then that statement is not correctly formed.
Question
The goal symbol is the highest-level nonterminal.
Question
A lexical analyzer is more commonly known as a scanner.
Question
The output of a scanner is a list of all the tokens contained in a high-level language statement, as well as the classification number of each token found.
Question
Performing local optimization is much more difficult than performing global optimization.
Question
One of the possible local optimizations is eliminating unnecessary operations.
Question
A high-level language statement is translated into a single machine language instruction.
Question
Nonterminals must appear on the left-hand side of one or more BNF rules.
Question
The right-hand side of a BNF rule is the name of a single grammatical category.
Question
In addition to building tokens, a scanner must classify them by type.
Question
Parsing is the first phase of the compilation process.
Question
All high-level programming language statements are translated into machine language code, whether or not they are semantically correct.
Question
The single goal of compilers is correctness.
Question
A grammar that allows the construction of two or more distinct parse trees for the same statement is called a recursive grammar.
Question
The BNF language's syntax is specified as a series of grammars.
Question
High-level languages must be translated into machine language before they can be executed.
Question
The input to a scanner is the machine language statement from the source program.
Question
The output of a parser is either a parse tree or an error message.
Question
On-line debuggers help programmers locate and correct errors in programs.
Question
In BNF, the ____ is used to separate two alternative definitions of a nonterminal.

A) forward slash
B) vertical bar
C) backward slash
D) asterisk
Question
In the ____ phase, the compiler examines the individual characters in the source program and groups them into tokens.

A) semantic analysis and code generation
B) parsing
C) lexical analysis
D) code optimization
Question
Grammars for high-level languages like C++ or Java are very large.
Question
A(n) ____ definition defines a nonterminal symbol in terms of itself.

A) ambiguous
B) recursive
C) local
D) global
Question
If a parser can convert the sequence of tokens into the goal symbol, then the sequence is an invalid statement.
Question
The English-language sentence, "The orange artichoke flew through the elephant" is syntactically incorrect, but semantically meaningful.
Question
A ____ is a data structure that stores information about a nonterminal, such as the actual name of the object and its data type.

A) rule
B) production
C) parse tree
D) semantic record
Question
In ____ optimization, the compiler looks at large segments of the program to decide how to improve performance.

A) local
B) global
C) semantic
D) syntactical
Question
A high-level language program is called a(n) ____ program.

A) object
B) source
C) lexical
D) token
Question
A BNF rule is also known as a production.
Question
____ begins at the productions in the tree that are nearest to the original input tokens.

A) Code generation
B) Parsing
C) Lexical analysis
D) Semantic analysis
Question
____ is the ability to write highly optimized programs that contain no wasted time or unnecessary memory cells.

A) Conciseness
B) Ambiguity
C) Code-aware
D) Efficiency
Question
During the ____ phase, the sequence of tokens formed by the scanner is checked to see whether it is syntactically correct according to the rules of the programming language.

A) lexical analysis
B) parsing
C) code optimization
D) semantic analysis and code generation
Question
In the ____ phase, the compiler determines whether the machine language translation that it had produced can be made more efficient.

A) code optimization
B) parsing
C) lexical analysis
D) semantic analysis and code generation
Question
BNF metasymbols are symbols of BNF that are used to describe BNF symbols.
Question
The collection of all statements that can be successfully parsed is called the ____ defined by a grammar.

A) language
B) terminal
C) nonterminal
D) rule
Question
Following ____, the compiler makes a second pass over the parse tree to produce the code.

A) semantic analysis
B) lexical analysis
C) code optimization
D) code generation
Question
In BNF, a ____ is an intermediate grammatical category used to help explain and organize the language.

A) production
B) rule
C) terminal
D) nonterminal
Question
In the ____ phase, the compiler analyzes the meaning of the tokens making up a programming language statement and tries to understand the actions they perform.

A) semantic analysis and code generation
B) parsing
C) lexical analysis
D) code optimization
Question
During the compilation process, ____ is the next step after the code generation step.

A) semantic analysis
B) code optimization
C) lexical analysis
D) parsing
Question
A(n) ____ is a compiler embedded with a collection of supporting software.

A) debugger
B) reusable code library
C) visual development library
D) integrated development environment
Question
What is the format of a BNF rule?

A) left-hand side := right-hand side
B) left-hand side ::= "definition"
C) grammar = rule
D) grammar | rule
Question
____, the replacement of an arithmetic operation with a faster one is an example of a possible local optimization.

A) Strength reduction
B) Constant evaluation
C) Eliminating unnecessary operations
D) Parse tree construction
Question
____ parsing algorithms examine several tokens "down the road" to see what would happen if a certain choice was made.

A) Look-ahead
B) Token prediction
C) Down-the-road
D) Recursive
Question
Which factor plays the biggest role in code efficiency?

A) compilation process
B) code optimization
C) algorithm selected
D) code conciseness
Question
The ____ represents the empty nonterminal.

A) zero
B) null string
C) asterisk
D) vertical line
Question
In BNF, ____ are not defined any further by other rules of the grammar.

A) terminals
B) nonterminals
C) constants
D) variables
Question
The ____ of a statement is its grammatical structure.

A) syntax
B) semantics
C) correctness
D) grammar
Question
The collection of all statements that can be successfully parsed is called the ____ defined by a grammar.

A) language
B) syntax
C) grammar
D) rule
Question
A ____ shows how individual tokens can be grouped into predefined grammatical categories until the desired goal is reached.

A) parse tree
B) scanner
C) parser
D) compiler
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 10: Compilers and Language Translation
1
The code a compiler produces should be efficient and concise.
True
2
If a parser cannot produce a parse tree for a high-level language statement, then that statement is not correctly formed.
True
3
The goal symbol is the highest-level nonterminal.
True
4
A lexical analyzer is more commonly known as a scanner.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
The output of a scanner is a list of all the tokens contained in a high-level language statement, as well as the classification number of each token found.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
Performing local optimization is much more difficult than performing global optimization.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
One of the possible local optimizations is eliminating unnecessary operations.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
A high-level language statement is translated into a single machine language instruction.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Nonterminals must appear on the left-hand side of one or more BNF rules.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
The right-hand side of a BNF rule is the name of a single grammatical category.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
In addition to building tokens, a scanner must classify them by type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Parsing is the first phase of the compilation process.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
All high-level programming language statements are translated into machine language code, whether or not they are semantically correct.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The single goal of compilers is correctness.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A grammar that allows the construction of two or more distinct parse trees for the same statement is called a recursive grammar.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
The BNF language's syntax is specified as a series of grammars.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
High-level languages must be translated into machine language before they can be executed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
The input to a scanner is the machine language statement from the source program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
The output of a parser is either a parse tree or an error message.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
On-line debuggers help programmers locate and correct errors in programs.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
In BNF, the ____ is used to separate two alternative definitions of a nonterminal.

A) forward slash
B) vertical bar
C) backward slash
D) asterisk
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
In the ____ phase, the compiler examines the individual characters in the source program and groups them into tokens.

A) semantic analysis and code generation
B) parsing
C) lexical analysis
D) code optimization
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
Grammars for high-level languages like C++ or Java are very large.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
A(n) ____ definition defines a nonterminal symbol in terms of itself.

A) ambiguous
B) recursive
C) local
D) global
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
If a parser can convert the sequence of tokens into the goal symbol, then the sequence is an invalid statement.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The English-language sentence, "The orange artichoke flew through the elephant" is syntactically incorrect, but semantically meaningful.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
A ____ is a data structure that stores information about a nonterminal, such as the actual name of the object and its data type.

A) rule
B) production
C) parse tree
D) semantic record
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
In ____ optimization, the compiler looks at large segments of the program to decide how to improve performance.

A) local
B) global
C) semantic
D) syntactical
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A high-level language program is called a(n) ____ program.

A) object
B) source
C) lexical
D) token
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
A BNF rule is also known as a production.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
____ begins at the productions in the tree that are nearest to the original input tokens.

A) Code generation
B) Parsing
C) Lexical analysis
D) Semantic analysis
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
____ is the ability to write highly optimized programs that contain no wasted time or unnecessary memory cells.

A) Conciseness
B) Ambiguity
C) Code-aware
D) Efficiency
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
During the ____ phase, the sequence of tokens formed by the scanner is checked to see whether it is syntactically correct according to the rules of the programming language.

A) lexical analysis
B) parsing
C) code optimization
D) semantic analysis and code generation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
In the ____ phase, the compiler determines whether the machine language translation that it had produced can be made more efficient.

A) code optimization
B) parsing
C) lexical analysis
D) semantic analysis and code generation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
BNF metasymbols are symbols of BNF that are used to describe BNF symbols.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
The collection of all statements that can be successfully parsed is called the ____ defined by a grammar.

A) language
B) terminal
C) nonterminal
D) rule
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Following ____, the compiler makes a second pass over the parse tree to produce the code.

A) semantic analysis
B) lexical analysis
C) code optimization
D) code generation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
In BNF, a ____ is an intermediate grammatical category used to help explain and organize the language.

A) production
B) rule
C) terminal
D) nonterminal
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
In the ____ phase, the compiler analyzes the meaning of the tokens making up a programming language statement and tries to understand the actions they perform.

A) semantic analysis and code generation
B) parsing
C) lexical analysis
D) code optimization
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
During the compilation process, ____ is the next step after the code generation step.

A) semantic analysis
B) code optimization
C) lexical analysis
D) parsing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
A(n) ____ is a compiler embedded with a collection of supporting software.

A) debugger
B) reusable code library
C) visual development library
D) integrated development environment
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
What is the format of a BNF rule?

A) left-hand side := right-hand side
B) left-hand side ::= "definition"
C) grammar = rule
D) grammar | rule
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
____, the replacement of an arithmetic operation with a faster one is an example of a possible local optimization.

A) Strength reduction
B) Constant evaluation
C) Eliminating unnecessary operations
D) Parse tree construction
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
____ parsing algorithms examine several tokens "down the road" to see what would happen if a certain choice was made.

A) Look-ahead
B) Token prediction
C) Down-the-road
D) Recursive
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
Which factor plays the biggest role in code efficiency?

A) compilation process
B) code optimization
C) algorithm selected
D) code conciseness
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The ____ represents the empty nonterminal.

A) zero
B) null string
C) asterisk
D) vertical line
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
In BNF, ____ are not defined any further by other rules of the grammar.

A) terminals
B) nonterminals
C) constants
D) variables
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
The ____ of a statement is its grammatical structure.

A) syntax
B) semantics
C) correctness
D) grammar
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The collection of all statements that can be successfully parsed is called the ____ defined by a grammar.

A) language
B) syntax
C) grammar
D) rule
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
A ____ shows how individual tokens can be grouped into predefined grammatical categories until the desired goal is reached.

A) parse tree
B) scanner
C) parser
D) compiler
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.