NEW
Font size
WorksheetsPython Quiz Techno India
Total questions: 10
Worksheet time: 6mins
What datatype is the object below?
L = [1, 23, ‘hello’, 1]
list
dictionary
array
tuple
Write the output of below code:
a = True
b = False
c = True
if not a or b:
print ("a")
elif not a or not b and c:
print ("b")
elif not a or b or not b and a:
print ("c")
else:
print ("d")
a
b
c
d
What is the answer to this expression, 22 % 3 is?
7
1
0
5
Operators with the same precedence are evaluated in which manner?
Right to Left
Left to Right
Can’t say
None of these
Which one of the following has the highest precedence in the expression?
Exponential
Addition
Multiplication
Parentheses
Suppose t = (1, 2, 4, 3), which of the following is incorrect?
print(t[3])
print(max(t))
print(len(t))
t[3] = 45
What is called when a function is defined inside a class?
Module
Class
Another function
Method
Which of these about a frozenset is not true?
Mutable data type
Allows duplicate values
Data type with unordered values
Immutable data type
If a is a dictionary with some key-value pairs, what does a.popitem() do?
Removes an arbitrary element
Removes all the key-value pairs
Removes the key-value pair for the key given as an argument
Invalid method for dictionary
test = {1:'A', 2:'B', 3:'C'}
test = {}
print(len(test))
0
3
An exception is thrown
None
