What is the output of this code?
i = 0 while i < 3: print(i) i += 2
Infinite loop
0 1
0 2
0 1 2
Which of the following data structures in Python is mutable?
String
Tuple
None of the above
List
What is the output of the following Python code snippet?
print(10 / 3)
Error
3.0
3.3333333333333335
3
What is the primary characteristic of a set in Python?
Ordered and immutable
Unordered and mutable
Ordered and mutable
Unordered and immutable
print(True and False or True)
True
False
None
What is the correct way to access the third element of a list named 'my_list' in Python?
my_list[2]
my_list[3]
my_list.get(3)
my_list(2)
What is the time complexity of checking if an element is present in a Python set?
O(1)
O(log n)
O(n log n)
O(n)
print(type(5.0))
<class 'number'>
<class 'float'>
<class 'int'>
<class 'str'>
What will the following code print?
my_set = {1, 2, 3} my_set.add(3) print(my_set)
{1, 2, 3, 3}
{1, 2, 3}
{3, 1, 2}
How many times will the word 'Hello' be printed?
for i in range(3): print('Hello')
2
0
1