CH 4 Flashcards
T/F | Reducing duplication of code is one of the advantages of using a loop structure.
T
T/F | A good way to repeatedly perform an operation is to write the statements for the task once and then place the statements in a loop that will repeat as many times as necessary.
T
T/F | In Python, an infinite loop usually occurs when the computer accesses the wrong memory address.
F
Both of the following for clauses would generate the same number of loop iterations.
for num in range(4):
for num in range(1, 5):
T
What are the values that the variable num contains through the iterations of the following for loop?
for num in range(2, 9, 2):
2, 4, 6, 8
a variable used to keep a running total is called
accumulator
When will the following loop terminate?
while keep_on_going != 999 :
(A) When keep_on_going refers to a value less than 999
(B) When keep_on_going refers to a value greater than 999
(C) When keep_on_going refers to a value that is an integer
(D) When keep_on_going refers to a value not equal to 999
(E) When keep_on_going refers to a value equal to 999
(E) When keep_on_going refers to a value equal to 999