Mid-Term Chapter 1-5 Flashcards
Define “Infinite Loop”
Continues to repeat until the program is interrupted
Define “Input Validation”
Process of inspecting data given to a program by the user and determining if it is valid
The while loop is especially useful for…
Validating input.
If invalid input is entered a loop can require the user reenter it as many times as necessary.
Define “Priming Read”
The read operation that takes place just before the loop.
It provides the first value for the loop to test. Subsequent values are obtained by the loop.
A “counter” is a variable that is regularly…
incremented or decremented each time a loop iterates
Sentinal controlled or sentinal value
Sentinel-controlled repetition is sometimes called indefinite repetition because it is not known in advance how many times the loop will be executed. It is a repetition procedure for solving a problem by using a sentinel value (also called a signal value, a dummy value or a flag value) to indicate “end of data entry”.
The do-while Loop is a ______ loop.
posttest loop, which means its expression is tested after each iteration.
What is the do-while format?
do
statement;
while (expression);
user-controlled loop
allows the user to decide the number of iterations (for example, again? Y/N
Use the do-while loop when you want the loop to run at least ____times
one time
The do-while loop is a good choice for repeating a _____.
menu
The for Loop is ideal for…
Performing a known number of iterations
The count-controlled (for Loop) must have what 3 elements?
- Initialize a counter variable to a starting value.
2. Test the counter variable by comparing it to a max value. When max reached, it terminates
Flowchart
diagram that shows the logical flow of a program
Pseudocode
cross between human language and a programming language
Ex
Get payroll data.
Calculate gross pay.
Display gross pay.
(provide more details even, Display: How many hours worked?
etc