CSCI 316: Quiz 8 - Statement-Level Control Structures
Sign in to Google
to save your progress.
Learn more
* Indicates required question
Email
*
Your email
Last Name
*
Your answer
First Name
*
Your answer
Student Id
*
Your answer
What is the primary purpose of statement-level control structures?
*
1 point
To specify the order of execution of statements
To improve compilation speed
To handle memory allocation
To define data types
To enforce type safety
Which characteristic most distinguishes selection statements from iterative statements?
*
1 point
Iterative statements always require counters
Iterative statements choose between alternatives
Selection statements choose among alternative execution paths
Selection statements may repeat execution
Selection statements require Boolean variables only
A two-way selection statement typically depends on which construct?
*
1 point
A counter variable
A Boolean control expression
A jump label
A loop invariant
An iterator object
What is a major design issue for selection statements in programming languages?
*
1 point
Whether single or multiple statements can be selected
Whether variables are stack- or heap-allocated
Whether selection is static or dynamic
Whether Boolean expressions are short-circuited
Whether selection is compiled or interpreted
Which language feature allows a selection statement to execute more than two alternatives?
*
1 point
if–else
unconditional branch
guarded command
iterator
switch or case statement
What problem can arise in switch statements if a break mechanism is omitted?
*
1 point
Dead code elimination
Stack overflow
Fall-through execution of subsequent cases
Infinite recursion
Type mismatch errors
Which design issue is specific to switch-style selection statements?
*
1 point
The type of the controlling expression
Whether Boolean operators are overloaded
The scope of loop variables
Whether iteration is entry- or exit-controlled
Whether recursion is permitted
In most imperative languages, what type is required for an if-statement condition?
*
1 point
Boolean
Character
Integer
Any scalar type
Floating-point
What distinguishes an iterative statement from a recursive construct?
*
1 point
Recursion cannot express repetition
Iteration always uses counters
Iteration requires function calls
Recursion must be tail-recursive
Iteration repeats a block without invoking subprograms
Which loop type tests its controlling expression before executing the loop body?
*
1 point
entry-controlled loop
do-while
posttest loop
exit-controlled loop
repeat-until
What is the main semantic difference between entry-controlled and exit-controlled loops?
*
1 point
Exit-controlled loops disallow Boolean expressions
Entry-controlled loops require iterators
Exit-controlled loops execute the body at least once
Entry-controlled loops require counters
Entry-controlled loops cannot terminate
Which loop construct is best suited for a known number of iterations?
*
1 point
guarded loop
while
do-while
repeat-until
for
A loop variable in a for statement is often called a:
*
1 point
iterator object
Boolean flag
guard
control variable
sentinel
What is a key design issue for counting loops?
*
1 point
Whether loop parameters are evaluated once or repeatedly
Whether they allow unconditional branching
Whether they require Boolean conditions
Whether they are implemented with stacks
Whether they support recursion
What may happen if the loop control variable is modified inside the loop body?
*
1 point
The loop becomes infinite by definition
The compiler rejects the program
The modification is ignored
The loop executes once only
The behavior becomes undefined or error-prone
Which construct provides a general mechanism for repetition using Boolean expressions?
*
1 point
goto
while
for
switch
foreach
What is the primary advantage of iterator-based loops?
*
1 point
They allow recursion elimination
They eliminate Boolean expressions
They enable dynamic typing
They hide traversal details from the programmer
They improve arithmetic precision
Which language feature commonly supports iterator-based loops?
*
1 point
Collections
Scalars
Pointers
Selectors
Labels
Which statement provides an explicit transfer of control?
*
1 point
while
if
foreach
for
goto
Why are unconditional branching statements generally discouraged?
*
1 point
They cannot be compiled efficiently
They prevent recursion
They complicate program readability and structure
They eliminate static scoping
They require extra memory
Which structured alternative reduces the need for goto?
*
1 point
Compound statements
Guarded commands
Dynamic typing
Nested selection and iteration
Recursion
What is a guarded command?
*
1 point
A type-checking mechanism
A loop with a counter
A selection construct with multiple Boolean checkpoints
An unconditional jump with conditions
A recursive selection statement
What advantage do guarded commands offer over traditional if-else chains?
*
1 point
Guaranteed single execution
Stronger type safety
Automatic loop termination
Clearer expression of nondeterminism
Faster execution
What happens if a loop’s Boolean control expression never becomes false?
*
1 point
The compiler inserts a break
The loop executes indefinitely
The loop executes once
The program terminates
A runtime exception occurs
Which design issue affects both selection and iteration constructs?
*
1 point
Scope of variables
Data type compatibility
Garbage collection
Memory allocation strategy
Exception propagation
Which construct allows repetition without explicit Boolean tests in the loop header?
*
1 point
do-while
guarded loop
foreach
for
while
What often determines when a for loop terminates?
*
1 point
A Boolean guard
A break statement only
An exception
A return statement
A counter reaching a boundary value
Which feature improves safety in loop design?
*
1 point
Using untyped Boolean expressions
Allowing multiple entry points
Eliminating exit conditions
Allowing arbitrary jumps
Restricting modification of loop control variables
What is a common restriction on switch statement case labels?
*
1 point
They must be unique at runtime only
They must be variables
They must be Boolean
They must be strings
They must be constant expressions
Which of the following best characterizes structured programming?
*
1 point
Use of sequence, selection, and iteration
Dependence on dynamic typing
Heavy use of goto
Reliance on recursion only
Absence of control statements
A copy of your responses will be emailed to the address you provided.
Submit
Clear form
Never submit passwords through Google Forms.
reCAPTCHA
Privacy
Terms
This content is neither created nor endorsed by Google. -
Terms of Service
-
Privacy Policy
Does this form look suspicious?
Report
Forms
Help and feedback