nerdexam
Python_Institute

PCPP-32-101 · Question #50

Which of the following statements regarding the __traceback__ attribute are true? (Choose two.)

The correct answer is C. The attribute is owned by every exception object. D. The attribute can be easily handled by the traceback.format_tb() method. Every exception object has a __traceback__ attribute that holds the traceback at the point the exception was raised. The traceback.format_tb() function can process the __traceback__ attribute to format the traceback information as a list of strings.

Advanced OOP

Question

Which of the following statements regarding the traceback attribute are true? (Choose two.)

Options

  • AThe attribute is a special method delivered by the traceback module to retrieve a full list of strings
  • BThe attribute is owned only by the exception objects residing in an exception chain.
  • CThe attribute is owned by every exception object.
  • DThe attribute can be easily handled by the traceback.format_tb() method.

How the community answered

(28 responses)
  • A
    7% (2)
  • B
    18% (5)
  • C
    75% (21)

Explanation

Every exception object has a traceback attribute that holds the traceback at the point the exception was raised. The traceback.format_tb() function can process the traceback attribute to format the traceback information as a list of strings.

Topics

#__traceback__#exception objects#traceback module#exception chain

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice