Introduction to Programming Using JavaScript

Here you have the best Microsoft 98-382 practice exam questions

  • You have 38 total questions to study from
  • Each page has 5 questions, making a total of 8 pages
  • You can navigate through the pages using the buttons at the bottom
  • This questions were last updated on December 15, 2024
Question 1 of 38

HOTSPOT -

You are designing a web page that contains a blue button. When the button is pressed, it should call a function that displays the message "˜Welcome!'. When the cursor hovers over the button, the button should turn red. When the cursor leaves the button, the button should revert back to its original color of blue.

You want to complete the markup using the appropriate HTML events.

How should you complete the markup? To answer, select the appropriate event in the answer area.

NOTE: Each correct selection is worth one point.

Hot Area:

    Correct Answer:

    References: https://www.w3schools.com/jsref/dom_obj_event.asp

Question 2 of 38

DRAG DROP -

You are creating a web page with a script. The script will insert the window's location inside the page's input element.

How should you complete the code? To answer, drag the appropriate code segment to the correct locations. Each code segment 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.

Select and Place:

    Correct Answer:

    References: https://www.w3schools.com/js/js_window_location.asp

Question 3 of 38

You are designing a web page with a script that must dynamically change the content of a paragraph element to display the value returned by the function

.

randomQuote()

You have created the following code. Line numbers are included for reference only.

Which code segment should you use at line 08?

    Correct Answer: C

    To dynamically change the content of a paragraph element, the innerHTML property is used. This property sets or returns the HTML content inside an element. In this case, we want to update the content of the paragraph with the id 'tester' to display a new quote from the randomQuote() function. Therefore, the correct code segment to use is document.getElementById('tester').innerHTML = randomQuote();.

Question 4 of 38

HOTSPOT -

You are designing a web page that contains a list of animals. The web page includes a script that outputs animals from a list.

You create the following HTML to test the script:

You need to create a function that will display the list of animals, including any formatting, in the div element.

How should you complete the code? To answer, select the appropriate code segments in the answer area.

NOTE: Each correct selection is worth one point.

Hot Area:

    Correct Answer:

    References: https://www.w3schools.com/jsref/met_element_getelementsbytagname.asp

Question 5 of 38

You are creating a dynamic HTML page by using JavaScript.

Your page has an image of the sun. When the user's mouse pointer moves across the image of the sun, the image should change to the image of the moon.

When the user's mouse pointer is no longer over the image should change back to the image of the sun.

You need to write the code for the image swap.

Which two events must you program for? (Choose two.)

    Correct Answer: B, D

    To change the image when the user's mouse pointer moves across the image, you need an event to detect when the pointer enters the area of the image and another event for when it leaves. The 'onmouseover' event triggers when the mouse pointer enters the element area, making it ideal for changing the image from the sun to the moon. The 'onmouseout' event triggers when the mouse pointer leaves the element area, which is perfect for changing the image back to the sun. These events are designed precisely for handling such hover interactions.