Which statement will NOT exit an infinite loop in Python?
sys.exit()
break
return
continue
What is the value of the expression: '5' + '3'?
'5' + '3'
8
Error
53
15
Which of the following data structures in Python is mutable?
Tuple
List
String
None of the above
Which statement is true about the else block in a while loop?
else
while
It always executes after the loop finishes.
It executes only if the loop condition becomes false.
It executes only if the loop contains a break statement.
The else keyword cannot be used with a while loop.
How many times will the word 'Hello' be printed?
for i in range(3): print('Hello')
2
0
3
1
What is the purpose of the '#' symbol in Python code?
To indicate a code block
To execute a command
To write a comment
To define a variable
What is a key limitation of lambda functions in Python compared to regular functions defined with def?
def
Lambda functions can only contain a single expression.
Lambda functions can only take a single argument.
Lambda functions cannot be assigned to variables.
Lambda functions cannot use the return statement.
Which method is used to convert a string to uppercase in Python?
uppercase()
upper()
toUpper()
toUpperCase()
Which of the following is NOT a valid way to format a string in Python?
f-strings
% operator
%
concat() function
concat()
format() method
format()
How can you convert the integer 10 to a string in Python?
10
int_to_str(10)
toString(10)
str(10)
10.to_string()