Home > Information Technology > Programming Languages > Variables and Data Types in Python
19 QuestionsLog in 
00:00:00

🎁 Claim Rewards

🎁 Login to earn rewards !!!



19 uniquely designed questions just for you to evaluate your skills in Variables and Data Types in Python quiz. Are you ready to challenge yourself and explore more? Let's get started and see how much you can score out of 19.

Test your understanding of one of the most fundamental topics in Python—Variables and Data Types! This quiz covers key concepts such as variable naming rules, data types, type conversion, immutability, and more.

Please feel free to report any corrections if you come across any inaccuracies or errors. Your feedback is valuable in maintaining the accuracy of our content.

Questions

1. Which of the following is a valid variable name in Python?
Answer: my_value
Explanation: Variable names cannot start with numbers or contain special characters like #, and class is a reserved keyword.Report for correction
2. What is the type of the result of 3 / 2 in Python 3?
Answer: float
Explanation: Division in Python 3 always returns a float.Report for correction
3. "What is the output of type(""123"")?"
Answer: str
Explanation: Anything inside quotes is treated as a string.Report for correction
4. What is the default type of a variable assigned as a = True?
Answer: bool
Explanation: True is a boolean value.Report for correction
5. Which one of these is not a mutable data type?
Answer: tuple
Explanation: Tuples are immutable in Python.Report for correction
6. What does type(None) return?
Answer: NoneType
Explanation: None is of type NoneType.Report for correction
7. Which of the following creates an empty dictionary?
Answer: {}
Explanation: {} creates an empty dictionary in Python.Report for correction
8. What will type(5 + 3.0) return?
Answer: float
Explanation: int + float → float (automatic type promotion).Report for correction
9. What is the output of type([1, 2, 3])?
Answer: list
Explanation: Square brackets [] define a list.Report for correction
10. What is the type of variable a = {1, 2, 3}?
Answer: set
Explanation: Curly braces with values define a set if not key-value pairs.Report for correction
11. Which of the following is used to define a multi-line string?
Answer: Triple quotes
Explanation: "Triple quotes ''' or """""" are used for multi-line strings."Report for correction
12. What is the type of range(5) in Python 3?
Answer: range
Explanation: range() returns a range object in Python 3.Report for correction
13. What is the output of type(10j)?
Answer: complex
Explanation: 10j represents an imaginary part of a complex number.Report for correction
14. Which keyword is used to check the type of a variable?
Answer: type
Explanation: type() is used to check the type of an object.Report for correction
15. What is the output of type({})?
Answer: dict
Explanation: {} creates a dictionary.Report for correction
16. Which of the following is an immutable data type?
Answer: tuple
Explanation: Tuples cannot be changed once created.Report for correction
17. What is the type of bool(0)?
Answer: bool
Explanation: bool(0) returns False, and the type is bool.Report for correction
18. Which of the following is used to declare a variable in Python?
Answer: No keyword
Explanation: Python does not require a keyword to declare variables.Report for correction
19. "What is the result of int(""10"")?"
Answer: 10
Explanation: int() converts a valid numeric string to an integer.Report for correction