Chapter 6 - Repeating Instructions

Ace your homework & exams now with Quizwiz!

Off-By-One Error

A common programmer error in which a loop body is performed one too many or one too few times.

Array

A data structure that allows multiple values of the same data type to e stored under a single identifier.

Sentinel-Controlled Loop

A type of loop that is terminated by entering or encountering a sentinel value. Sentinel-controlled loops are often used for inputting data when you do not know the exact number of values to be entered.

Automatic Garbage Collection

Releasing space back to the operating system for reuse.

Recursion

Technique where a method calls itself repeatedly until it arrives at the solution.

Prime the Read

The act of inputting a value before going into the body of the loop.

Event-Driven Model

The model used by Windows and Web applications wherein, once the program is executed, it sits in a process loop waiting for an event, such as mouse clicks, to occur.

Pre-Test Loop

A conditional expression is tested before any of the statements in the body of the loop are performed. If the conditional expression evaluates to false, the statement(s) in the body of the loop is (are) never performed. The while and for statements are both pretest types of loops.

Infinite Loop

A loop that has no provisions for termination. Placing a semicolon at the end of the conditional expression can create an infinite loop situation.

Empty Bodied Loop

A loop that has no statements to be performed. Placing the semi-colon at the end of a conditional expression produces a loop that has no body or an empty bodied loop.

Flag-Controlled Loop

A loop that normally uses a Boolean variable in the conditional expression to control the loop. The variable is initialized to a value before entering the loop. When a condition changes, the variable is changed and then the next test of the conditional expression causes the loop to terminate.

Iteration Structure

A looping structure. Iteration enables you to identify and block together one or more statements to be repeated based on a predetermined condition. Also called repetition.

Sentinel Value

A value used to terminate a loop. It should be an extreme or dummy value that should not be processed, such as a negative value when only positive scores are to be processed.

State-Controlled Loop

A variable is initialized to some value before entering the loop. When a condition changes, the variable is changed. The next test of the conditional expression causes the loop to terminate. A state-controlled loop is similar to a sentinel-controlled loop and is sometimes called a flag-controlled loop.

Single Entry and Single Exit

Guidelines for providing only one way to enter and exit loops, selection statements, and methods. You violate the single entry and single exit guideline when you use break and continue statements within the loop body or when you write a method that has more than one return statement inside the method body.

Loop Condition

The conditional Expression or the logical condition to be tested. A loop condition is enclosed in parentheses and is similar to the expressions used for selection statements.

Counter-Controlled Loop

Used when the loop should be executed a specified number of times. With a counter-controlled loop, a variable simulating a counter is used as the loop control variable to keep track of the number of iterations.

Loop Control Variable

Used with a counter-controlled loop. A loop control variable is a variable that simulates a counter.


Related study sets

Wk 2- LE Amputation Sx & Post-Op Care

View Set

Lab 3-2: Configure Network Installation of Windows

View Set

medical emergencies ICP and burns

View Set