MCQ Answer

How can assertions be disabled in Python?

How can assertions be disabled in Python?

पायथन में अभिकथनों को कैसे अक्षम किया जा सकता है?
Topic : Introduction to Python

A. Passing –O when running python

B. Assertions are disabled by default

C. Both A and B are wrong

D. Assertions cannot be disabled in python




Correct Answer is :

A. Passing –O when running python



Explanation
Assertions in Python can be disabled by running the Python interpreter in optimized mode. This is done by using the -O (capital letter "O", not zero) flag when starting the interpreter. When Python is run with this flag, all assert statements in the code are ignored.
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad