AllInfoHub Logo

AllInfoHub – MCQ Practice

Data Types and Variables – Multiple Choice Questions (MCQs)

  1. 1. What will be the data type of the variable `result` after the operation `result = 10 / 2`?

    • A. int
    • B. float
    • C. str
    • D. bool
  2. 2. Which of the following is an immutable built-in data type in Python?

    • A. list
    • B. dict
    • C. set
    • D. tuple
  3. 3. Given `x = '5'` and `y = 3`, what will be the output of `print(x * y)`?

    • A. 53'
    • B. 555'
    • C. 15
    • D. Error
  4. 4. Which of the following is a valid way to declare a string in Python?

    • A. hello'
    • B. world
    • C. `python`
    • D. "multi line"
  5. 5. What is the output of `print(type({1, 'a'}))`?

    • A. <class 'set'>
    • B. <class 'frozenset'>
    • C. <class 'list'>
    • D. <class 'tuple'>
  6. 6. Which of the following operations will result in a TypeError in Python?

    • A. `'a' + 1`
    • B. `'a' * 3`
    • C. `'a' == 'a'`
    • D. len('a')
  7. 7. What is the correct way to convert the string `'123'` to an integer in Python?

    • A. int('123')
    • B. float('123')
    • C. str(123)
    • D. chr(123)
  8. 8. What will be the value of `x` after the execution of `x = 5; x += '3'`?

    • A. 8
    • B. 53'
    • C. TypeError
    • D. None
  9. 9. Which of the following is a valid way to create an empty dictionary in Python?

    • A. {}
    • B. dict()
    • C. []
    • D. ()
  10. 10. What will be the output of `print(bool(0), bool(1), bool(''))`?

    • A. False True False
    • B. True True True
    • C. False False False
    • D. True False True
  11. 11. Which of the following is NOT a valid boolean value in Python?

    • A. TRUE
    • B. FALSE
    • C. 1
    • D. 0
  12. 12. What is the term used for converting a value of one data type to another?

    • A. Casting
    • B. Type hinting
    • C. Declaration
    • D. Assignment