Deck 9: Control I - Expressions and Statements
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 9: Control I - Expressions and Statements
1
Bracketing keywords are used in the if statement to remove ambiguity.
True
2
Syntactic sugar is a language construct that is completely expressible in terms of other constructs.
True
3
An expression,in its pure mathematical form,produces side effects.
False
4
In normal order evaluation,each operation begins its evaluation before its operands are evaluated.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
If-expressions never have all of their subexpressions evaluated.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
Delayed evaluation is sometimes called strict evaluation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
To exit a loop completely,the continue statement is used.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
Lisp requires all expressions to be fully parenthesized.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
A language has referential transparency when its expressions produce no side effects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
If-operators are a special case of operators that delay evaluating their operands.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
All languages restrict expressions from producing side effects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Alan Turing introduced the guarded if statement.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Operators can be written in infix,postfix,or prefix notation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
If-then-else is an example of a binary operator.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
In the absence of side effects,normal order evaluation does not change the semantics of a program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
The do statement ensures that the code of a loop is executed at least once.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
In a case statement,no two listed cases may have the same value after conversion.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Functions are written in prefix form.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
A unary operator can take one or more operands.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
Most languages use a mix-fix form that distributes the syntax of an if-then-else operator throughout the expression.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Sequence operators are used to ____.
A) define a set of variables to declare
B) eliminate side effects
C) allow several expressions to be combined into a single expression and evaluated sequentially
D) specify the execution order of code blocks
A) define a set of variables to declare
B) eliminate side effects
C) allow several expressions to be combined into a single expression and evaluated sequentially
D) specify the execution order of code blocks
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
____ code is code for a function body that is inserted directly at the point where the function would be called.
A) Substitution
B) Control
C) Inline
D) Parameterized
A) Substitution
B) Control
C) Inline
D) Parameterized
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
A general form for a loop construct is given by Dijkstra's structure called the ____.
A) for loop
B) guarded if
C) guarded do
D) while loop
A) for loop
B) guarded if
C) guarded do
D) while loop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
The advantage of postfix and prefix forms for expressions is that ____.
A) they do not require parentheses to express the order in which operators are applied
B) they follow strict rules of operator precedence
C) they follow strict rules that define associativity of operators
D) they do not allow unary operators
A) they do not require parentheses to express the order in which operators are applied
B) they follow strict rules of operator precedence
C) they follow strict rules that define associativity of operators
D) they do not allow unary operators
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
The termination model resumes control at the exact point an exception is first raised after it is handled.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
Exception handling is an attempt to imitate in a programming language the features of a hardware interrupt or error trap.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
Arguments are specified for use with ____.
A) functions
B) unary operators
C) expressions
D) binary operators
A) functions
B) unary operators
C) expressions
D) binary operators
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
Evaluating all operands before applying operators is called ____ evaluation.
A) normal order
B) applicative order
C) delayed
D) short-circuit
A) normal order
B) applicative order
C) delayed
D) short-circuit
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A sentinel-based loop is often used in situations where a series of input values must be processed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
Ada uses a(n)____ for its if-statements.
A) enclosing keyword
B) bracketing keyword
C) closest nested first disambiguation
D) dynamic disambiguation rules
A) enclosing keyword
B) bracketing keyword
C) closest nested first disambiguation
D) dynamic disambiguation rules
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
In a function,the operands are viewed as ____.
A) operators
B) arguments
C) local variables
D) global variables
A) operators
B) arguments
C) local variables
D) global variables
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
A(n)____ is executed for its side effects and returns no value.
A) expression
B) statement
C) function
D) method
A) expression
B) statement
C) function
D) method
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
Synchronous errors occur in direct reaction to program execution.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
____ statements transfer control to and from sequences of statements.
A) Transfer
B) Relocation
C) Block
D) Control
A) Transfer
B) Relocation
C) Block
D) Control
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
____ states that any two expressions in a program that have the same value may be substituted for each other anywhere in the program.
A) Referential transparency
B) Normal order evaluation
C) Delayed evaluation
D) Mix-fix form
A) Referential transparency
B) Normal order evaluation
C) Delayed evaluation
D) Mix-fix form
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
In the guarded if statement,the ____ are the Boolean expressions.
A) guards
B) gatekeepers
C) testers
D) predictors
A) guards
B) gatekeepers
C) testers
D) predictors
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Exception handlers throw exceptions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
The most closely nested rule is used to disambiguate ____.
A) nonlocal variable references
B) parameter references
C) if statements
D) function calls
A) nonlocal variable references
B) parameter references
C) if statements
D) function calls
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
____ evaluation stops once the truth value of a Boolean expression is known.
A) Predictive
B) Short-circuit
C) Optimized
D) Applicative order
A) Predictive
B) Short-circuit
C) Optimized
D) Applicative order
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
An ambiguity in which it cannot be determined which if statement that should be associated with a single else statement is called the ____ problem.
A) dangling-else
B) ambiguous-else
C) nested-else
D) loose-else
A) dangling-else
B) ambiguous-else
C) nested-else
D) loose-else
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
____ errors can occur at any moment,not necessarily in response to program code execution.
A) Asynchronous
B) Synchronous
C) Unpredictable
D) Unhandled
A) Asynchronous
B) Synchronous
C) Unpredictable
D) Unhandled
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
If an exception is thrown and no handler is found in the block,control is passed to the next enclosing block in a process that is called ____ the exception.
A) transferring
B) redirecting
C) propagating
D) throwing
A) transferring
B) redirecting
C) propagating
D) throwing
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
In C++,exception handlers are associated with ____ blocks.
A) catch-release
B) throw-catch
C) try-catch
D) retry-handle
A) catch-release
B) throw-catch
C) try-catch
D) retry-handle
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
If a program crashes,it fails the ____ test.
A) efficiency
B) structured organization
C) graceful exit
D) robustness
A) efficiency
B) structured organization
C) graceful exit
D) robustness
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
When an error is thrown,a(n)____ is executed to recover normal execution.
A) recoverer
B) crash-prevention statement
C) exception handler
D) explicit control statement
A) recoverer
B) crash-prevention statement
C) exception handler
D) explicit control statement
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
If control resumes at the point where the exception was first raised,the ____ model is being used.
A) resumption
B) redemption
C) termination
D) recovery
A) resumption
B) redemption
C) termination
D) recovery
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Stack unwinding occurs when an exception is thrown and control is ____.
A) unable to resume
B) exited back in search of a handler
C) placed elsewhere on the stack
D) moved off the stack and onto the heap
A) unable to resume
B) exited back in search of a handler
C) placed elsewhere on the stack
D) moved off the stack and onto the heap
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
In C,the ____ statement skips the remainder of the loop body and resumes execution with the next evaluation of the control expression.
A) break
B) skip
C) update
D) continue
A) break
B) skip
C) update
D) continue
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The for-loop construct provides for a(n)____ expression,a test expression and an update expression.
A) initializer
B) prefix
C) functional
D) inferential
A) initializer
B) prefix
C) functional
D) inferential
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
____ are an example of implicit control mechanisms.
A) For-loops
B) Do-Loops
C) Exception handlers
D) Goto statements
A) For-loops
B) Do-Loops
C) Exception handlers
D) Goto statements
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck