Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

150 Best Beginner-Level Python MCQs

  1. What is the output of print("Python".rsplit("t", -1))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  2. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.2 in Python?
    a) [x * 0.2 for x in range(51)]
    b) [x * 0.2 for x in range(50)]
    c) [x * 0.2 for x in range(0, 51)]
    d) [x * 0.2 for x in range(0, 50)]
    Correct Answer: a) [x * 0.2 for x in range(51)]
  3. What is the output of print("Python".split("t", 2))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  4. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.5 in Python?
    a) [x * 0.5 for x in range(21)]
    b) [x * 0.5 for x in range(20)]
    c) [x * 0.5 for x in range(0, 21)]
    d) [x * 0.5 for x in range(0, 20)]
    Correct Answer: a) [x * 0.5 for x in range(21)]
  5. What is the output of print("Python".rsplit("t", 2))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  6. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.25 in Python?
    a) [x * 0.25 for x in range(41)]
    b) [x * 0.25 for x in range(40)]
    c) [x * 0.25 for x in range(0, 41)]
    d) [x * 0.25 for x in range(0, 40)]
    Correct Answer: a) [x * 0.25 for x in range(41)]
  7. What is the output of print("Python".split("t", 3))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  8. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.1 in Python?
    a) [x * 0.1 for x in range(101)]
    b) [x * 0.1 for x in range(100)]
    c) [x * 0.1 for x in range(0, 101)]
    d) [x * 0.1 for x in range(0, 100)]
    Correct Answer: a) [x * 0.1 for x in range(101)]
  9. What is the output of print("Python".rsplit("t", 3))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  10. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.05 in Python?
    a) [x * 0.05 for x in range(201)]
    b) [x * 0.05 for x in range(200)]
    c) [x * 0.05 for x in range(0, 201)]
    d) [x * 0.05 for x in range(0, 200)]
    Correct Answer: a) [x * 0.05 for x in range(201)]
  11. What is the output of print("Python".split("t", 4))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  12. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.01 in Python?
    a) [x * 0.01 for x in range(1001)]
    b) [x * 0.01 for x in range(1000)]
    c) [x * 0.01 for x in range(0, 1001)]
    d) [x * 0.01 for x in range(0, 1000)]
    Correct Answer: a) [x * 0.01 for x in range(1001)]
  13. What is the output of print("Python".rsplit("t", 4))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  14. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.02 in Python?
    a) [x * 0.02 for x in range(501)]
    b) [x * 0.02 for x in range(500)]
    c) [x * 0.02 for x in range(0, 501)]
    d) [x * 0.02 for x in range(0, 500)]
    Correct Answer: a) [x * 0.02 for x in range(501)]
  15. What is the output of print("Python".split("t", 5))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]

x
Advertisements
Advertisements