CIST 5031 Chapter 5

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

For

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

Do-While and Do-Until

Which of these are posttest loops?

While and Do-While

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

Running total

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

Three

How many times will the following loop iterate? For j = 1 To 5 Step 2 Display j End For

One

How many times will the following loop iterate? Set k = 1 Do Display k Set k = k + 1 Until k > 1

Infinite

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

No iterations

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

True

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

True

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

False

T/F — A posttest loop does not perform any iteration if the Boolean expression is false to begin with.

True

T/F — Any loop that can be written as a Do-While loop can also be written as a While loop.

False

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

decrement

To ________ a variable means to decrease its value.

Condition-controlled

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

For

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

False

T/F — In the For statement, you can only use positive integers as step values.

True

T/F — Modules can be called from statements in the body of any loop.

True

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

False

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

True

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

False

T/F — The While loop will never execute if its condition is true to start with.

True

T/F — The conditions that control a loop repetition are Boolean expressions.

Sentinel

The ________ represents a special value that marks the end of a list of values.

Step amount

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

count-controlled

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

Body of the loop

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

Do-Until

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

Repetition

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

Three

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


Kaugnay na mga set ng pag-aaral

09-03 Objects and Classes - class definition

View Set

Chapter 19 Forms of Business Organizations

View Set

15 周末我们去了天津 We went to Tianjin on the weekend

View Set

Geography Quiz 5: River (or stream) Systems

View Set

Pediatrics Test 1 practice questions

View Set