Deck 6: Repeating Instructions

Full screen (f)
exit full mode
Question
In order to use the MessageBox.Show( )method,you need to not only add a reference to the namespace which includes the class,but also add a using directive to the program statements.
Use Space or
up arrow
down arrow
to flip the card.
Question
s = num.Next(7);
The statement above produces seven random numbers.
Question
The sentinel value is used as the operand in the conditional expression for an indefinite loop.
Question
The while statement is the only type of loop construct that can be used to develop a sentinel-controlled loop.
Question
An advantage of sentinel-controlled loops is you do not need to know how many times the loop will be performed.
Question
The conditional expression is sometimes called the loop condition.
Question
int sum = 0;
int number = 1;
while (number < 100)
{
sum = sum + number;
}
The program statements above produce an infinite loop.
Question
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.
Question
Class diagrams show the data,method,and property members of a class.
Question
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.
Question
Iteration is a technique used where a method calls itself repeatedly until it arrives at the solution.
Question
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.
Question
Windows applications use an event-driven model to manage the interaction between the user and the GUI by handling the repetition for you.
Question
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.
Question
int sum = 0;
int number = 0;
while (number < 10)
{
sum = sum + number;
Console.WriteLine(sum);
}
The statement above prints the values of 0 through 9 on separate lines.
Question
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.
Question
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.
Question
To write a recursive solution,a base case needs to be identified.
Question
Using the break or continue statements with a loop violates the single entry and single exit guideline for developing a loop.
Question
A sentinel controlled loop is also called a flag-controlled loop.
Question
With the while loop,the body of the loop is ____.

A) always performed at least one time
B) performed as long as the conditional expression evaluates to true
C) must produce a boolean result
D) must be enclosed in curly braces
Question
A common problem associated with counter-controlled loops is not executing the loop for the last value.This type of problem is labeled a(n)____ error.

A) off-by-one
B) last-value
C) counter controlled
D) boundaries
Question
Without incrementing the counter used in the conditional expression with counter controlled loops,the loop would go on indefinitely.
Question
The do...while loop can be used to implement a counter-controlled,sentinel-controlled,or state-controlled loop.
Question
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
Looking above,if the loop body was changed from counter++;to counter += 5;,how many times would the loop body be executed?

A) 19
B) 20
C) 99
D) 100
Question
In C# curly braces must be added to surround all loop bodies.
Question
C# performs automatic garbage collection once the loop is finished and releases any variables declared as part of the loop.
Question
One of the major strengths of programming languages can be attributed to loops.
Question
An interpretation of the while statement is "while the condition is true,perform statement(s)".
Question
What is NOT required when a counter-controlled loop is created?

A) Initializing loop control variable on the outside of the loop.
B) Incrementing the loop control variable inside the loop.
C) A conditional expression involving the loop control variable.
D) Allowing the user to enter a value indicating the loop should stop.
Question
In order to write a recursive solution ____.

A) the simplest case should be determined
B) you must create an infinite loop
C) write the iterative solution first
D) the most complicated approach must be identified
Question
With nested loops,the outermost loop is always totally completed before the innermost loop is executed.
Question
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The most appropriate sentinel value that might be selected for month of the year is ____.

A) 0
B) 1
C) 6
D) 12
Question
Scope refers to the region in the program in which you can use the variable.
Question
Which of the following is an advantage of a sentinel-controlled loop?

A) The number of iterations does not have to be known.
B) An extreme or dummy value can be entered.
C) The loop is always performed at least one time.
D) It could be used with the while form of the loop.
Question
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The last value printed with the above program segment is ____.

A) 0
B) 1
C) 99
D) 100
Question
A restriction on using the foreach statement is that you cannot change values in the collection.The access to the elements is read-only.
Question
A state-controlled loop should be designed when you know the number of times the statements must be executed.
Question
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The first value printed with the program segment above is ____.

A) 0
B) 1
C) 99
D) 100
Question
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
A method that calls itself repeatedly until it arrives at the solution is a(n)____method.

A) static
B) recursive
C) iterative
D) instance
Question
A flag-controlled loop is also called a ____.

A) sentinel-controlled loop
B) counter-controlled loop
C) state-controlled loop
D) posttest form loop
Question
for (int outer = 0; outer < 2; outer++)
{
for (int inner = 0; inner < 3; inner++)
{
Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner);
}
}
How many lines will be printed for the above nested loop?

A) 2
B) 3
C) 5
D) 6
Question
Instead of requiring that a dummy value be entered after all values are processed,a ____-controlled loop initializes a variable on the outside of the loop and then evaluates the variable to see when it changes values.Its value is changed inside the loop body when the loop should exit.

A) counter
B) sentinel
C) state
D) change
Question
What is a requirement of the sentinel-controlled loop shared by counter-controlled loops?

A) The conditional expression must be set up prior to the loop.
B) A counter must be initialized on the outside of the loop.
C) A counter must be incremented inside the loop body.
D) The expression must evaluate to false in order for the loop to be executed.
Question
The loop control structure used to move through a collection (group of data items)that does not require you to increment a loop control variable or test the expression to determine when all data has been processed is the ____ statement.

A) while
B) for
C) do...while
D) foreach
Question
int inner; for (int outer = 0;outer < 3;outer++)
{
For (inner = 1;inner < 2;inner++)
Console.WriteLine("Outer: {0}\tInner: {1}",outer,inner);
}
The nested for statement above displays how many lines of output?

A) 2
B) 3
C) 5
D) 6
Question
During the last iteration through the nested loop,what numbers are printed?

A) Outer: 1 Inner: 2
B) Outer: 2 Inner 3
C) Outer: 3 Inner 0
D) Outer: 1 Inner 0
Question
int loopVariable = 0;
do
{
Console.WriteLine("Count = {0:}", ++loopVariable);
}while (loopVariable < 5);
How many times will be loop body be executed?

A) 0
B) 4
C) 5
D) 6
Question
for (int i = 0; i < 5; i++)
Console.Write(i + "\t");
The conditional expression used with the for statement ____.

A) must involve a counter
B) must evaluate to false in order for the loop body to be executed
C) is evaluates after the loop body is performed once
D) is written following the first semicolon
Question
An example for statement that has a compound initialization,compound test and compound update could be written as ____.

A) for (int r = 0; c = 5; r < 3 && c > 2; r++; c--)
B) for (int r = 0; c = 5; r < 3 ; c > 2; r++; c--)
C) for (int r = 0, c = 5; r < 3, c > 2; r++, c--)
D) for (int r = 0, c = 5; r < 3 && c > 2; r++, c--)
Question
int loopVariable = 0;
do
{
Console.WriteLine("Count = {0:}", ++loopVariable);
}while (loopVariable < 5);
What will be printed during the first iteration through the loop?

A) 0
B) 1
C) 10
D) none of the above
Question
int loopVariable = 0;
do
{
Console.WriteLine("Count = {0:}", ++loopVariable);
}while (loopVariable < 5);
How many times will be loop body be executed if the conditional expression is changed to (loopVariable == 5)?

A) 0
B) 4
C) 5
D) 6
Question
for (int i = 0; i < 5; i++)
Console.Write(i + "\t");
Given the code snippet above,how many times will the loop body be executed?

A) 4
B) 5
C) 6
D) 10
Question
Which of the following is NOT a keyword used to enable unconditional transfer of control to a different program statement?

A) continue
B) break
C) goto
D) while
Question
In order to use the MessageBox.Show( )method in your console application,you must ____.

A) enclose the method call in a body of a loop
B) add a reference to the System.Windows.Forms.dll.
C) add a using System.MessageBox directive
D) call on the method from within the WriteLine( ) or Write( ) methods
Question
You must tell the user what value to type to end the loop for ____.

A) counter-controlled loops
B) state-controlled loops
C) sentinel-controlled loops
D) any type of loop
Question
The only posttest loop structure available in C# is _____.

A) while
B) for
C) do...while
D) foreach
Question
The event-driven model used to create Windows applications ____.

A) uses a counter-controlled form of loop
B) uses a state-controlled form of loop
C) uses a sentinel-controlled form of loop
D) handles the repetition for you
Question
for (int i = 0;i < 10;i++) {
Console.WriteLine("counter " + i);
}
The variable i defined in the program segment above ____.

A) is out of scope when the loop terminates
B) creates an error because it is changed in the update portion
C) would have a value of 10 if it were printed on the outside of the loop
D) can be displayed prior to the loop program statements
Question
To "prime the read" with a loop,you place an input statement ____.

A) inside the loop body
B) before the loop body
C) after the loop body
D) as part of the loop conditional expression
Question
When you know the number of times the statements must be executed,create a(n)____________ loop.
Question
The _____________ method of the MessageBox class displays a predefined dialog box that can contain text,captions for the title bar,special buttons,and icons.
Question
A(n)____________ is a loop that has no provisions for termination.
Question
An option other than looping that can be used to repeat program statement is _____________.With this technique a method calls itself repeatedly until it arrives at the solution.
Question
The third programming construct repetition is also called ____________.
Question
A sentinel value is a(n)____________.It is a value that should not be processed.
Question
The for statement is a compact method of writing the loops that can be written using while;it packages together the ____________,test,and update all on one line.
Question
The ____________ statement is a pretest form of loop which is considered a specialized form of the while statement and is usually associated with counter-controlled types of loops;
Question
if (int.TryParse(inStringValue,out integerValue)== false)
Console.WriteLine("Invalid input - 0 recorded for end value");
If a character such as "b" is entered by the user and stored in inStringValue,TryParse( )
returns ____________.
Question
____________ loops are often used for inputting data when you do not know the exact number of values to be entered.
Question
The ___________ loop structure,which restricts access to read-only,is used to iterate or move through a collection,such as an array.
Question
Inside the for statement,when you place a semicolon after the parentheses without anything to the left of it,it indicates that no statement or a(n)____________ statement is associated with the initialize portion.
Question
The only posttest loop structure available with C# is the ____________ loop structure.
Question
With counter controlled loops,it is important to think through and ____________ to ensure they have been taken into consideration.You should always check the initial and final values of the loop control variable and verify that you get the expected results at the boundaries.
Question
When one of the program statement included within the body of a loop is another loop,a(n)____________ loop is created.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/75
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Repeating Instructions
1
In order to use the MessageBox.Show( )method,you need to not only add a reference to the namespace which includes the class,but also add a using directive to the program statements.
True
2
s = num.Next(7);
The statement above produces seven random numbers.
False
3
The sentinel value is used as the operand in the conditional expression for an indefinite loop.
True
4
The while statement is the only type of loop construct that can be used to develop a sentinel-controlled loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
5
An advantage of sentinel-controlled loops is you do not need to know how many times the loop will be performed.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
6
The conditional expression is sometimes called the loop condition.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
7
int sum = 0;
int number = 1;
while (number < 100)
{
sum = sum + number;
}
The program statements above produce an infinite loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
8
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
9
Class diagrams show the data,method,and property members of a class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
10
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
11
Iteration is a technique used where a method calls itself repeatedly until it arrives at the solution.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
12
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
13
Windows applications use an event-driven model to manage the interaction between the user and the GUI by handling the repetition for you.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
14
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
15
int sum = 0;
int number = 0;
while (number < 10)
{
sum = sum + number;
Console.WriteLine(sum);
}
The statement above prints the values of 0 through 9 on separate lines.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
16
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
17
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
18
To write a recursive solution,a base case needs to be identified.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
19
Using the break or continue statements with a loop violates the single entry and single exit guideline for developing a loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
20
A sentinel controlled loop is also called a flag-controlled loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
21
With the while loop,the body of the loop is ____.

A) always performed at least one time
B) performed as long as the conditional expression evaluates to true
C) must produce a boolean result
D) must be enclosed in curly braces
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
22
A common problem associated with counter-controlled loops is not executing the loop for the last value.This type of problem is labeled a(n)____ error.

A) off-by-one
B) last-value
C) counter controlled
D) boundaries
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
23
Without incrementing the counter used in the conditional expression with counter controlled loops,the loop would go on indefinitely.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
24
The do...while loop can be used to implement a counter-controlled,sentinel-controlled,or state-controlled loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
25
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
Looking above,if the loop body was changed from counter++;to counter += 5;,how many times would the loop body be executed?

A) 19
B) 20
C) 99
D) 100
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
26
In C# curly braces must be added to surround all loop bodies.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
27
C# performs automatic garbage collection once the loop is finished and releases any variables declared as part of the loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
28
One of the major strengths of programming languages can be attributed to loops.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
29
An interpretation of the while statement is "while the condition is true,perform statement(s)".
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
30
What is NOT required when a counter-controlled loop is created?

A) Initializing loop control variable on the outside of the loop.
B) Incrementing the loop control variable inside the loop.
C) A conditional expression involving the loop control variable.
D) Allowing the user to enter a value indicating the loop should stop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
31
In order to write a recursive solution ____.

A) the simplest case should be determined
B) you must create an infinite loop
C) write the iterative solution first
D) the most complicated approach must be identified
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
32
With nested loops,the outermost loop is always totally completed before the innermost loop is executed.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
33
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The most appropriate sentinel value that might be selected for month of the year is ____.

A) 0
B) 1
C) 6
D) 12
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
34
Scope refers to the region in the program in which you can use the variable.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following is an advantage of a sentinel-controlled loop?

A) The number of iterations does not have to be known.
B) An extreme or dummy value can be entered.
C) The loop is always performed at least one time.
D) It could be used with the while form of the loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
36
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The last value printed with the above program segment is ____.

A) 0
B) 1
C) 99
D) 100
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
37
A restriction on using the foreach statement is that you cannot change values in the collection.The access to the elements is read-only.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
38
A state-controlled loop should be designed when you know the number of times the statements must be executed.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
39
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The first value printed with the program segment above is ____.

A) 0
B) 1
C) 99
D) 100
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
40
int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
A method that calls itself repeatedly until it arrives at the solution is a(n)____method.

A) static
B) recursive
C) iterative
D) instance
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
41
A flag-controlled loop is also called a ____.

A) sentinel-controlled loop
B) counter-controlled loop
C) state-controlled loop
D) posttest form loop
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
42
for (int outer = 0; outer < 2; outer++)
{
for (int inner = 0; inner < 3; inner++)
{
Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner);
}
}
How many lines will be printed for the above nested loop?

A) 2
B) 3
C) 5
D) 6
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
43
Instead of requiring that a dummy value be entered after all values are processed,a ____-controlled loop initializes a variable on the outside of the loop and then evaluates the variable to see when it changes values.Its value is changed inside the loop body when the loop should exit.

A) counter
B) sentinel
C) state
D) change
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
44
What is a requirement of the sentinel-controlled loop shared by counter-controlled loops?

A) The conditional expression must be set up prior to the loop.
B) A counter must be initialized on the outside of the loop.
C) A counter must be incremented inside the loop body.
D) The expression must evaluate to false in order for the loop to be executed.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
45
The loop control structure used to move through a collection (group of data items)that does not require you to increment a loop control variable or test the expression to determine when all data has been processed is the ____ statement.

A) while
B) for
C) do...while
D) foreach
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
46
int inner; for (int outer = 0;outer < 3;outer++)
{
For (inner = 1;inner < 2;inner++)
Console.WriteLine("Outer: {0}\tInner: {1}",outer,inner);
}
The nested for statement above displays how many lines of output?

A) 2
B) 3
C) 5
D) 6
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
47
During the last iteration through the nested loop,what numbers are printed?

A) Outer: 1 Inner: 2
B) Outer: 2 Inner 3
C) Outer: 3 Inner 0
D) Outer: 1 Inner 0
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
48
int loopVariable = 0;
do
{
Console.WriteLine("Count = {0:}", ++loopVariable);
}while (loopVariable < 5);
How many times will be loop body be executed?

A) 0
B) 4
C) 5
D) 6
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
49
for (int i = 0; i < 5; i++)
Console.Write(i + "\t");
The conditional expression used with the for statement ____.

A) must involve a counter
B) must evaluate to false in order for the loop body to be executed
C) is evaluates after the loop body is performed once
D) is written following the first semicolon
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
50
An example for statement that has a compound initialization,compound test and compound update could be written as ____.

A) for (int r = 0; c = 5; r < 3 && c > 2; r++; c--)
B) for (int r = 0; c = 5; r < 3 ; c > 2; r++; c--)
C) for (int r = 0, c = 5; r < 3, c > 2; r++, c--)
D) for (int r = 0, c = 5; r < 3 && c > 2; r++, c--)
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
51
int loopVariable = 0;
do
{
Console.WriteLine("Count = {0:}", ++loopVariable);
}while (loopVariable < 5);
What will be printed during the first iteration through the loop?

A) 0
B) 1
C) 10
D) none of the above
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
52
int loopVariable = 0;
do
{
Console.WriteLine("Count = {0:}", ++loopVariable);
}while (loopVariable < 5);
How many times will be loop body be executed if the conditional expression is changed to (loopVariable == 5)?

A) 0
B) 4
C) 5
D) 6
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
53
for (int i = 0; i < 5; i++)
Console.Write(i + "\t");
Given the code snippet above,how many times will the loop body be executed?

A) 4
B) 5
C) 6
D) 10
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
54
Which of the following is NOT a keyword used to enable unconditional transfer of control to a different program statement?

A) continue
B) break
C) goto
D) while
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
55
In order to use the MessageBox.Show( )method in your console application,you must ____.

A) enclose the method call in a body of a loop
B) add a reference to the System.Windows.Forms.dll.
C) add a using System.MessageBox directive
D) call on the method from within the WriteLine( ) or Write( ) methods
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
56
You must tell the user what value to type to end the loop for ____.

A) counter-controlled loops
B) state-controlled loops
C) sentinel-controlled loops
D) any type of loop
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
57
The only posttest loop structure available in C# is _____.

A) while
B) for
C) do...while
D) foreach
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
58
The event-driven model used to create Windows applications ____.

A) uses a counter-controlled form of loop
B) uses a state-controlled form of loop
C) uses a sentinel-controlled form of loop
D) handles the repetition for you
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
59
for (int i = 0;i < 10;i++) {
Console.WriteLine("counter " + i);
}
The variable i defined in the program segment above ____.

A) is out of scope when the loop terminates
B) creates an error because it is changed in the update portion
C) would have a value of 10 if it were printed on the outside of the loop
D) can be displayed prior to the loop program statements
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
60
To "prime the read" with a loop,you place an input statement ____.

A) inside the loop body
B) before the loop body
C) after the loop body
D) as part of the loop conditional expression
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
61
When you know the number of times the statements must be executed,create a(n)____________ loop.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
62
The _____________ method of the MessageBox class displays a predefined dialog box that can contain text,captions for the title bar,special buttons,and icons.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
63
A(n)____________ is a loop that has no provisions for termination.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
64
An option other than looping that can be used to repeat program statement is _____________.With this technique a method calls itself repeatedly until it arrives at the solution.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
65
The third programming construct repetition is also called ____________.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
66
A sentinel value is a(n)____________.It is a value that should not be processed.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
67
The for statement is a compact method of writing the loops that can be written using while;it packages together the ____________,test,and update all on one line.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
68
The ____________ statement is a pretest form of loop which is considered a specialized form of the while statement and is usually associated with counter-controlled types of loops;
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
69
if (int.TryParse(inStringValue,out integerValue)== false)
Console.WriteLine("Invalid input - 0 recorded for end value");
If a character such as "b" is entered by the user and stored in inStringValue,TryParse( )
returns ____________.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
70
____________ loops are often used for inputting data when you do not know the exact number of values to be entered.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
71
The ___________ loop structure,which restricts access to read-only,is used to iterate or move through a collection,such as an array.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
72
Inside the for statement,when you place a semicolon after the parentheses without anything to the left of it,it indicates that no statement or a(n)____________ statement is associated with the initialize portion.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
73
The only posttest loop structure available with C# is the ____________ loop structure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
74
With counter controlled loops,it is important to think through and ____________ to ensure they have been taken into consideration.You should always check the initial and final values of the loop control variable and verify that you get the expected results at the boundaries.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
75
When one of the program statement included within the body of a loop is another loop,a(n)____________ loop is created.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 75 flashcards in this deck.