Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

150 Best Beginner-Level Python MCQs

  1. What is the output of print("Python".split("t", 9))?
    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.11 in Python?
    a) [x * 0.11 for x in range(91)]
    b) [x * 0.11 for x in range(90)]
    c) [x * 0.11 for x in range(0, 91)]
    d) [x * 0.11 for x in range(0, 90)]
    Correct Answer: a) [x * 0.11 for x in range(91)]
  3. What is the output of print("Python".rsplit("t", 9))?
    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.12 in Python?
    a) [x * 0.12 for x in range(84)]
    b) [x * 0.12 for x in range(83)]
    c) [x * 0.12 for x in range(0, 84)]
    d) [x * 0.12 for x in range(0, 83)]
    Correct Answer: a) [x * 0.12 for x in range(84)]
  5. What is the output of print("Python".split("t", 10))?
    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.13 in Python?
    a) [x * 0.13 for x in range(77)]
    b) [x * 0.13 for x in range(76)]
    c) [x * 0.13 for x in range(0, 77)]
    d) [x * 0.13 for x in range(0, 76)]
    Correct Answer: a) [x * 0.13 for x in range(77)]
  7. What is the output of print("Python".rsplit("t", 10))?
    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.14 in Python?
    a) [x * 0.14 for x in range(72)]
    b) [x * 0.14 for x in range(71)]
    c) [x * 0.14 for x in range(0, 72)]
    d) [x * 0.14 for x in range(0, 71)]
    Correct Answer: a) [x * 0.14 for x in range(72)]
  9. What is the output of print("Python".split("t", 11))?
    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.15 in Python?
    a) [x * 0.15 for x in range(67)]
    b) [x * 0.15 for x in range(66)]
    c) [x * 0.15 for x in range(0, 67)]
    d) [x * 0.15 for x in range(0, 66)]
    Correct Answer: a) [x * 0.15 for x in range(67)]
  11. What is the output of print("Python".rsplit("t", 11))?
    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.16 in Python?
    a) [x * 0.16 for x in range(63)]
    b) [x * 0.16 for x in range(62)]
    c) [x * 0.16 for x in range(0, 63)]
    d) [x * 0.16 for x in range(0, 62)]
    Correct Answer: a) [x * 0.16 for x in range(63)]
  13. What is the output of print("Python".split("t", 12))?
    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.17 in Python?
    a) [x * 0.17 for x in range(59)]
    b) [x * 0.17 for x in range(58)]
    c) [x * 0.17 for x in range(0, 59)]
    d) [x * 0.17 for x in range(0, 58)]
    Correct Answer: a) [x * 0.17 for x in range(59)]
  15. What is the output of print("Python".rsplit("t", 12))?
    a) [‘Py’, ‘hon’]
    b) [‘Pyt’, ‘hon’]
    c) [‘P’, ‘ython’]
    d) Error
    Correct Answer: a) [‘Py’, ‘hon’]

x
Advertisements
Advertisements