Font size
WorksheetsPDM - LS01 - Quiz 3 - Repetition
Total questions: 15
Worksheet time: 6mins
Below are the goal of repetition structure, except....
avoid duplicate code
allow set of statements to execute repeatedly
cut the time consuming
make the program larger
Below are the condition controlled loops except...
Do - Until Loop
For Loop
While Loop
Do - While Loop
Which one is the called pre-test loop?
Do - Until Loop
For Loop
While Loop
Do - While Loop
Which one is the called post-test loop?
Do - Until Loop
For Loop
While Loop
Do - While Loop
Why Do - Until Loop & Do - While Loop is called post test loop?
Because they are counted loop
Because they needed to be in TRUE condition first
Because they are iterate at least one time
Because they needed to be in FALSE condition first
Which one is the count controlled loop?
Do - Until Loop
For Loop
While Loop
Do - While Loop
Sentinel is a special value that marks the end of a list of values, used as stop values for loops by ask the user how many times the loop should process in the beginning
TRUE
FALSE
When will this pseudocode stop?
until i == 1
until sum == 1
until N == input
until N == sum
Which one is called the increment in this pseudocode?
FOR i = 1 to N
Step 1
sum = sum + i
INPUT N
If N = 5, then what is the result of sum?
15
10
5
1
What is the sentinel in this pseudocode?
total mark = 0
mark = 1
mark != -1
total mark = mark + mark
What this pseudocode goal?
calcute the total of input marks entered by user until the user input 0 as mark
calcute the total of input marks entered by user until the user input all the mark
calcute the total of input marks entered by user until the user input 1 as mark
calcute the total of input marks entered by user until the user input -1 as mark
When will this pseudocode stop?
when user input the temperature != -999
when user input the temperature == -999
when user input the temperature > max
when user input the temperature < max
What will happen if the input temperature is 30? What happened next?
max = 30
total = 30
n = 1
average = 30
What is the output if the user input -1 then followed by -999? What will happened?
program error
print average = 0
print max = 0
print average = -1
print max = 0
