nerdexam
Microsoft

98-382 · Question #1

98-382 Question #1: Real Exam Question with Answer & Explanation

Sign in or unlock 98-382 to reveal the answer and full explanation for question #1. The question stem and answer options stay visible for context.

Question

You need to write a loop that will traverse the length of an array to find the value orange. If an array element value is null, the code should immediately go to the next element. When the value is found, the loop should exit. How should you complete the code? To answer, drag appropriate keywords to the correct locations. Each keyword may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. Keywords: for, break, continue, while, do Complete the following code snippet:
<!DOCTYPE html>
<html>
<head>
<script>
function doWork() {
 var list = ["apple", "pear", null, "orange", "banana"];
 // Box 1
 (var i = 0; i < list.length; ++i) {
 if(list[i] == null) {
 // Box 2
 }
 if(list[i] == "orange") {
 alert("found");
 // Box 3
 }
 }
 console.log(list[i]);
}
</script>
</head>
<body>
<input type="button" value="test" onclick="doWork()" />
</body>
</html>

Unlock 98-382 to see the answer

You've previewed enough free 98-382 questions. Unlock 98-382 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 98-382 Practice