Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 70-480 topic 4 question 49 discussion

Actual exam question from Microsoft's 70-480
Question #: 49
Topic #: 4
[All 70-480 Questions]

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?

  • 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");
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
Example:
if (value < -100 || value > 100)
{
throw new ValidationException(String.Format("Value is {0} than {1}.",
(value > 100 ? "greater" : "less"), value));
}

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
eMax
Highly Voted 4 years, 6 months ago
ValidationException.Exception is confusing should be: throw new ValidationException(123, "bla-bla");
upvoted 9 times
...
East106
Most Recent 3 years, 7 months ago
The correct answer A without ".Exception"
upvoted 1 times
...
nelaed
3 years, 9 months ago
Right answer is combination of B & C throw new ValidationException(123, "Day of week must be less than 7");
upvoted 1 times
...
piroman
4 years, 4 months ago
No correct answer....
upvoted 3 times
...
JMz123
4 years, 5 months ago
less than OR EQUAL TO 7. A is correct.
upvoted 1 times
...
Daniel_Stubkjaer
4 years, 11 months ago
wrong answer shown (A should bee C), but right answer used in example
upvoted 1 times
mogec39
4 years, 6 months ago
answer C without NEW, it's wrong
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...