Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are...

53
https://www.gratisexam.com/ 98-382.exam.24q Number : 98-382 Passing Score : 800 Time Limit : 120 min https://www.gratisexam.com/ 98-382 Introduction to Programming Using JavaScript

Transcript of Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are...

Page 1: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

98-382.exam.24q

Number: 98-382Passing Score: 800Time Limit: 120 min

https://www.gratisexam.com/

98-382

Introduction to Programming Using JavaScript

Page 2: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Exam A

QUESTION 1You 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?

https://www.gratisexam.com/

A. document.getElementById("tester").value = randomQuote();

B. document.getElementById("tester").title = randomQuote();

C. document.getElementById("tester").innerHTML = randomQuote();

D. document.getElementById("tester").script = randomQuote();

Correct Answer: CSection: (none)

Page 3: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Explanation

Explanation/Reference:Explanation:

References: https://www.w3schools.com/html/html_scripts.asp

QUESTION 2HOTSPOT

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:

Page 4: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 5: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 3You 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

Page 6: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

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.)

A. onmouseup

B. onmouseout

C. onmosedown

D. onmouseover

E. onmouseenter

Correct Answer: BDSection: (none)Explanation

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

QUESTION 4You are writing a JavaScript program for Contoso Suites that will output HTML.

You need to output each room type on a new line using the correct method.

You create the following code for the function. Line numbers are included for reference only.

Page 7: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

You need to insert the correct code at Line 9. Which line should you use?

A. document.getElementById("body").innerHTML = rooms[i] + line.innerHTML;

B. document.getElementById("para").innerHTML += rooms[i] + line.innerHTML;

C. document.getElementById("para").innerHTML += i + rooms + line.innerHTML;

D. document.getElementById("body").innerHTML += rooms + i;

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 5DRAG DROP

You are using JavaScript to create a calculator.

You create the following HTML. Line numbers are included for reference only.

Page 8: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

You must create a function named add() that adds the values in the a and b input elements and displays the result in the result input element.

You define the following function in JavaScript:

function add() {}

You need to complete the body of the function.

Which three code segments should you use to develop the solution? To answer, move the appropriate code segments from the list of code segments to the answerarea and arrange them in the correct order.

NOTE: Each correct selection is worth one point.

Select and Place:

Page 9: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 10: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 6HOTSPOT

For each of the following segments, select Yes if the statement is true. Otherwise, select No.

NOTE: Each correct selection is worth one point.

Page 11: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Hot Area:

Correct Answer:

Page 12: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

References: https://www.w3schools.com/tags/ref_httpmethods.asp

QUESTION 7You are creating a web page that allows customers to choose how hot their spice is. If they choose spicy, a warning should be displayed.

You create the following form. Line numbers are included for reference only.

Page 13: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

You create the following JavaScript code to display the warning.

When you choose spicy and click Order, the warning fails to display.

You need to solve this problem.

https://www.gratisexam.com/

What should you do?

A. Change line 07 to <button onchange = “checkWarning();”>Order</button>

B. Change line 07 to <button onclick = “checkWarning;”>Order</button>

C. Change line 10 to var option.value = document.forms.orderForm[“heatIndex”];

D. Change line 10 to

Page 14: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

var option = document.forms.orderForm[“heatIndex”].value;

Correct Answer: DSection: (none)Explanation

Explanation/Reference:References: https://www.w3schools.com/jsref/coll_doc_forms.asp

QUESTION 8DRAG DROP

You are creating a web page that tests a user’s ability to accurately type text. The validation should be case-insensitive.

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

Page 15: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 16: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 17: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 18: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 9DRAG DROP

A JavaScript array is initialized as follows:

You write the following code to manipulate the array:

You need to determine the contents of the array.

Which four elements does the array contain in sequence? To answer, move the appropriate elements from the list of elements to the answer area and arrangethem in the correct order.

Select and Place:

Page 19: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Section: (none)Explanation

Explanation/Reference:

Page 20: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Explanation:

References: https://www.bennadel.com/blog/1796-javascript-array-methods-unshift-shift-push-and-pop.htm

QUESTION 10HOTSPOT

You need to evaluate the following code segment. Line numbers are included for reference only.

Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment.

Hot Area:

Page 21: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 22: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 23: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 24: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

QUESTION 11You are writing an engineering application. You need to create a function that will round numbers to 3 or more decimal places.

You need to create a function that receives the following two parameters:The value parameter is the number to be formattedThe digits parameter is the number of digits to display

The function must return the value with the number of digits specified.

Which function should you use?

A.

B.

C.

D.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:References: https://www.w3schools.com/jsref/jsref_tofixed.asp

QUESTION 12HOTSPOT

Page 25: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

You analyze the following code fragment. Line numbers are included for reference only.

Hot Area:

Correct Answer:

Page 26: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

QUESTION 13HOTSPOT

You work as a JavaScript developer for Adventure Works. You are writing a simple script that performs the following actions:Declares and initializes an arrayFills the array with 10 random integersAdds every other number starting with the first 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:

Page 27: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 28: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 29: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 30: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

References:https://www.w3schools.com/jsref/jsref_push.asphttps://www.w3schools.com/js/js_arrays.asphttps://stackoverflow.com/questions/9813573/how-to-perform-a-sum-of-an-int-array

QUESTION 14HOTSPOT

You are writing a JavaScript program for Blue Yonder Airlines. The program stores various information about the airline’s flights.

The program has initialized the following variables:

You need to determine the data type of the code segment based on initialization and the assignment of the variables. Use the drop-down menus to select theanswer choice that answers each question based on the information presented in the code segment.

NOTE: Each correct selection is worth one point.

Hot Area:

Page 31: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 32: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 33: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 34: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 15HOTSPOT

You are creating JavaScript code that manipulates dates. You want to initialize a Date object with the date January 1, 2017 by using the year, month, and dateparameters.

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

Hot Area:

Page 35: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 16HOTSPOT

Your instructor has asked you to write a program that uses simple rules to help determine if a person should take the train, drive their car, or ride a bike, dependingon the conditions of the weather and the amount of gas in the car’s tank.

The program has the following requirements:When the temperature is above 65 degrees and it is not raining, the person should be told to ride their bike.When it is raining, the person should be told to drive their car.

Page 36: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

If their car has half a tank of gas or less, they should be told to take the train.

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

Hot Area:

Correct Answer:

Page 37: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

Page 38: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

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

QUESTION 17HOTSPOT

You are using JavaScript to create a function that calculates admission price.

https://www.gratisexam.com/

The function must meet the following requirements:The function accepts the age of the customer as a parameterA customer who is less than 5 years old gets in freeA customer who is 65 years old or older gets in freeA customer who is 5 years old to 17 years old, pays $10 USDAll other customers pay $20 USD

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:

Page 39: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 40: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 18DRAG DROP

Page 41: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

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 areaand arrange them in the correct order.

Select and Place:

Correct Answer:

Page 42: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

References: http://www.plus2net.com/javascript_tutorial/array-two-dimension.php

QUESTION 19HOTSPOT

You are using JavaScript to write a safe root math utility that has the following requirements:Given the function safeRoot(a, b):If the radicand (a) is non-negative, return Math.pow (a, 1/b);

Page 43: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Otherwise,If the index (b) is divisible by 2, then return text indicating the result is imaginary.Otherwise return -Math.pow (-a, 1/b)

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:

Page 44: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 45: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Page 46: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Page 47: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 20HOTSPOT

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:

Page 48: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Correct Answer:

Section: (none)Explanation

Explanation/Reference:Explanation:

Page 49: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

References:https://www.w3schools.com/js/js_comparisons.asphttps://www.w3schools.com/jsref/jsref_if.asp

QUESTION 21HOTSPOT

Variable x has a value of 5. Variable y has a value of 7.

For each of the following expressions, select True if the statement evaluates to true. Otherwise, select False.

NOTE: Each correct selection is worth one point.

Hot Area:

Correct Answer:

Page 50: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:

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

QUESTION 22This question requires that you evaluate the underlined text to determine if it is correct.

You review the following JavaScript code:

When this code executes, the value of x is 0.

Page 51: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Review the underlined text. If it makes the statement correct, select “No change is needed”. If the statement is incorrect, select the answer choice that makes thestatement correct.

A. No change is needed

B. the value of x is 3

C. the value of x is 5

D. the value of x is undefined

Correct Answer: ASection: (none)Explanation

Explanation/Reference:References: https://www.w3schools.com/js/js_arithmetic.asp

QUESTION 23You are creating a JavaScript program for an accounting system.

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

You evaluate the code to ensure that it follows JavaScript best practices.

Which line should you change?

A. 01

B. 02

C. 03

D. 04

E. 05

Correct Answer: CSection: (none)

Page 52: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 24You are writing a function that calculates the remainder for integer division. The function receives two parameters, a and b, and must return the remainder that isleft over when the integer a is divided by the integer b.

You create the following code. Line numbers are for reference only.

You want to complete the function for lines 02 and 03.

Which two sets of code segments should you use? Each correct answer presents a complete solution. (Choose two.)

A.

B.

C.

D.

E.

F.

Correct Answer: ESection: (none)Explanation

Page 53: Microsoft.Selftestengine.98-382.v2019-01-27.by.Dorothy · 2019-01-27 · Exam A QUESTION 1 You are designing a web page with a script that must dynamically change the content of a

https://www.gratisexam.com/

Explanation/Reference:References: https://www.w3schools.com/js/js_arithmetic.asp

https://www.gratisexam.com/