exam questions

Exam 98-382 All Questions

View all questions & answers for the 98-382 exam

Exam 98-382 topic 1 question 30 discussion

Actual exam question from Microsoft's 98-382
Question #: 30
Topic #: 1
[All 98-382 Questions]

HOTSPOT -
You are creating a function that does safe division.
The function has the following requirements:
✑ The function receives two parameters for the numerator and denominator.
✑ If the denominator is zero, the function must return false.
✑ If the denominator is not zero, the function must return true.
You write the following code. Line numbers are included for reference only.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
References:
https://www.w3schools.com/js/js_comparisons.asp
https://www.w3schools.com/jsref/jsref_if.asp

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
Ciupaz
Highly Voted 4 years, 9 months ago
This function returns always True
upvoted 9 times
becky_intelletive
4 years, 6 months ago
You're right, it does. They likely meant if (denominator === 0) instead of if (denominator = 0)
upvoted 1 times
...
kisskeo
3 years, 9 months ago
always return true. I checked in the console.
upvoted 1 times
...
...
dev_ash
Most Recent 3 years, 3 months ago
denominator === 0 not denominator = 0 in this if check
upvoted 1 times
...
123nickname123
4 years, 3 months ago
The function will always return false because denominator = 0 is always true
upvoted 2 times
toby5
4 years, 1 month ago
No, it will always return TRUE, because denominator = 0 is an assignment, not a conditional expression. That's a deliberate trap, I guess, to test the knowledge of = vs ===.
upvoted 2 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 ...