Programming Logic And Design: Chapter 5

Unlock all answers in this set

Unlock answers (23)
question
Which structure causes a statement or set of statements to execute repeatedly? A ) Start Over B ) Sequence C ) Decision D ) Repetition E ) None of these
answer
Repetition
question
Which pair of loops causes a statement or set of statements to repeat as long as a condition is true? A ) While and Do-While B ) While and Do-Until C ) Do-While and Do-Until D ) Do-Until and For E ) Do-While and For
answer
While and Do-While
question
Which loop repeats a statement or set of statements as long as the Boolean expression is false? A ) Do-While B ) Do-Until C ) For D ) While E ) None of these
answer
Do-Until
question
The statements that appear between the While and the End While clauses are called the ________. A ) Statements B ) Loop C ) Body of the loop D ) Loop statements E ) While statements
answer
Body of the loop
question
Which of these are posttest loops? A ) While and Do-While B ) While and Do-Until C ) Do-While and Do-Until D ) Do-Until and For E ) Do-While and For
answer
Do-While and Do-Until
question
Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration? A ) Do-While B ) Do-Until C ) For D ) While E ) None of these
answer
For
question
The following is an example of what type of loop? For k = 7 To max Value A ) Count-controlled B ) Condition-controlled C ) While D ) Do-while E ) Do-until
answer
Count-controlled
question
The ________ represents a special value that marks the end of a list of values. A ) Sentinel B ) Stop C ) End D ) Any of these E ) None of these
answer
Sentinel
question
Which loop is specifically designed to initialize, test, and increment a counter variable? A ) Do-While B ) Do-Until C ) For D ) While E ) None of these
answer
For
question
How many times will the following loop iterate? For j = 1 To 5 Step 2 Display j End For A ) Three B ) Four C ) Five D ) No iterations E ) Infinite
answer
Three
question
How many times will the following loop iterate? Set k = 1 While k <= 5 Display k End While A ) Three B ) Two C ) Five D ) No iterations E ) Infinite Infinite
answer
Infinite
question
How many times will the following loo interate? Set k = 1 While k > 5 Display k End While A ) One B ) Two C ) Five D ) No iterations E ) Infinite
answer
No iterations
question
How many times will the following loop iterate? Set k = 1 Do Display k Set k = k + 1 Until k > 1 A ) One B ) Two C ) Three D ) No iterations E ) Infinite
answer
One
question
To ________ a variable means to decrease its value. A ) Negate B ) Increment C ) Initialize D ) Decrement E ) Reference
answer
Decrement
question
A loop that accumulates a total as it reads each number from a series is often said to keep a what? A ) Average B ) Maximum value C ) Running total D ) Accumulation E ) None of these
answer
Running total
question
The conditions that control a loop repetition are Boolean expressions.
answer
True
question
The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body.
answer
True
question
The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.
answer
True
question
In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.
answer
False
question
The While loop gets its name from the way it works: While a condition is false, do some task.
answer
False
question
A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
answer
True
question
A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.
answer
True
question
A posttest loop does not perform any iteration if the Boolean expression is false to begin with.
answer
False
question
Modules can be called from statements in the body of any loop.
answer
True
question
Any loop that can be written as a Do-While loop can also be written as a While loop.
answer
True
question
In the For statement, you can only use positive integers as step values.
answer
False
question
The While loop will never execute if its condition is true to start with.
answer
False