What is the value of the expression: '5' + '3'?
'5' + '3'
Error
15
8
53
Which of the following data structures in Python is mutable?
String
None of the above
List
Tuple
What is the output of the following code?
name = 'Alice' age = 30 print(f'{name} is {age} years old.')
name is age years old.
Alice is 30 years old.
{name} is {age} years old.
What will the following Python code snippet print?
x = 5 if x > 10: print('x is greater than 10') elif x > 3: print('x is greater than 3') else: print('x is less than or equal to 3')
x is less than or equal to 3
x is greater than 3
x is greater than 10
What is the purpose of the break statement in a loop?
break
It skips the current iteration and continues to the next.
It exits the loop entirely.
It prints the current value of the loop variable.
It defines a new variable within the loop.
Which arithmetic operator is used to calculate the remainder of a division?
//
**
%
/
What is the purpose of the return statement in a Python function?
return
To terminate the execution of the entire program.
To print a value to the console.
To end the execution of the function and optionally send a value back to the caller.
To declare a new variable inside the function.
What is the correct way to concatenate two strings, 'Hello' and 'World!', with a space in between?
'Hello' & ' ' & 'World!'
'Hello' + ' ' + 'World!'
"Hello" + " " + "World!"
'Hello' + 'World!'
What is the correct way to get user input and store it in a variable named 'name'?
input('Enter your name:') = name
name = input('Enter your name:')
print('Enter your name:') = name
name = print('Enter your name:')
Can a Python function return multiple values?
Only if the values are of the same data type.
No, a function can only return a single value.
Yes, by using multiple 'return' statements within the function.
Yes, by separating the values with commas, effectively returning a tuple.