Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

150 Best Beginner-Level Python MCQs

  1. What is the output of print("Python".isalnum())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True
  2. Which of the following is used to create a list in Python?
    a) {}
    b) []
    c) ()
    d) <>
    Correct Answer: b) []
  3. What is the output of print("Python".istitle())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: b) False
  4. Which of the following is used to sort a list in ascending order?
    a) sort()
    b) sorted()
    c) reverse()
    d) reversed()
    Correct Answer: a) sort()
  5. What is the output of print("Python".isnumeric())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: b) False
  6. Which of the following is used to create a dictionary in Python?
    a) {}
    b) []
    c) ()
    d) <>
    Correct Answer: a) {}
  7. What is the output of print("Python".isdecimal())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: b) False
  8. Which of the following is used to create a function in Python?
    a) def
    b) function
    c) func
    d) define
    Correct Answer: a) def
  9. What is the output of print("Python".isidentifier())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True
  10. Which of the following is used to create a class in Python?
    a) class
    b) def
    c) struct
    d) object
    Correct Answer: a) class
  11. What is the output of print("Python".isprintable())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True
  12. Which of the following is used to create a lambda function in Python?
    a) lambda
    b) def
    c) function
    d) func
    Correct Answer: a) lambda
  13. What is the output of print("Python".isascii())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True
  14. Which of the following is used to create a generator in Python?
    a) yield
    b) return
    c) break
    d) continue
    Correct Answer: a) yield
  15. What is the output of print("Python".isalpha())?
    a) True
    b) False
    c) Error
    d) None
    Correct Answer: a) True

x
Advertisements
Advertisements