Python Programming - Data Types Questions with Answers explain how Python stores and handles different types of data. These Python Data Types Questions are important for TCS, RRB, and SSC exams to strengthen programming fundamentals
Python Data Types
Showing 10 of
24 questions
Questions per page:
5
10
20
50
11. How do you check if a key exists in a dictionary?
has_key()
contains()
in
exists()
Answer: Option
C
Hints: The 'in' keyword is used to check for key existence in dictionaries.
Show
Answer
Hide
Answer
Report
12. What is the output of: print(10 // 3)
Answer: Option
B
Hints: Floor division (//) returns the largest integer less than or equal to the result.
Show
Answer
Hide
Answer
Report
13. Which data type preserves order and allows duplicates?
set
dictionary
list
frozenset
Answer: Option
C
Hints: Lists maintain insertion order and allow duplicate elements.
Show
Answer
Hide
Answer
Report
14. What is the result of: bool(0)
Answer: Option
B
Hints: In Python, zero values are considered False in boolean context.
Show
Answer
Hide
Answer
Report
15. Which method adds an element to the end of a list?
insert()
add()
push()
append()
Answer: Option
D
Hints: append() adds a single element to the end of a list.
Show
Answer
Hide
Answer
Report
16. What is the data type of range(5)?
list
tuple
range
generator
Answer: Option
C
Hints: The range() function returns a range object, not a list.
Show
Answer
Hide
Answer
Report
17. Which operator is used for string repetition?
Answer: Option
B
Hints: The asterisk (*) operator repeats strings when used with a string and integer.
Show
Answer
Hide
Answer
Report
18. What does the get() method do for dictionaries?
Adds a new key-value pair
Returns value for key, or default if not found
Removes a key-value pair
Checks if key exists
Answer: Option
B
Hints: The get() method returns None or a default value if the key is not found, avoiding KeyError.
Show
Answer
Hide
Answer
Report
19. Which of these is a floating point number?
Answer: Option
B
Hints: Numbers with decimal points are float type in Python.
Show
Answer
Hide
Answer
Report
20. What is the result of: "hello"[1:4]
Answer: Option
B
Hints: String slicing returns a substring from start index up to but not including end index.
Show
Answer
Hide
Answer
Report