C++ 4
A while loop is somewhat limited, because the counter can only be incremented by one each time through the loop.
False
Even though a while loop may be contained within another while loop, an if statement may not be contained within a while loop.
False
In a nested loop, the outer loop executes faster than the inner loop.
False
The condition that is tested by a while loop must be enclosed in parentheses and terminated with a semicolon.
False
You may not use the break and continue statements within the same set of nested loops.
False
A while loop's body can contain multiple statements, as long as they are enclosed in braces.
True
In a nested loop, the break statement exits only the loop in which the break is found.
True
In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop.
True
A loop that is inside another loop is called:
a nested loop
The while loop has two important parts: an expression that is tested for a true or false value, and: *
a statement or block that is repeated as long as the expression is true
This statement causes a loop to terminate early.
break
This statement may be used to stop a loop's current iteration and begin the next one.
continue
This is a variable that is regularly incremented or decremented each time a loop iterates.
counter
Something withing a while loop must eventually cause the condition to become false, or a(n) _____ results
infinite loop
The while loop contains an expression that is tested for a true or false value, and a statement or block that is repeated as long as the expression
is true
This is a control structure that causes a statement or group of statements to repeat. *
loop
What will be the output of the following program? #include <iostream> using namespace std; int main( ) { int x = 0, y = 0; while (x < 4) { while (y < 3) { cout << "x = " << x << ". Y = " << y << endl; y++; } x++; } return = 0; }
x = 0. y = 0 x = 0. y = 1 x = 0. y = 2
What will the following loop display? int x = 0; while (x < 5) { cout << x << endl; x++; }
0 1 2 3 4
What is the output of the following code segment? n = 1; while (n <= 5) cout << n << ' '; n++;
1 1 1 1... [continues on forever]
In the following statement, which operator is used first? while (x++ < 10) cout << x << endl;
<