Looping
C
How many lines will this program print? while True: print "hi" A. 0 B. 1 C. an infinite number of lines
B
How many lines will this program print? x = 10 while x > 0: print x x = x - 3 A. 3 B. 4 C. 5 D. 6
C
Which of the following best describes the purpose of a for loop? A. A for loop is for doing something an indeterminate number of times. B. A for loop is doing something an infinite number of times. C. A for loop is for doing something a fixed number of times. D. A for loop is for doing something three times.
A
Which of the following programs prints ten lines? A. for i in range(10): print "hi" B. for i = 1 to 10: print "hi" C. for i in 1 - 10: print "hi" D. for i from 0 to 9: print "hi"