Programming Logic and Design - Chapter 5

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

False

An accumulator is typically reset to 0 after it is output.

False - at least once

In a do-while loop, the loop body might not execute.

True

In most programming languages, you can provide a for loop with any step value.

increment

To change a variable by adding a constant value to it, frequently 1.

decrement

To change a variable by decreasing it by a constant value, frequently 1.

In a FOR statement, a loop control variable is initialized, tested, and ____

Altered/Changed

True

In a while loop, the loop body might not execute.

forcing

Overriding a data value by setting it to a specific, default value.

True

Selection and loop structures are similar in that the tested condition that begins either structure always has two possible outcomes.

False

Selection and loop structures differ in that selection structures only take action when a test condition is true.

False

A for statement body always executes at least one time.

loop control variable

A variable that determines whether a loop will continue.

GIGO

Acronym for garbage in, garbage out; it means that if input is incorrect, output is worthless.

counter

Any numeric variable used to count the number of times an event has occurred.

False

If you need to perform a task, evaluate a condition, and perform an additional task, you cannot use a structured loop.

False

In a loop, comparing the loop control variable using >= or <= is a mistake.

True

In a loop, neglecting to alter the loop control variable is a mistake.

True

In a loop, neglecting to initialize the loop control variable is a mistake.

True

In a structured loop, the loop-controlling evaluation provides the only entry to or exit from the structure.

True

One difference between selection and loop structures is that the structure-controlling evaluation is repeated in a loop structure.

True

The for statement provides you with three actions in one compact statement: initializing, testing, and altering a loop control variable.

True

The logic expressed by a do-while loop can always be expressed using a sequence and a while loop.

False

The number of times a loop executes always depends on a constant.

validate data

The process of ensuring that data items are meaningful and useful; is correct data types, fall within an acceptable range, or are reasonable.

False - initialized

To make a while loop execute correctly, a loop control variable must be set to 0 before entering the loop.

True

To make a while loop execute correctly, a loop control variable should be tested before entering the loop body.

True

To make a while loop execute correctly, the body of the loop must take some action that alters the value of the loop control variable.

inner loop

When loops are nested, the loop that is contained within the other loop.

indefinite loop

A loop for which the number of executions cannot be predicted when the program is written.

definite loop

A loop for which the number of repetitions is a predetermined value.

False

A loop is a structure that branches in two logical paths before continuing.

nested loop

A loop structure within another loop structure.

posttest loop

A loop that tests its controlling condition after each iteration, meaning that the loop body executes at least one time.

pretest loop

A loop that tests its controlling condition before each iteration, meaning that the loop body might never execute.

counted loop, or counter-controlled loop

A loop whose repetitions are managed by a counter; also called a counter-controlled loop.

step value

A number used to alter a loop control variable on each pass through a loop.

do-while loop

A posttest loop in which the body executes before the loop control variable is tested.

do-until loop

A posttest loop that iterates until its controlling condition is false.

summary report

A report that lists only totals, without individual detail records.

for statement or for loop

A statement that can be used to code definite loops; also called a for loop. The statement contains a loop control variable that it automatically initializes, evaluates, and alters.

Defensive programming

A technique in which programmers try to prepare for all possible errors before they occur.

accumulator

A variable used to gather or accumulate values.


Set pelajaran terkait

Computer Science Fundamental Unix

View Set

HRTM 344 - Professional Organization and Supervision

View Set

Paragraph Patterns- Sem 1 Topic Sentences

View Set

Online Health · Environmental Health and Safety · Study Guide

View Set