
Python Programming Quiz

Quiz
•
Computers
•
University
•
Hard
Adi Adi
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = 5 if x > 3: print('Hello') else: print('Hi')
Hello
Hey
Goodbye
Hi
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? for i in range(3): print(i)
0 1 2
1 2 3
1 2
0 1 3
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? file = open('data.txt', 'r') print(file.read()) file.close()
The file 'data.txt' does not exist.
An error will occur because the file is not opened in read mode.
The contents of the 'data.txt' file will be printed.
The code will print the file object instead of its contents.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = 10 while x > 0: print(x) x -= 2
10 8 6 4 2 0
10 8 6 4 2
10 8 6 4 2
10 8 6 4
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = 5 if x < 0: print('Negative') elif x == 0: print('Zero') else: print('Positive')
Positive
None
Zero
Negative
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? for i in range(1, 5): if i == 3: continue print(i)
1 2 3 4
1 2 4
1 2 3
1 2 4
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? file = open('data.txt', 'w') file.write('Hello') file.close()
Hello
data.txt
True
None
Create a free account and access millions of resources
Similar Resources on Wayground
11 questions
Python If statement

Quiz
•
University
12 questions
JavaScript Quiz

Quiz
•
University
11 questions
Python Round 3

Quiz
•
University
10 questions
6-文件操作

Quiz
•
University
15 questions
Python Programming Intermediate-1

Quiz
•
University
10 questions
DIS08_1_Shell

Quiz
•
University
8 questions
CSE 15L Lab 9

Quiz
•
University
10 questions
Python Basics

Quiz
•
12th Grade - University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University