AllInfoHub Logo

AllInfoHub – MCQ Practice

Data Types and Variables – Multiple Choice Questions (MCQs)

  1. 37. What will be the output of `print(type(1.0))`?

    • A. <class 'int'>
    • B. <class 'float'>
    • C. <class 'str'>
    • D. <class 'bool'>
  2. 38. Which of the following is a valid way to create a shallow copy of a list `my_list`?

    • A. `new_list = my_list`
    • B. `new_list = my_list[:]`
    • C. `new_list = list(my_list)`
    • D. Both B and C
  3. 39. What will be the output of `print(type('hello'))`?

    • A. <class 'int'>
    • B. <class 'float'>
    • C. <class 'str'>
    • D. <class 'bool'>
  4. 40. Which method is used to add multiple elements to a list?

    • A. append()
    • B. add()
    • C. extend()
    • D. insert()
  5. 41. What will be the output of `print(type(True))`?

    • A. <class 'int'>
    • B. <class 'float'>
    • C. <class 'str'>
    • D. <class 'bool'>
  6. 42. Which method is used to insert an element at a specific index in a list?

    • A. append()
    • B. add()
    • C. insert()
    • D. extend()
  7. 43. What will be the output of `print(type([1, 2]))`?

    • A. <class 'list'>
    • B. <class 'tuple'>
    • C. <class 'set'>
    • D. <class 'dict'>
  8. 44. Which method is used to remove the first occurrence of a specific element from a list?

    • A. pop()
    • B. remove()
    • C. discard()
    • D. del()
  9. 45. What will be the output of `print(type((1, 2)))`?

    • A. <class 'list'>
    • B. <class 'tuple'>
    • C. <class 'set'>
    • D. <class 'dict'>
  10. 46. Which method is used to clear all elements from a list?

    • A. pop()
    • B. remove()
    • C. discard()
    • D. clear()
  11. 47. What will be the output of `print(type({'a': 1}))`?

    • A. <class 'list'>
    • B. <class 'tuple'>
    • C. <class 'set'>
    • D. <class 'dict'>
  12. 48. Which method is used to get all keys from a dictionary?

    • A. values()
    • B. items()
    • C. keys()
    • D. get()