Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

150 Best Beginner-Level Python MCQs

  1. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.03 in Python?
    a) [x * 0.03 for x in range(334)]
    b) [x * 0.03 for x in range(333)]
    c) [x * 0.03 for x in range(0, 334)]
    d) [x * 0.03 for x in range(0, 333)]
    Correct Answer: a) [x * 0.03 for x in range(334)]
  2. What is the output of print("Python".rsplit("t", 5))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  3. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.04 in Python?
    a) [x * 0.04 for x in range(251)]
    b) [x * 0.04 for x in range(250)]
    c) [x * 0.04 for x in range(0, 251)]
    d) [x * 0.04 for x in range(0, 250)]
    Correct Answer: a) [x * 0.04 for x in range(251)]
  4. What is the output of print("Python".split("t", 6))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  5. 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)]
  6. What is the output of print("Python".rsplit("t", 6))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  7. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.06 in Python?
    a) [x * 0.06 for x in range(167)]
    b) [x * 0.06 for x in range(166)]
    c) [x * 0.06 for x in range(0, 167)]
    d) [x * 0.06 for x in range(0, 166)]
    Correct Answer: a) [x * 0.06 for x in range(167)]
  8. What is the output of print("Python".split("t", 7))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  9. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.07 in Python?
    a) [x * 0.07 for x in range(143)]
    b) [x * 0.07 for x in range(142)]
    c) [x * 0.07 for x in range(0, 143)]
    d) [x * 0.07 for x in range(0, 142)]
    Correct Answer: a) [x * 0.07 for x in range(143)]
  10. What is the output of print("Python".rsplit("t", 7))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  11. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.08 in Python?
    a) [x * 0.08 for x in range(126)]
    b) [x * 0.08 for x in range(125)]
    c) [x * 0.08 for x in range(0, 126)]
    d) [x * 0.08 for x in range(0, 125)]
    Correct Answer: a) [x * 0.08 for x in range(126)]
  12. What is the output of print("Python".split("t", 8))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  13. Which of the following is used to create a list of numbers from 0 to 10 in steps of 0.09 in Python?
    a) [x * 0.09 for x in range(112)]
    b) [x * 0.09 for x in range(111)]
    c) [x * 0.09 for x in range(0, 112)]
    d) [x * 0.09 for x in range(0, 111)]
    Correct Answer: a) [x * 0.09 for x in range(112)]
  14. What is the output of print("Python".rsplit("t", 8))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]
  15. 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)]

x
Advertisements
Advertisements