Chapter Questions
What is a repetition structure?
What is a condition-controlled loop?
What is a count-controlled loop?
What is a loop iteration?
What is the difference between a pretest loop and a posttest loop?
Does the while loop test its condition before or after it performs an iteration?
Does the Do-While loop test its condition before or after it performs an iteration?
What is an infinite loop?
What is the difference between a Do-While loop and a Do-Until loop?
What is a counter variable?
What three actions do count-controlled loops typically perform using the counter variable?
When you increment a variable, what are you doing? When you decrement a variable, what are you doing?
Look at the following pseudocode. If it were a real program, what would it display?Declare Integer number = 5 Set number $=$ number +1 Display number
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer counterFor counter = 1 To 5Display counterEnd For
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer counterFor counter = 0 To 500 Step 100 Display counterEnd For
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer counter = 1Constant Integer MAX = 8While counter <= MAX Display counter Set counter = counter + 1End While
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer counter = 1Constant Integer MAX = 7While counter <= MAX Display counter Set counter = counter + 2End While
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer counterConstant Integer MIN = 1For counter = 5 To MIN Step -1 Display counterEnd For
A program that calculates the total of a series of numbers typically has what two elements?
What is an accumulator?
Should an accumulator be initialized to any specific value? Why or why not?
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer number1 = 10, number2 = 5Set number1 = number1 + number2Display number1Display number2
Look at the following pseudocode. If it were a real program, what would itdisplay?Declare Integer counter, total = 0For counter = 1 To 5 Set total = total + counterEnd ForDisplay total
What is a sentinel?
Why should you take care to choose a unique value as a sentinel?