Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

2/14/2020 Python 3 Loops | Print - Quizizz

NAME :

CLASS :
Python 3 Loops
DATE :
140 Questions

1. In programming, what is iteration?

a) The repetition of steps within a program b) The order in which instructions are carried
out

c) A decision point in a program d) Testing a program to make sure it works

2. Why is iteration important?


a) It determines the order in which instructions b) It allows code to be simplified by removing
are carried out duplicated steps

c) It allows multiple paths through a program d) It ensures the code works correctly

3. Which two statements are used to implement iteration?

a) IF and WHILE b) ELSE and WHILE


c) FOR and WHILE d) IF and ELSE

4. Which type of loop iterates until instructed otherwise?


a) FOR loop b) A count-controlled loop

c) Repeat-once loop d) WHILE loop

5. The condition for a while loop to continue could include which


of the following?
a) While something equals something b) While something is greater than something

c) While something is True d) All of these

6. Which of the following symbols is used in Python to mean


"Equal to"?

a) = b) !=

c) == d) >=

7. Which of the following symbols is used in Python to mean "Not


equal to"?

a) == b) !=

c) <> d) ><

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 1/27
2/14/2020 Python 3 Loops | Print - Quizizz

8. Which of the following symbols is used in Python to mean


"Greater than or equal to"?

a) <= b) >>

c) >= d) =>

9.

a) 5 b) 4
4 3
3 2
2 1
1 0

c) 5 4 3 2 1 d) 4 3 2 1 0

10.

a) 5 b) 4
4 3
3 2
2 1
1 0

c) 5 4 3 2 1 d) 4 3 2 1 0

11.

a) 5 b) 5 4 3 2 1
4
3
2
1

c) 4 d) 4 3 2 1 0
3
2
1
0

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 2/27
2/14/2020 Python 3 Loops | Print - Quizizz

12.

a) 10 8 6 4 2 b) 10
8
6
4
2

c) 2 4 6 8 10 d) 10 9 8 7 6 5 4 3 2 1

13.

a) 12 9 6 3 0 b) 0 3 6 9 12

c) 9 6 3 0 d) 0 3 6 9

14.

a) 0 5 10 b) 5 10

c) 0 5 10 15 20 25 30 35 40 45 50 55 60 d) 12 7 2
65 70 75 80 85 90 95 100 105 110 115
120 125 130 135 140......etc

15.

a) 12 17 22 b) 5
c) 12 d) 5 10

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 3/27
2/14/2020 Python 3 Loops | Print - Quizizz

16.

a) Hello world! b) Hello world


c) Hello world! d) Error
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
......(repeated continuously)

17.

a) Hello world! b) Hello world!


Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)

c) Hello world! d) Error


break

18. Which of the following symbols is used in Python to mean


"Less than or equal to"?

a) << b) =<
c) <= d) !=

19.

a) Welcome b) Try again!


c) Error d) Enter your password

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 4/27
2/14/2020 Python 3 Loops | Print - Quizizz

20.

a) Hello world! b) Error


c) Hello world! d) Hello world!
False Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)

21. To repeat a fixed number of times use a


a) while loop b) for loop

c) if loop d) indentation

22. To repeat until a particular condition is true use

a) while loop b) for loop


c) if loop d) indentation

23. Data type that can only be true or false

a) int b) string
c) bool d) float

24. The character that must be at the end of the line for if, while,
for etc.

a) : b) ;
c) . d) ,

25. To solve a problem that requires the user to enter 10 numbers


would use what type of iteration?
a) While loop b) For loop

c) Variable d) Selection

26. In a Python program, what would be the iteration variable


(looping variable) in the FOR LOOP code?

a) n b) num

c) value d) i

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 5/27
2/14/2020 Python 3 Loops | Print - Quizizz

27. In a Python program, what would be the iteration variable


(looping variable) in the WHILE LOOP code?

a) w b) y

c) z d) i

28. In a Python program, what would be the starting value in the


FOR LOOP code?

a) 100 b) 10

c) 5 d) 20

29. In a Python program, what would be the starting value in the


FOR LOOP code?

a) 25 b) 4
c) 1 d) 0

30. In a Python program, what would be the starting value in the


WHILE LOOP code?

a) 20 b) 5

c) 2 d) 15

31. In a Python program, what would be the starting value in the


WHILE LOOP code?

a) 50 b) 3

c) 5 d) 10

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 6/27
2/14/2020 Python 3 Loops | Print - Quizizz

32. In a Python program, what would be the starting value in the


WHILE LOOP code?

a) 6 b) 1

c) 0 d) 10

33. In a Python program, what would be the ending value in the


WHILE LOOP code?

a) 0 b) 5

c) 2 d) 20

34. In a Python program, what would be the ending value in the


WHILE LOOP code?

a) 5 b) 50

c) 10 d) 3

35. In a Python program, what would be the increment value for


the looping variable in the WHILE LOOP code?

a) 5 b) 3

c) -5 d) 1

36. In a Python program, what would be the increment value for


the looping variable in the FOR LOOP code?

a) 15 b) 7

c) 10 d) 1

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 7/27
2/14/2020 Python 3 Loops | Print - Quizizz

37. In a Python program, what would be the ending value in the


FOR LOOP code?

a) 15 b) 1
c) 10 d) 100

38. In a Python program, what would be the increment value for


the looping variable in the FOR LOOP code?

a) 15 b) 1

c) 3 d) 5

39. In a Python program, what would be the increment value for


the looping variable in the WHILE LOOP code?

a) 30 b) 1

c) -3 d) -10

40. In a Python program, what would be the increment value for


the looping variable in the FOR LOOP code?

a) -100 b) 1

c) 5 d) -5

41. In a Python program, how many iterations(loops) will occur


for the FOR LOOP code?

a) 1 b) 10
c) 9 d) 8

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 8/27
2/14/2020 Python 3 Loops | Print - Quizizz

42. In a Python program, how many outputs will occur for the
snippet of code?

a) 15 b) 3

c) 6 d) 5

43. In a Python program, how many outputs will occur for the
snippet of code?

a) 5 b) 2
c) 8 d) 4

44. A loop repeated if the condition is true / false

a) While loop b) For loop

c) Repeat loop d) If...else

45. Loop executed a fixed number of times with a built-in-counter


(creating a counter variable is unnecessary).

a) While loop b) For loop


c) Repeat loop d) If...else

46. Consider the loop control structure in programming. Which


term describes a loop that continues repeating without a
terminating (ending) condition?

a) Conditional Loop b) Unlimited Loop


c) Sequence Loop d) Infinite Loop

47. What will print?

a) 1 b) 1
2 2
11 21

c) 1 d) 1
2 2
3 3
11 21

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 9/27
2/14/2020 Python 3 Loops | Print - Quizizz

48. What will print to the screen?

a) 0 b) 2

c) 3 d) 1

49. What will print to the screen in this code?

a) 18 b) -25
c) -10 d) -15

50. Which of the following can complete the code so that 6.0 prints
to the screen?

a) * 3 / 2 b) + 1

c) / 0.5 d) + 3 * (1/ 2)

51. Which of the following will print:

a) for i in range(1, 5): b) for i in range(1, 5):


print(str(i) * 5) print("i" * i)
c) for i in range(1, 6): d) for i in range(1, 6):
print("i" * i) print(str(i) * i)

52. What is the output from this code snippet?

a) 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 b) 0, 1, 1, 0, 1, 1, 0, 1, 1, 0

c) 0, 1, 1, 0, 1 d) 0, 1, 1, 1, 1, 1, 0, 1, 1, 0

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 10/27
2/14/2020 Python 3 Loops | Print - Quizizz

53. What is the output from this code snippet?

a) 3 b) 2

c) 1 d) 4

54. What should replace the two empty spaces in order to get the
output: -1, -0.5, 0.0 1.0, 2.0, 3.0, 3.5, 4.0

a) -6, 5 b) 6, -0.5

c) 5, 1.5 d) 6, 0.5

55. What is the output from this code snippet?

a) 5 b) 4

c) 3 d) 2

56.

a) 5 b) 6

c) 21 d) 36

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 11/27
2/14/2020 Python 3 Loops | Print - Quizizz

57.

a) 5 b) 6

c) 21 d) 36

58.

a) A b) B

c) C d) D

59. What will the following lines of code print?

a) A b) B
C

c) A d) Nothing, it will return an error.


C

60. What is another way of writing the following code?


Score = Score + 1

a) Score.add(1) b) score + 1

c) Score + Score d) Score += 1

61. Which statement will check to see if a is equal to b?

a) if a == b b) if a = b:
c) if a != b: d) if a == b:

62. What are the two main types of loops that we have learned
about in Python?

a) IF Function & Variables b) FOR and WHILE Loops

c) Forever and Fixed Loop d) Data Types and Numbers

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 12/27
2/14/2020 Python 3 Loops | Print - Quizizz

63. What type of loop is used when you know how many times you
want to repeat something?

a) A WHILE Loop b) An IF function

c) A FOR Loop d) A Variable

64. What type of loop is used when you DO NOT know how many
times you want to repeat something?

a) A WHILE Loop b) A Counter

c) A FOR Loop d) A Forever Loop

65. What would amount equal in this piece of code:

amount = 2 + 5 * 2

a) 12 b) 9

c) 14 d) 5

66. What will be printed after running this FOR loop:

for number in range(6):


print(number)

a) The number 6 b) The numbers 0 - 5

c) The number 5 d) The numbers 1 - 6

67. How many times does the following program print the word
‘computer’:

word= "computer"
for num in range(1,6):
print(word)

a) 5 b) 6

c) 1 d) 0

68. Look at the code below and identify which of the statements
below are true:

for loopCounter in range(10,101,10):


print(loopCounter)

a) Starts at 10, goes up to 100, increases by 10 b) Starts at 10, goes upto 101, increases by 10

c) Starts at 1, goes upto 100, increases by 1 d) Starts at 10, goes upto 10, increases by 10

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 13/27
2/14/2020 Python 3 Loops | Print - Quizizz

69.

a) 5 b) 4
4 3
3 2
2 1
1 0

c) 5 4 3 2 1 d) 4 3 2 1 0

70.

a) 5 b) 4
4 3
3 2
2 1
1 0

c) 5 4 3 2 1 d) 4 3 2 1 0

71.

a) 5 b) 5 4 3 2 1
4
3
2
1

c) 4 d) 4 3 2 1 0
3
2
1
0

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 14/27
2/14/2020 Python 3 Loops | Print - Quizizz

72.

a) 10 8 6 4 2 b) 10
8
6
4
2

c) 2 4 6 8 10 d) 10 9 8 7 6 5 4 3 2 1

73. A loop repeated if the condition is true / false

a) While loop b) For loop

c) Repeat loop d) If...else

74. What will print?

a) 1 b) 1
2 2
11 21

c) 1 d) 1
2 2
3 3
11 21

75. Which of the following means not equal to

a) == b) !=

c) > d) =

76. Why are arrows used in flowcharts

a) To show a statement is equal to another b) To allow the computer to run the program

c) To indicate a flow of direction d) To make them look nice

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 15/27
2/14/2020 Python 3 Loops | Print - Quizizz

77. What is the difference between a while-endwhile and do-while


loop

a) a do-while loop is harder to write b) a while-endwhile loop takes longer for the
computer to run

c) a do-while checks the condition at the end of d) a while-endwhile checks the condition at the
the loop end of the loop

78. Which of these? is an example of condition/decision in a while


loop?

a) Enter your name b) Increase count by 1


c) An if statement d) A boolean operator

79. Can a while loop contain an if statement (nested)

a) Yes b) No

80. Which of these is the python code for 'then'

a) > b) <

c) ∞ d) :

81.

a) 5 b) 4
4 3
3 2
2 1
1 0

c) 5 4 3 2 1 d) 4 3 2 1 0

82. In programming, what is iteration?

a) The repetition of steps within a program b) The order in which instructions are carried
out
c) A decision point in a program d) Testing a program to make sure it works

83. Which type of loop iterates until instructed otherwise?

a) FOR loop b) WHILE loop

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 16/27
2/14/2020 Python 3 Loops | Print - Quizizz

84. What will this display?

a) 0,1,2,3,4,5 b) 0,1,2,3,4

c) 1,2,3,4,5 d) Error

85. What is the variable in this for loop?

a) x b) (6)

c) for d) range

86. In programming, what is iteration?

a) The repetition of steps within a program b) The order in which instructions are carried
out

c) A decision point in a program d) Testing a program to make sure it works

87. Why is iteration important?

a) It determines the order in which instructions b) It allows code to be simplified by removing


are carried out duplicated steps

c) It allows multiple paths through a program d) It ensures the code works correctly

88. Which two statements are used to implement iteration?

a) IF and WHILE b) ELSE and WHILE

c) FOR and WHILE d) IF and ELSE

89. FOR loops are

a) loops which run an unknown number of times b) loops which run for a specific number of
times

c) the same as if statements d) not part of programming

90. WHILE loops are

a) loops which run an unknown number of times b) loops which run for a specific number of
times

c) the same as if statements d) not part of programming

91. A condition is

a) a statement that is either True or False b) a string

c) an integer d) a list

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 17/27
2/14/2020 Python 3 Loops | Print - Quizizz

92. The condition for a while loop to continue could include which
of the following?
a) While something equals something b) While something is greater than something

c) While something is True d) All of these

93. Which kind of loop would be used?


I need a program that will keep letting me add money to a
piggy bank until I get to £100.

a) FOR Loop b) WHILE Loop

94. Which kind of loop would be used?


I need a program that will keep letting me add a monthly
payment for 12 months.

a) FOR Loop b) WHILE Loop

95. Which kind of loop would be used?


I need a guessing game program that will let me keep
guessing until I get the right answer.

a) FOR Loop b) WHILE Loop

96. Which kind of loop would be used?


I need a revision program that will run through revision
questions 4 times.

a) FOR Loop b) WHILE Loop

97.

a) 192 b) 184

c) 150 d) 196

98.

a) 35 b) 39

c) 45 d) 44

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 18/27
2/14/2020 Python 3 Loops | Print - Quizizz

99.

a) 61121365681111 b) 61121365681111146

c) 61121365681111146186231 d) 61121365681111146186231281336

100. Data type that can only be true or false

a) int b) string

c) bool d) float

101.

a) 02468 b) 0246810

c) 13579 d) 0246

102. To repeat until a particular condition is true use

a) While Loop b) For Loop

c) If Loop d) indentation

103. Which of the following symbols is used in Python to


mean"Less than or equal to"?

a) << b) =<

c) <= d) !=

104.

a) 12 17 22 b) 5

c) 12 d) 5 10

105.

a) 12 9 6 3 0 b) 0 3 6 9 12

c) 9 6 3 0 d) 0 3 6 9

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 19/27
2/14/2020 Python 3 Loops | Print - Quizizz

106.

a) 54321 b) 5 4 3 2 1

c) 43210 d) 4 3 2 1 0

107.

a) 54321 b) 43210

c) 5 4 3 2 1 d) 4 3 2 1 0

108.

a) 54321 b) 43210
c) 5 4 3 2 1 d) 4 3 2 1 0

Which of the following symbols is used in Python to


109. mean"Greater than or equal to"?

a) <= b) >>

c) >= d) =>

110. Which of the following symbols is used in Python to mean "Not


equal to"?

a) == b) !=

c) <> d) ><

111. Which of the following symbols is used in Python to


mean"Equal to"?

a) = b) !=

c) == d) >=

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 20/27
2/14/2020 Python 3 Loops | Print - Quizizz

112. Which of the following best describes the order in which these
lines are processed in Python?

a) 1,2,3,4 b) 1,2,1,2,1,4

c) 1,2,1,2,1,2,4 d) 1,2,1,2,1,2,1,2,4

113.

a) 5 b) 6

c) 21 d) 36

114.

a) 5 b) 6
c) 21 d) 36

115. Where does "print t" need to be in order for the code to
generate the following output?

a) A b) B

c) C d) D

116. Where does "print t" need to be in order for the code to
generate the following output?

a) A b) B

c) C d) D

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 21/27
2/14/2020 Python 3 Loops | Print - Quizizz

117.

a) A b) B

c) C d) D

118.

a) A b) B

c) C d) D

119.

a) A b) B

c) C d) D

120. What code gives you the output as follows:

a) A b) B

c) C d) D

121. What is 3**3

a) 0 b) 9

c) 27 d) 81

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 22/27
2/14/2020 Python 3 Loops | Print - Quizizz

122. What is 3 % 3

a) 0 b) 1

c) 3 d) 9

123.

a) A b) B

c) C d) D

124.

a) A b) B

c) C d) D

125.

a) A b) B

c) C d) D

126. What is the result? (Hint: pay careful attention to line 7)

a) 48 b) 81

c) 114 d) 10

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 23/27
2/14/2020 Python 3 Loops | Print - Quizizz

127. What is the result?(Hint: pay careful attention to line 7)

a) 48 b) 81

c) 12 d) 10

128.

a) A b) B

c) C d) D

129.

a) A b) B

c) C d) D

130.

a) A b) B

c) C d) D

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 24/27
2/14/2020 Python 3 Loops | Print - Quizizz

131.

a) A b) B

c) C d) D

132. What is the result of the following Python code?


3 ** 2

a) 6 b) 8

c) 5 d) 9

133. What is the result of the following Python code?


3%2

a) 5 b) 6

c) 2 d) 1

134. Solve the function below:


def example():
cash= 4
total = cash **2 + cash
print total

a) 8 b) 10

c) 16 d) 20

135. Choose the brackets that are used for making a list.

a) list = { } b) list = [ ]

c) list = < > d) list = ( )

136.

a) A b) B

c) C d) D

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 25/27
2/14/2020 Python 3 Loops | Print - Quizizz

137.

a) A b) B

c) C d) D

138.

a) A b) B

c) C d) D

139.

a) A b) B

c) C d) D

140.

a) A b) B

c) C d) D

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 26/27
2/14/2020 Python 3 Loops | Print - Quizizz

Answer Key
1. a 36. d 71. b 106. b
2. b 37. a 72. a 107. a
3. c 38. b 73. a 108. b
4. d 39. c 74. a 109. c
5. d 40. d 75. b 110. b
6. c 41. c 76. c 111. c
7. b 42. d 77. c 112. b
8. c 43. d 78. c 113. c
9. b 44. a 79. a 114. a
10. a 45. b 80. d 115. a
11. b 46. d 81. a 116. b
12. a 47. a 82. a 117. d
13. d 48. c 83. b 118. c
14. c 49. d 84. b 119. b
15. c 50. a 85. a 120. b
16. c 51. d 86. a 121. c
17. b 52. b 87. b 122. a
18. c 53. b 88. c 123. a
19. b 54. d 89. b 124. b
20. a 55. a 90. a 125. c
21. b 56. c 91. a 126. a
22. a 57. a 92. d 127. d
23. c 58. d 93. b 128. a
24. a 59. c 94. a 129. c
25. b 60. d 95. b 130. b
26. a 61. d 96. a 131. d
27. b 62. b 97. d 132. d
28. c 63. c 98. c 133. d
29. d 64. a 99. a 134. d
30. a 65. a 100. c 135. b
31. b 66. b 101. a 136. a
32. d 67. a 102. a 137. b
33. a 68. a 103. c 138. d
34. b 69. b 104. c 139. a
35. c 70. a 105. d 140. b

https://quizizz.com/print/quiz/5e0dc17cbdc0e1001c5120e1 27/27

You might also like