What function is used to display output in Python?
What will be the type of the variable x after x = '10'?
string
What operator is used for string concatenation in Python?
+
What is the result of 5 + 3 * 2?
11
What module do you import to generate random numbers?
random
What function do you use to take user input?
input
What function is used to convert a string into an integer?
int()
What function returns the length of a string?
len()
What operator is used for exponentiation in Python?
**
How do you define a function named greet?
def greet():
What keyword is used to define a function in Python?
def
What data type is True in Python?
boolean
How do you access the first character of a string s?
s[0]
What is the remainder of 17 % 4?
1
What statement is used to return a value from a function?
return
What is the result of type(42) in Python?
<class 'int'>
What is the difference between a list and a tuple?
Lists are mutable, tuples are immutable.
What method converts a string to lowercase?
.lower()
What is the result of int(4.7)?
4
What function is used to get the absolute value of a number?
abs()
What symbol is used for single-line comments in Python?
#
What keyword is used to declare a variable in Python?
None (Python variables are assigned dynamically)
What is the result of "Hello" * 3?
"HelloHelloHello"
What operator is used for floor division in Python?
//
What is the purpose of if __name__ == "__main__": in Python?
It ensures the script runs only when executed directly, not when imported.