NEW
Font size
WorksheetsPython Test
Total questions: 15
Worksheet time: 30mins
Which of the following is mutable in Python?
A) Tuple
B) String
C) List
D) Integer
What is the output of the code?
print(bool("False"))
A) False
B) True
C) Error
D) None
Which keyword is used to modify a global variable inside a function?
A) extern
B) static
C) global
D) public
What is the output?
a = [1, 2, 3]
print(a * 2)
A) [1, 2, 3, 2]
B) [2, 4, 6]
C) [1, 2, 3, 1, 2, 3]
D) Error
What is the difference between (is) and (==)?
A) Both check value equality
B) is checks memory location, == checks value
C) == checks memory, is checks value
D) No difference
Which module is used for multithreading in Python?
A) thread
B) multiprocessing
C) threading
D) os
Which keyword is used to check conditions in Python?
A) if
B) check
C) condition
D) when
Which of the following is used to take input from the user?
A) scan()
B) input()
C) read()
D) get()
Which loop is used when the number of iterations is known?
A) while
B) do-while
C) for
D) switch
What is the output of print(type(10))?
A) <class 'float'>
B) <class 'str'>
C) <class 'int'>
D) <class 'bool'>
What is the correct file extension for Python files?
A) .pt
B) .p
C) .py
D) .python
Which symbol is used for comments in Python?
A) //
B) #
C) /* */
D) <!-- -->
What does @classmethod receive as its first parameter?
A) self
B) cls
C) obj
D) class
Which keyword is used to handle exceptions?
A) catch
B) handle
C) except
D) error
What is the output?
print(sum([i for i in range(5)]))
A) 15
B) 10
C) 5
D) Error
