Programming Logic and Design: Chapter 5

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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

Body of the loop

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

Count-controlled

To ________ a variable means to decrease its value. A ) Negate B ) Increment C ) Initialize D ) Decrement E ) Reference

Decrement

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

Do-Until

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

Do-While and Do-Until

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

False

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

False

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

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

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

For

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

For

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

Infinite

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

No iterations

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

One

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

Repetition

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

Running total

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

Sentinel

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

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

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

True

Modules can be called from statements in the body of any 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 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

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

While and Do-While


Set pelajaran terkait

Chapter 8 Behavior in Organizations

View Set

PrepU Ch 32: Management of Patients with Immune Deficiency Disorders

View Set

Introduction to python programming Milestone 2

View Set

9.2 solution of Electrolytes and Nonelectrolytes

View Set