exam questions

Exam 98-382 All Questions

View all questions & answers for the 98-382 exam

Exam 98-382 topic 1 question 26 discussion

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

DRAG DROP -
Your instructor has asked you to implement code that would display a two-dimensional array of any size inside a <div> tag.
You write the following code:

You need to complete the code.
Which three segments should you use to develop the solution? To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
References: http://www.plus2net.com/javascript_tutorial/array-two-dimension.php

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
Sveppur
Highly Voted 5 years ago
Is that actually correct? Won't each sub-array be iterated through, skipping first few elements in each consecutive one? I think it should rather be: for (var i = 0; i < board.length; i++) { for (var j = 0; j < board[i].length; j++) { div.innerHTML = div.innerHTML + board[i][j] + ' '; } div.innerHTML = div.innerHTML + '<br>'; } } This way, each sub-array will be displayed entirely.
upvoted 10 times
...
becky_intelletive
Highly Voted 4 years, 5 months ago
The answer is incorrect. It should actually be the other for loop with var j. Correct: for (var i = 0; i < board.length; i++) { for (var j = 0; j < board[0].length; j++) { div.innerHTML += board[i][j] + ' '; } div.innerHTML += '<br>'; } Note: it doesn't matter if we use board[i].length or board[0].length in this case because we know for certain that each sub-array is the same length since it's a 2D array.
upvoted 7 times
...
123nickname123
Most Recent 4 years, 3 months ago
definitely wrong answer
upvoted 1 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 ...