What is the primary purpose of using functions in Python?
To increase the execution speed of the program.
To make the code more readable and organized.
To define data structures like lists and dictionaries.
To reduce the memory consumption of the program.
What is the correct way to print 'Hello, World!' in Python?
console.log('Hello, World!')
System.out.println('Hello, World!')
print('Hello, World!')
echo 'Hello, World!'
What is the time complexity of checking if an element is present in a Python set?
O(log n)
O(n log n)
O(n)
O(1)
What will the following code print?
set1 = {1, 2, 3} set2 = {3, 4, 5} print(set1.intersection(set2))
{3}
Error
{1, 2, 3, 4, 5}
{1, 2, 4, 5}
What is the maximum number of arguments a lambda function can take?
Unlimited
2
1
255
How many times will the following loop iterate?
for i in range(1, 5): print(i)
5
4
Infinitely
What is the output of this code?
i = 0 while i < 3: print(i) i += 2
0 1
0 1 2
0 2
Infinite loop
What will the following code snippet print?
x = 5 y = 2 * x print(y)
10
x * 2
2 * x
Which assignment operator in Python is used to perform floor division and assign the result?
/=
//=
%=
=
Which of the following comparison operators means 'not equal to' in Python?
==
<>
!=