wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics IIoT

Total questions: 13

Worksheet time: 7mins

Name
Class
Date
1.
Which of the following is a mutable data type in Python?
a)
List
b)
Tuple
c)
String
d)
None
2.
Which Python keyword is used to define a function?
a)
def
b)
function
c)
class
d)
method
3.
What is the keyword used for the True boolean value in Python?
a)

True

b)

true

c)

1

d)

False

4.
Which data type can have elements of multiple data types and allows duplicate values?
a)
List
b)
Set
c)
Tuple
d)
Dictionary
5.
Which of the following is NOT a valid Python identifier?
a)
1_variable
b)
_variable
c)
variable_name
d)
variableName
6.
What does the pass keyword do in Python?
a)
It acts as a no-operation (NOP) statement.
b)
It skips the current loop iteration.
c)
It raises an exception.
d)
It returns a value from a function.
7.
Which keyword is used to define a new class in Python?
a)
class
b)
Class
c)
new
d)
object
8.
What is the main difference between a set and a tuple in Python?
a)
Sets are mutable and unordered, while tuples are immutable and ordered.
b)
Sets are immutable and unordered, while tuples are mutable and ordered.
c)
Sets are mutable and ordered, while tuples are immutable and unordere
9.
Which of the following is NOT a rule for creating identifiers in Python?
a)
Identifiers can contain special characters.
b)
Identifiers must start with a letter or underscore.
c)
Identifiers are case-sensitive.
d)
Python keywords cannot be used as identifiers.
10.
Which keyword is used to handle exceptions in Python?
a)
try
b)
assert
c)
handle
d)
test
11.
How can you create an empty dictionary in Python?
a)
empty_dict = {}
b)
empty_dict = []
c)
empty_dict = ()
d)
empty_dict = None
12.
Which keyword is used to import a specific function from a module in Python?
a)
from
b)
import
c)
with
d)
as
13.
Which of the following data types in Python does not allow duplicate elements?
a)
Set
b)
List
c)
Tuple
d)
Dictionary