1. What is the correct way to declare a variable in Python?
Explanation: Python does not require explicit declaration of data types. The correct syntax is x = 10. Unlike some other languages, Python does not use int x = 10.
2. What will be the output of the following code?x = "5"y = 2print(x * y)
Explanation: Since x is a string ("5") and y is an integer (2), the * operator repeats the string. So, "5" * 2 results in "55".
3. Which of the following is a mutable data type in Python?
Explanation: Lists are mutable, meaning their elements can be changed after creation. Tuples, strings, and integers are immutable.
4. What data type does the type() function return for the following?x = (1, 2, 3)print(type(x))
Explanation: The variable x is defined using parentheses (), which means it is a tuple. The type() function confirms that it is .
5. What is the output of the following?x = 3.14print(type(x))
Explanation: Any number with a decimal point in Python is automatically of type float.
6. What will be the result of bool([])?
Explanation: An empty list [] is considered False when converted to a boolean. Only non-empty objects evaluate to True.
7. How do you convert a string to an integer in Python?
Explanation: The int() function is used to convert a string containing numeric values into an integer.
8. What is the correct way to assign multiple variables in Python?
Explanation: Python allows multiple variables to be assigned in a single line using comma-separated values.
9. What will be the output of the following?x = Noneprint(type(x))
Explanation: The value None represents the absence of a value and belongs to the NoneType class.
10. Which of the following is an immutable data type?
Explanation: Tuples cannot be modified after creation, making them immutable, unlike lists and dictionaries.