
Python Programming Quiz

Quiz
•
Computers
•
University
•
Hard
SUBBURAJ S
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the purpose of variables in Python programming?
The purpose of variables in Python programming is to store and manipulate data.
The purpose of variables in Python programming is to handle exceptions.
The purpose of variables in Python programming is to display output.
The purpose of variables in Python programming is to create loops.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is a valid data type in Python? a) Integer b) Float c) String d) All of the above
c) String
b) Float
a) Integer
d) All of the above.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code snippet? x = 5 y = 2 print(x % y)
3
1
2
0
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which control flow statement is used to execute a block of code repeatedly as long as a certain condition is true?
for
if
while
switch
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code snippet? numbers = [1, 2, 3, 4, 5] for num in numbers: print(num)
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which file mode is used to open a file for reading?
w
a
x
r
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code snippet? file = open('data.txt', 'r') print(file.read()) file.close()
The output of the code snippet will be the file object.
The output of the code snippet will be the contents of the 'data.txt' file.
The code will throw an error because the file 'data.txt' does not exist.
The output of the code snippet will be an empty string.
Create a free account and access millions of resources
Similar Resources on Wayground
12 questions
Python Quiz

Quiz
•
University
15 questions
Python End of Topic Quiz

Quiz
•
8th Grade - University
16 questions
PAP Module-3 Part-2

Quiz
•
University
15 questions
CODE ZENITH

Quiz
•
University
10 questions
TIU Quiz-4

Quiz
•
University
15 questions
Python Basics

Quiz
•
University
10 questions
python test 1_23_24

Quiz
•
University
20 questions
BS TEST2

Quiz
•
University
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade