
Python Programming Quiz

Quiz
•
Computers
•
University
•
Hard
ggukie ggukie
Used 1+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement corrects the off-by-one error in the following code: # This code prints the first 10 numbers starting with zero i = 0 while i <= 10 : print(i) i = i + 1
Replace |i = 0| with |i = 1|
Replace |while i <= 10| with |while i < 10|
Replace |i = i + 1| with |i = i + 2|
Replace |while i <= 10| with |while i + 1< 10|
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times will the following loop run? i = 0 while i < 10 : print(i) i = i + 1
|0|
|8|
|9|
|10|
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the code snippet given below? i = 0 while i != 9 : print(i, end = " ") i = i + 2
No output
0 2 4 6 8
10 12 14 16 18 ... (infinite loop)
0 2 4 6 8 10 12 14 ... (infinite loop)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times does the code snippet given below display "Loop Execution"? i = 1 while i != 10 : print("Loop Execution") i = i + 1
Infinite times
8 times
9 times
10 times
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the code fragment given below? i = 0 j = 0 while i < 27 : i = i + 2 j = j + 1 print("j =", j)
|j = 27|
|j = 12|
|j = 13|
|j = 14|
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet? i = 1 while i < 10 : print(i, end = " ") i = i + 2 if i == 5 : i = 9
1 3 5
1 3 9
1 3 5 7 9
1 3 5 9
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The code snippet below is supposed to check whether an integer greater than 1 is a prime number. What will be the result of executing it? j = 2 result = 0 number = int(input("Please enter an integer (2 or greater):")) while j < number : if number % j == 0 : result = 1 j = j + 1 if result == 1 : print("Number:", number, "is Not Prime.") else : print("Number:", number, "is Prime.")
The code snippet contains a compile error.
The code snippet displays the desired result.
The code snippet displays an incorrect result.
The code snippet causes an infinite loop.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Bertelsmann AI Track Quiz Initiative #3

Quiz
•
University - Professi...
20 questions
Perintah Kombinasi Keyboard/Printah Ctrl

Quiz
•
University
20 questions
technology (Computer)

Quiz
•
3rd Grade - University
21 questions
quiz 2nd/3rd year

Quiz
•
University
22 questions
c++

Quiz
•
University
20 questions
JavaScript Basics (2)

Quiz
•
University
20 questions
PL SQL

Quiz
•
University - Professi...
20 questions
PHP Quiz 1

Quiz
•
University
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade