1. Home
  2. Data Science
  3. Python
  4. What does sys.exit() do in Python?

Added 25 Nov 2026

What does sys.exit() do in Python?

  1. Closes the editor
  2. Raises SystemExit to terminate the program Correct answer
  3. Pauses the script
  4. Restarts the interpreter

Correct answer

B. Raises SystemExit to terminate the program

6 views

MCQSEXAM

Explanation

sys.exit raises SystemExit, which ends the program unless caught.

Reference

Asked in: Python Interview Standard Library

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs