150 Best Beginner-Level Python MCQs

  1. What is the output of print("Python".replace("P", "J"))?
    a) Jython
    b) Python
    c) Error
    d) None
    Correct Answer: a) Jython
  2. Which of the following is a built-in module in Python?
    a) math
    b) random
    c) os
    d) All of the above
    Correct Answer: d) All of the above
  3. What is the output of print(10 % 3)?
    a) 1
    b) 3
    c) 0
    d) Error
    Correct Answer: a) 1
  4. Which of the following is used to exit a loop in Python?
    a) break
    b) continue
    c) pass
    d) exit
    Correct Answer: a) break
  5. What is the output of print("Python"[-1])?
    a) P
    b) n
    c) o
    d) Error
    Correct Answer: b) n
  6. What is the output of print(2 ** 3)?
    a) 6
    b) 8
    c) 9
    d) Error
    Correct Answer: b) 8
  7. Which of the following is used to create a tuple in Python?
    a) {}
    b) []
    c) ()
    d) <>
    Correct Answer: c) ()
  8. What is the output of print("Python".islower())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: b) False
  9. Which of the following is used to remove an element from a list?
    a) remove()
    b) delete()
    c) discard()
    d) pop()
    Correct Answer: a) remove()
  10. What is the output of print("Python".startswith("P"))?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True
  11. Which of the following is used to create a set in Python?
    a) {}
    b) []
    c) ()
    d) <>
    Correct Answer: a) {}
  12. What is the output of print("Python".endswith("n"))?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True
  13. Which of the following is used to reverse a list in Python?
    a) reverse()
    b) reversed()
    c) sort()
    d) sorted()
    Correct Answer: a) reverse()
  14. What is the output of print("Python".capitalize())?
    a) python
    b) Python
    c) PYTHON
    d) Error
    Correct Answer: b) Python
  15. Which of the following is used to check if a key exists in a dictionary?
    a) in
    b) exists
    c) has_key
    d) contains
    Correct Answer: a) in

Advertisements
x