AllInfoHub Logo

AllInfoHub – MCQ Practice

Basics of Python – Multiple Choice Questions (MCQs)

  1. 1. What is the output of `print(2 + 3 * 4)`?

    • A. 14
    • B. 20
    • C. 12
    • D. 10
  2. 2. Which keyword is used to define a function in Python?

    • A. def
    • B. function
    • C. fun
    • D. define
  3. 3. What is the data type of `x = 5.0`?

    • A. int
    • B. float
    • C. string
    • D. boolean
  4. 4. Which of the following is a mutable data type in Python?

    • A. tuple
    • B. string
    • C. integer
    • D. list
  5. 5. What is the output of `print('Hello' + 'World')`?

    • A. HelloWorld
    • B. Hello World
    • C. Hello World
    • D. Error
  6. 6. Which symbol is used for single-line comments in Python?

    • A. #
    • B. //
    • C. /*
    • D. **
  7. 7. What is the output of `print(5 // 2)`?

    • A. 2.5
    • B. 2
    • C. 3
    • D. 2
  8. 8. Which of the following is NOT a valid variable name in Python?

    • A. my_variable
    • B. myVariable
    • C. my variable
    • D. myVariable1
  9. 9. What is the data type of `x = True`?

    • A. int
    • B. float
    • C. string
    • D. bool
  10. 10. What is the output of `print(5 % 2)`?

    • A. 1
    • B. 2
    • C. 2.5
    • D. 0
  11. 11. Which function is used to get user input in Python?

    • A. input()
    • B. get()
    • C. read()
    • D. prompt()
  12. 12. What is the output of `print(type([1, 2]))`?

    • A. <class 'tuple'>
    • B. <class 'list'>
    • C. <class 'set'>
    • D. <class 'array'>