PrepAway - Latest Free Exam Questions & Answers

Which line of code should you insert at line 09?

You are developing a JavaScript library.
You have the following requirements:
Custom exceptions must include an error message and custom error number.
These exceptions must be thrown when data validation errors occur.
Developers must call the library to easily catch the exception and identify the problem.
You develop the following code. (Line numbers are included for reference only.)

You need to complete the code to meet the requirements.
Which line of code should you insert at line 09?

PrepAway - Latest Free Exam Questions & Answers

A.
throw new ValidationException.Exception (123, “Day of week must be les3 than 7”);

B.
return new ValidationException(123, “Day of week must be less than 7”);

C.
throw ValidationException(123, “Day of week must be less than 7”);

D.
catch ValidationException(123, “Day of week: must be less than 7”);

Explanation:
Example:
if (value < -100 || value > 100)
{
throw new ValidationException(String.Format(“Value is {0} than {1}.”,
(value > 100 ? “greater” : “less”), value));
}

3 Comments on “Which line of code should you insert at line 09?

  1. kaggelpiep says:

    This is so goddamn killing when studying for 70-480. Even the PAID PREMIUM exams which are supposed to be 100% verified have erroneous answers and typo’s in them. I would have chosen A if it wasn’t for the .Exception typo. Chose B instead (which I wouldn’t have done without the typo) which was of course wrong. Good to see you people have chosen A as the correct answer as well.




    0



    0

Leave a Reply