98-382 Exam Questions
40 real 98-382 exam questions with expert-verified answers and explanations. Page 1 of 1.
- Question #1Control Flow with Decisions and Loops
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....
for loopbreakcontinuearray traversal - Question #2Perform Operations using Data Types and Operators
You are creating a JavaScript function that returns a date the specified number of months in the future of the current date. The function must meet the following requirements: - Ac...
Date objectgetMonthsetMonthJavaScript methods - Question #3Perform Troubleshooting and Error Handling
You are designing a function that allows you to perform unit tests on other functions in a library. You will invoke each library function by using the eval JavaScript function. If...
try/catchexception handlingeval()error display - Question #4Perform Operations using Data Types and Operators
Evaluate the following code. Line numbers are included for reference only. 01 var n = 50; 02 var c = n + 5; 03 var a = n % 2; 04 var d = c / 11; 05 n = d * 2; 06 console.log(n, c,...
variable assignmentarithmetic operatorsmoduloexpression tracing - Question #5Perform Troubleshooting and Error Handling
You 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...
DOM accessform elementsdebuggingvalue property - Question #6
What should you do?
- Question #7Document and Structure Code
You are evaluating a colleague's code to ensure it meets best practices. For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each...
naming conventionscommentsreserved wordsvariable naming - Question #8Perform Troubleshooting and Error Handling
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 t...
assignment vs comparisonif statementoperator bugdebugging - Question #9Perform Input and Output Operations
You are creating a web page that requests a username. You create the following HTML form: ```html <form id="credentials" action="#" method="get"> <p>Username: <input type="text" id...
DOM accessform inputdocument.formsvalue property - Question #10Perform Operations using Data Types and Operators
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...
logical operatorsboolean expressions&&|| - Question #11Perform Operations using Data Types and Operators
Evaluate the truth value of each expression below.
boolean expressionslogical operatorstruth valuescomparison operators - Question #12Perform Operations using Data Types and Operators
You analyze the following code fragment. Line numbers are included for reference only. ```javascript 01 "use strict"; 02 var val1 = 25; 03 var val2 = 4; 04 function multiply() { 05...
variable scopenested functionsclosuresstrict mode - Question #13Implementing Flow Control
Declares and initializes an array Fills the array with 10 random integers Adds every other number starting with the first element How should you complete the code? To answer, selec...
arraysMath.randomloopsiteration - Question #14Implementing Flow Control
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. You are given a partial JavaS...
if/elsefunctionsMath.sqrtconditional logic - Question #15Variables, Data Types, and Functions
You need to determine the values of sampleStudent.name, sampleCourse.name, and sampleCourse.grade that are output by console.log(). What are the final values for the three variable...
objectspropertiesreference typesconsole.log - Question #16Working with the Document Object Model (DOM)
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: ```javascript var div = doc...
2D arraysnested loopsDOM manipulationinnerHTML - Question #17
This question requires that you evaluate the underlined text to determine if it is correct. You review the following JavaScript code: ```javascript var x = 15; x %= 5; ``` When thi...
- Question #18Variables, Data Types, and Functions
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 date parameters. How shoul...
Date objectconstructorinitializationparameters - Question #19
You are creating a JavaScript program for an accounting system. You create the following code. Line numbers are included for reference only. ```javascript 01 var firstName = "Jo";...
- Question #20
What is the data type for line 01?
- Question #21
What is the data type for line 04?
- Question #22
What is the data type for line 05?
- Question #23Performing Operations
You are creating a calendar application. You need to ensure that the code works correctly for all months of the year. How should you complete the code? To answer, select the approp...
Date objectgetMonthcalendarmonths - Question #24Implementing Flow Control
You are creating a function named countdown. The function accepts a single parameter, start, and displays a countdown from that number down to zero in increments of one. How should...
functionsloopscountdownparameters - Question #25Performing Operations
You are planning to use the Math object in a JavaScript application. You write the following code to evaluate various Math functions: ```javascript var ceil = Math.ceil(100.5); var...
Math.ceilMath.floorMath.roundMath object - Question #26Working with the Document Object Model (DOM)
For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point. Statements: 1. External JavaScript...
script placementexternal JavaScriptinternal JavaScriptHTML structure - Question #27Working with the Document Object Model (DOM)
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 appro...
window.locationgetElementByIdDOM manipulationinput element - Question #28Implementing Flow Control
The ABC company offers a mid-week discount of 10% on Wednesdays. You need to write a JavaScript function that meets the following requirements: -> Accepts the day of the week as a...
switch statementfunctionsbreak statementdiscount logic - Question #29Working with the Document Object Model (DOM)
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: ```...
DOM manipulationinnerHTMLgetElementByIdul/li elements - Question #30
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 cre...
- Question #31
You 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 is left over when t...
- Question #32Working with the Document Object Model (DOM)
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 th...
HTML eventsonclickonmouseoveronmouseout - Question #33Working with the Document Object Model (DOM)
You are developing a web page that uses JavaScript. The script needs to display information to the user using a popup box. Match each function that displays a popup box with its ap...
alertconfirmpromptdialog boxes - Question #34Variables, Data Types, and Functions
You need to evaluate the following code segment. Line numbers are included for reference only. ```javascript 01 var n; 02 console.log(typeof n); 03 var a = "3.4"; 04 console.log(ty...
typeof operatordata typesundefinednull - Question #35Working with the Document Object Model (DOM)
For each of the following segments, select Yes if the statement is true. Otherwise, select No. Statements: 1. When using a GET request with a form, the data length is restricted. 2...
GET requestPOST requestform handlingHTTP methods - Question #36Performing Operations
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, move to ans...
string methodstoLowerCasestring comparisonvalidation - Question #37Working with the Document Object Model (DOM)
You are using JavaScript to create a calculator. You create the following HTML. Line numbers are included for reference only. 01 <form id="calculator"> 02 <input type="text" id="a"...
getElementByIdinput valuestype conversionDOM manipulation - Question #38Performing Operations
A JavaScript array is initialized as follows: `var array = [20, 40, 60, 80];` You write the following code to manipulate the array: `array.shift();` `array.pop();` `array.push(10);...
array methodsshiftpoppush/unshift - Question #39
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 chang...
- Question #40Implementing Flow Control
You are using JavaScript to create a function that calculates admission price. The function must meet the following requirements: ⇨ The function accepts the age of the customer as...
if/elseconditional logicfunctionscomparison operators