AllInfoHub Logo

AllInfoHub – MCQ Practice

Basics of Python – Multiple Choice Questions (MCQs)

  1. 37. How do you define an empty tuple in Python?

    • A. ()
    • B. tuple()
    • C. {}
    • D. []
  2. 38. What is a dictionary in Python?

    • A. An ordered
    • B. mutable sequence of items
    • C. An unordered collection of unique items
    • D. An ordered
  3. 39. How do you access the value associated with the key 'name' in a dictionary called 'my_dict'?

    • A. my_dict('name')
    • B. my_dict['name']
    • C. my_dict.get('name')
    • D. All of the above
  4. 40. What is a set in Python?

    • A. An ordered
    • B. mutable sequence of items
    • C. An unordered collection of unique items
    • D. An ordered
  5. 41. How do you add an element to a set called 'my_set'?

    • A. my_set.append(element)
    • B. my_set.add(element)
    • C. my_set.insert(element)
    • D. my_set += {element}
  6. 42. What is the output of `print(True and False)`?

    • A. TRUE
    • B. FALSE
    • C. Error
    • D. None
  7. 43. What is the output of `print(True or False)`?

    • A. TRUE
    • B. FALSE
    • C. Error
    • D. None
  8. 44. What is the output of `print(not True)`?

    • A. TRUE
    • B. FALSE
    • C. Error
    • D. None
  9. 45. Which operator is used for equality comparison in Python?

    • A. =
    • B. ==
    • C. is
    • D. !=
  10. 46. Which operator is used to check if two variables refer to the same object in memory?

    • A. ==
    • B. is
    • C. !=
    • D. equals
  11. 47. What is the output of `print(5 is 5.0)`?

    • A. TRUE
    • B. FALSE
    • C. Error
    • D. None
  12. 48. What is the output of `print(5 == 5.0)`?

    • A. TRUE
    • B. FALSE
    • C. Error
    • D. None