PCEP-30-02 · Question #354
What is true about exceptions in Python? (Choose two.)
The correct answer is B. According to Python terminology, exceptions are raised. Option B is correct because Python's language specification and documentation consistently use the term "raised" - you raise an exception with the raise keyword, and Python's error messages say things like "Exception was raised." This is a deliberate terminology choice, not…
Question
Options
- ANot more than one except branch can be executed inside one try-except block.
- BAccording to Python terminology, exceptions are raised.
- CAccording to Python terminology, exceptions are thrown.
- DPython's philosophy encourages developers to make all possible efforts to protect the program from the occurrence of an exception.
How the community answered
(38 responses)- A5% (2)
- B84% (32)
- C8% (3)
- D3% (1)
Explanation
Option B is correct because Python's language specification and documentation consistently use the term "raised" - you raise an exception with the raise keyword, and Python's error messages say things like "Exception was raised." This is a deliberate terminology choice, not interchangeable with other languages.
Option A is also correct (making A + B the full "choose two" answer): in a try-except block, at most one except branch executes - Python evaluates them top-to-bottom and stops at the first match, so multiple handlers never fire for a single exception.
Option C is wrong because "thrown" is the terminology used in Java and C++, not Python - mixing these up is a classic cross-language confusion trap.
Option D is wrong because Python's philosophy is actually the opposite: it embraces EAFP ("Easier to Ask Forgiveness than Permission"), encouraging developers to use try-except freely rather than exhaustively guard against every possible error upfront.
Memory tip: Think "Python RAISES the alarm" - just like the raise keyword you type in code. If you remember the keyword, you remember the terminology. And remember EAFP: Python says "try it and handle what breaks," not "prevent everything."
Community Discussion
No community discussion yet for this question.