Chapter 6 Flashcards
1
Q
What is a iteration?
A
one execution of a loop
2
Q
What is a definitive loop?
A
- Also called counted loop
- Programmer knows exact number of iterations
3
Q
What is a indefinite loop?
A
- Programmer cannot predict number of iterations
- Event controlled loop
- Altered by user input
- Controlled by by the user
- Executed any number of times
4
Q
When do you need curly braces?
A
When you have more then one statement
5
Q
How is data validated?
A
- Ensuring a value falls within a specified range
- Use indefinite loops to validate input data
- If a user enters incorrect data, the loop repeats
6
Q
What is a priming read?
A
- Input retrieved before the loop is entered
- Within a loop, the last statement retrieves the next input value and checks the value before the next entrance of the loop
7
Q
When do you use the prefix or postfix incriment operator?
A
- Use only with variables
- Unary operators
- Use with one value
- Increase a variables value by 1
- No difference between operators (unless other operators are in the same expression)
8
Q
How does prefix++ calculate?
A
- The result is calculated and stored
- Then the variable is used
9
Q
How is postfix++ calculated?
A
- The variable is used
- Then the result is calculated and stored
10
Q
What is a pretest loop?
A
loop in which the variable is tested before the loop body executes
11
Q
What is a postest loop?
A
loop in which the variable is tested after the loop body executes