Chapter 5

Ace your homework & exams now with Quizwiz!

Nested Loop

a loop that is inside another loop; an inner loop goes through all of its iterations for every single iteration of an outer loop

Sentinel

a special value that marks the end of a list of values, used as stop values for loops; must be unique enough that it will not be mistaken as a regular value in the list

Running Total

a sum of numbers that accumulates with each iteration of a loop

Initialization

before loop begins, the counter variable is initialized to a starting variable

Repetition Structure (Loop)

causes a statement or set of statements to execute repeatedly; write the code for an operation once, and then place that code in a structure that makes the computer repeat it as many times as necessary

Do-Until Loop

do some task while a condition is false; the best choice when you want to perform a task until a condition is true but not all languages support this type of loop

Do-While Loop

do some task while some condition is true; the best choice when you always want the task to be performed at least once, regardless if the condition is true or false to start with

Infinite Loop

doesn't have a way of stopping; continues to repeat until the program is interrupted (should be avoided)

Iteration

each execution of the body of a loop

While Loop

has 2 parts: (1) a condition that is tested for a true or false value, and (2) a statement or set of statements that is repeated as long as the condition is true; ideal in situations where the condition might be false to start with

Test

loop tests the counter variable by comparing it to a maximum value; if the counter variable is <= the maximum value, the loop iterates; if the counter variable is > the maximum value, the program exits the loop

Posttest Lop

means it performs an iteration before testing its condition; so, the Do-While loop always performs at least one iteration, even if its condition is false to begin with.

Pretest Loop

means it tests its condition before performing an iteration; usually means you have to perform some steps prior to the loop to make sure that the loop executes at least once

Count-Controlled Loop

repeats a specific number of times; there is initialization, test, and increment expressions that control the loop

For Loop

specifically designed to initialize, test, and increment a counter variable; they can increment by more than one, count backwards by decrementing, or allow the user to control the number of interactions

Step Amount

the amount by which the counter variable is incremented in a For loop

Body of the Loop

the statements that appear on the lines between the While and End While clauses

Accumulator

the variable used to keep the running total

Increment

to do this means to increase a variables value; during each iteration, the loop increments the counter variable by adding one to it

Decrement

to do this to a variable means to decrease its value

Counter Variable

used by a count-controlled loop to store the number of iterations that it has performed

Condition-Controlled Loop

uses a true/false condition to control the number of times that it repeats


Related study sets

Strategic Management - All Practice Quizzes

View Set

Sociology Vocabulary Chapter 1, Section 1

View Set

Social Studies Chapter 2 lesson 1 and lesson 2

View Set

Ch. 34: Obstetrics and Neonatal Care

View Set

Innovation and Entrepreneurship Ch 1 - 5

View Set