Chapter 5 Review Questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

The statements that appear between the While and the End While clauses are called the ________________.

Body of the loop

What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements?

Condition-Controlled

Which loop repeats a statement or set of statements as long as the Boolean expression is false?

Do-Until

Which of these are posttest loops?

Do-While and Do-Until

the ___ loop is the best choice when you want to perform a task until a condition is true

Do-until

In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.

False

It is not necessary to initialize accumulator variables.

False

The While loop gets its name from the way it works: While a condition is false, do some task.

False

The amount by which the counter variable is incremented in a For loop is known as what?

Step amount

Any loop that can be written as a Do-While loop can also be written as a While loop.

True

The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body.

True

The following statement decrements the variable x: set x = x - 1

True

Which pair of loops causes a statement or set of statements to repeat as long as a condition is true?

While and Do-While

A(n) ____ variable keeps a running total.

accumulator

A ______-controlled loop uses a true/false condition to control the number of times that it repeats.

condition

A _____ -controlled loop repeats a specific number of times.

count

The following is an example of what type of loop? For k = 7 To maxValue

count-controlled

A condition-controlled loop always repeats a specific number of times.

false

In a nested loop, the outer loop goes through all of its iterations for every single iteration of the inner loop.

false

In the For statement, you can only use positive integers as step values.

false

It is not possible to increment a counter variable by any value other than 1.

false

The While loop gets its name from the way it works: While a condition is false, do some task.

false

The While loop will never execute if its condition is true to start with.

false

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.

false

You cannot display the contents of the counter variable in the body of a loop.

false

Which loop is specifically designed to initialize test and increment a counter variable?

for

Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration?

for

the ___ statement is specifically designed to initialize, test, and increment a counter variable

for

A(n) ____ loop has no way of ending and repeats until the program is interrupted.

infinite

How many times will the following loop iterate? Set k = 1 While k < = 5 Display k End While

infinite?

the total number of ___ of a nested loop is the product of the number of iterations of all the loops

iterations or repetition

a structure that has a loop that is inside another loop is called a ___ loop

nested

an inner loop goes through all of its iterations for every single iteration of the ___ loop

outer

the Do-While loop is a ___ loop

post test

A ____ loop always executes at least once.

posttest

The Do-While loop is a ____ type of loop.

posttest

The For loop is a ____ type of loop.

pretest

The While loop is a ____ type of loop.

pretest

Which structure causes a statement or set of statements to execute repeatedly?

repetition

A loop that accumulates a total as it reads each number from a series is often said to keep a what?

running total

A(n) _____ is a special value that signals when there are no more items from a list of items to be processed. This value cannot be mistaken as an item from the list.

sentinel

In a count-controlled loop the counter performs _______ action(s).

three

A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.

true

A condition-controlled loop can be used to iterate the body of the loop a specific number of times.

true

In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop.

true

Modules can be called from statements in the body of any loop.

true

The While loop is a pretest loop.

true

The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.

true

The conditions that control a loop repetition are Boolean expressions.

true

You should not write code that modifies the contents of the counter variable in the body of a For loop.

true


Conjuntos de estudio relacionados

BSAT 382 Ch. 8, EXAM 2 Questions, BSAT 382 Ch. 6, BSAT 382 Chapter 6 questions, BSAT 382 ch 8, BSAT 382 Ch 8, Operations Management, BSAT 382 - Managing Quality, BSAT 382 Chapter 8 questions, Operations Management Exam 2, Operations Management Exam 2...

View Set

CIS 3030 Session 2-2 Quick check

View Set

Cost Accounting Chapter 5 & 6 Exam 2

View Set