Computer Science: Ch. 5

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A flag variable

A Boolean variable used to control the execution of a while loop

Infinite loop

A loop that continues to execute endlessly

Decision maker

An expression in an if statement, which determines whether to execute the statement that follows it

True

True or false: It is possible that the body of a while loop may not execute at all.

True

True or false: The body of a do...while loop executes at least once.

False

True or false: The body of a while loop executes at least once.

False

True or false: The body of the do...while loop may not execute at all.

True

True or false: The body of the while loop may not execute at all.

True

True or false: The do...while loop is considered a conditional loop.

In a pretest loop, the loop condition is evaluated before executing the body of the loop. In a posttest loop, the loop condition is evaluated after executing the body of the loop. A posttest loop executes at least once, while a pretest loop may not execute at all.

What is the difference between a pretest loop and a posttest loop?

Fibonacci number

A number in the Fibonacci sequence

Nesting

A process that involves putting one control structure inside another

Loop control variable

A variable that controls the end of the loop

Counter-controlled while loop

A while loop that is used when you know how many items of data are to be read; the loop will continue until the condition designated by the counter is met or evaluates to false

End-of-file (EOF)-controlled while loop

A while loop that stops when it reaches the end of the input file

False

True or false: A do...while loop is called a pretest loop.

True

True or false: A loop is a control structure that causes certain statements to execute over and over.

True

True or false: A sentinel-controlled while loop is an event-controlled while loop whose termination depends on a special value.

True

True or false: Executing a break statement in the body of a loop immediately terminates the loop.

False

True or false: In a counter-controlled while loop, it is not necessary to initialize the loop control variable.

False

True or false: In an infinite while loop, the while expression (the decision maker) is initially false, but after the first iteration it is always true.

False

True or false: The logical expression controlling the do...while loop is evaluated before the loop is entered.

True

True or false: The logical expression controlling the while loop is evaluated before the loop is entered.

True

True or false: The while loop is considered a conditional loop.

True

True or false: To read data from a file of an unspecified length, an EOF-controlled loop is a good choice.

False

True or false: When a while loop terminates, the control first goes back to the statement just before the while statement, and then the control goes to the statement immediately following the while loop.

For loop

Used to simplify the writing of counter-controlled loops; consists of an initialization statement, the loop condition, and the update statement

Flag-controlled while loop

Uses a Boolean variable to control the execution of the loop


संबंधित स्टडी सेट्स

Microeconomics: Technology, Production, and Costs

View Set

financial accounting book part 1

View Set

Muscles of the Shoulder & Back, with Pictures

View Set

Ch. 43: Management of Patients With Musculoskeletal Trauma

View Set