exam questions

Exam 70-480 All Questions

View all questions & answers for the 70-480 exam

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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
eMax
Highly Voted 5 years, 1 month ago
ValidationException.Exception is confusing should be: throw new ValidationException(123, "bla-bla");
upvoted 9 times
...
East106
Most Recent 4 years, 2 months ago
The correct answer A without ".Exception"
upvoted 1 times
...
nelaed
4 years, 4 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
5 years ago
No correct answer....
upvoted 3 times
...
JMz123
5 years, 1 month ago
less than OR EQUAL TO 7. A is correct.
upvoted 1 times
...
Daniel_Stubkjaer
5 years, 6 months ago
wrong answer shown (A should bee C), but right answer used in example
upvoted 1 times
mogec39
5 years, 2 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago