Python Data Types Questions and Answers

Practice Mode
Showing 10 of 24 questions
Q21
Which method removes and returns the last item from a list?
  • A remove()
  • B pop()
  • C delete()
  • D cut()
Answer: Option B
Explanation: pop() without index removes and returns the last item from a list.
Q22
What is the data type of True and False?
  • A str
  • B int
  • C bool
  • D bit
Answer: Option C
Explanation: True and False are boolean literals in Python.
Q23
Which creates a dictionary with keys 'a' and 'b'?
  • A dict(a=1, b=2)
  • B {'a': 1, 'b': 2}
  • C dict([('a', 1), ('b', 2)])
  • D All of the above
Answer: Option D
Explanation: Dictionaries are created with key-value pairs in curly braces.
Q24
What does the len() function return for "python"?
  • A 5
  • B 6
  • C 7
  • D Error
Answer: Option B
Explanation: The len() function returns the number of characters in a string.
Questions and Answers for Competitive Exams Various Entrance Test