AllInfoHub Logo

AllInfoHub – MCQ Practice

Basics of Python – Multiple Choice Questions (MCQs)

  1. 13. What is the output of `print(type((1, 2)))`?

    • A. <class 'tuple'>
    • B. <class 'list'>
    • C. <class 'set'>
    • D. <class 'array'>
  2. 14. Which of the following is an immutable data type in Python?

    • A. list
    • B. dictionary
    • C. set
    • D. tuple
  3. 15. What is the output of `print(2 ** 3)`?

    • A. 6
    • B. 8
    • C. 9
    • D. 5
  4. 16. Which operator is used for exponentiation in Python?

    • A. ^
    • B. **
    • C. pow
    • D. exp
  5. 17. What is the output of `print('Python'[1:4])`?

    • A. yth
    • B. ythn
    • C. ytho
    • D. yth
  6. 18. Which function is used to find the length of a string or list in Python?

    • A. len()
    • B. length()
    • C. size()
    • D. count()
  7. 19. What is the output of `print(3 == 3.0)`?

    • A. TRUE
    • B. FALSE
    • C. Error
    • D. None
  8. 20. Which keyword is used for conditional execution (if statement) in Python?

    • A. if
    • B. elseif
    • C. else if
    • D. condition
  9. 21. Which keyword is used for the 'else if' condition in Python?

    • A. elseif
    • B. elif
    • C. else if
    • D. if else
  10. 22. Which keyword is used for the 'else' condition in Python?

    • A. otherwise
    • B. else if
    • C. elif
    • D. else
  11. 23. What is the output of the following code? `x = 5; if x > 3: print('Yes') else: print('No')`?

    • A. Yes
    • B. No
    • C. Error
    • D. None
  12. 24. What is the output of the following code? `x = 2; if x > 3: print('A') elif x == 2: print('B') else: print('C')`?

    • A. A
    • B. B
    • C. C
    • D. Error