BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam DEX-450 Topic 11 Question 89 Discussion

Actual exam question for Salesforce's DEX-450 exam
Question #: 89
Topic #: 11
[All DEX-450 Questions]

A developer creates a custom exception as shown below:

public class ParityException extends Exception {}

What are two ways the developer can fire the exception in Apex?

Choose 2 answers

Show Suggested Answer Hide Answer
Suggested Answer: B, D

Contribute your Thoughts:

Malinda
5 months ago
True, so it's A and D then. A bit tricky but manageable once you think it through.
upvoted 0 times
...
Jamal
5 months ago
B looks correct but it has a string parameter which our custom exception doesn't handle.
upvoted 0 times
...
Edward
5 months ago
Ha! I guess the developer is really into parity. Maybe they should create a 'ParityMatchException' instead. But B and D are the correct answers.
upvoted 0 times
...
Lamonica
5 months ago
I think both B and D are correct. Depends on whether you want to include a custom message or not.
upvoted 0 times
Helga
4 months ago
B) throw new ParityException("parity does not match");
upvoted 0 times
...
Rusty
4 months ago
A) new ParityException();
upvoted 0 times
...
Lisha
4 months ago
B) throw new ParityException("parity does not match");
upvoted 0 times
...
Jose
5 months ago
B) throw new ParityException("parity does not match");
upvoted 0 times
...
Cortney
5 months ago
A) new ParityException();
upvoted 0 times
...
Kiera
5 months ago
A) new ParityException();
upvoted 0 times
...
...
Rossana
5 months ago
Good point. Actually, D seems right. Also, B looks like it might be okay?
upvoted 0 times
...
Ma
6 months ago
I agree with option D for sure. But isn't option A missing a throw keyword?
upvoted 0 times
...
Delsie
6 months ago
Option B is the way to go! Throwing the exception with a message is more informative for the caller.
upvoted 0 times
Hoa
5 months ago
B) throw new ParityException("parity does not match");
upvoted 0 times
...
Tawny
5 months ago
A) new ParityException();
upvoted 0 times
...
...
Jamal
6 months ago
Yup, throwing exceptions in Apex is important too. I'm leaning towards options A and D.
upvoted 0 times
...
Malinda
6 months ago
This question is quite technical. Understanding custom exceptions is crucial.
upvoted 0 times
...

Save Cancel