nerdexam
Salesforce

PDI · Question #42

Which three statements are true regarding custom exceptions in Apex? (Choose three.)

The correct answer is B. A custom exception class can implement one or many interfaces. D. A custom exception class name must end with "Exception". E. A custom exception class can extend other classes besides the Exception class.. Custom Apex exception classes can implement interfaces and other classes, and their names must adhere to the 'Exception' suffix convention.

Submitted by ahmad_uae· Apr 18, 2026Logic and Process Automation

Question

Which three statements are true regarding custom exceptions in Apex? (Choose three.)

Options

  • AA custom exception class must extend the system Exception class.
  • BA custom exception class can implement one or many interfaces.
  • CA custom exception class cannot contain member variables or methods.
  • DA custom exception class name must end with "Exception".
  • EA custom exception class can extend other classes besides the Exception class.

How the community answered

(61 responses)
  • A
    8% (5)
  • B
    74% (45)
  • C
    18% (11)

Why each option

Custom Apex exception classes can implement interfaces and other classes, and their names must adhere to the 'Exception' suffix convention.

AA custom exception class must extend the system Exception class.

A custom exception class is not strictly required to directly extend `System.Exception`; it must extend a class that ultimately inherits from `System.Exception`, allowing for intermediate custom exception classes.

BA custom exception class can implement one or many interfaces.Correct

Custom exception classes in Apex are flexible and can implement one or many interfaces, allowing them to conform to specific contracts or extend their functionality beyond simple error handling.

CA custom exception class cannot contain member variables or methods.

Custom exception classes can and often should contain member variables and methods to provide additional context, specific error codes, or helpful utility functions related to the error, enhancing the informativeness of the exception.

DA custom exception class name must end with "Exception".Correct

Salesforce development best practices and conventions dictate that custom exception class names should end with 'Exception' to clearly identify their purpose and maintain consistency with the `System.Exception` class.

EA custom exception class can extend other classes besides the Exception class.Correct

A custom exception class can extend another custom exception class, which in turn extends `System.Exception`, thereby forming a hierarchy of exception types and allowing for more structured error management.

Concept tested: Custom Apex Exceptions

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_with_exceptions.htm

Topics

#Apex Exceptions#Custom Classes#OOP (Inheritance)#Apex Naming Conventions

Community Discussion

No community discussion yet for this question.

Full PDI Practice