mc study guide chapter 6
a sentinel controlled loop is also called a flag controlled loop
false
a state-controlled loop should be designed when you know the number of times the statements must be executed
false
if a numeric variable is being changed by a consistent amount with each iteration through the loop, the while statement is the best choice of loop constructs
false
in c# curly braces must be added to surround all loop bodies
false
s = num.Next(7); the statement above procures seven random numbers
false
with nested loops, the outermost loop is always totally completed before the innermost loop is executed
false
with while loops, if the conditional expression evaluates to true, the body of the loop is not performed; control transfers to the statements following the loop
false
you often need to do a "prime the read" for counter-controlled loops which means that you would input a value before going into the body of the loop
false
a restriction on using foreach statement is that you cannot change values in the collection. the access to the elements is read-only
true
an advantage of sentinel-controlled loops is you do not need to know how many times the loop will be performed
true
an interpretation of the while statement is "while the condition is true, perform statements"
true
c# performs automatic garbage collection once the loop is finished and releases any variables declared as part of the loop
true
the do... while statement is a posttest loop, which means that the conditional expression is tested before any of the statements in the body of the loop are performed
false
the while statement is the only type of loop construct that can be used to develop a sentinel-controlled loop
false
an off-by-one error is a common problem associated with counter-controlled loops where the loop body is performed one too many or one too few times
true
one of the major strengths of programming languages can be attributed to loops
true
scope refers to the region in the program in which you can use the variable
true
the conditional expression is sometimes called the loop condition
true
the do... while loop can be used to implement a counter-controlled, sentinel-controlled, or state controlled loop
true
the sentinel valuse is used as the operand in the conditional expression for an indefinite loop
true
unlike the sentinel-controlled loop, the variable used with a state-controlled loop differs from the variable used to store the data that is being processed
true
using the break or continue statements with a loop violates the single entry and single exit guideline for developing a loop
true
without incrementing the counter used in the conditional expression with counter controlled loops, the loop would go on indefinitely
true