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 elcome 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:
HOTSPOT
You are planning to use the Math object in a JavaScript application. You write the following code to evaluate various Math functions:
What are the final values for the three variables? To answer, select the appropriate values in the answer area. NOTE: Each correct selection is worth one point.
Hot Area:
HOTSPOT
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, depending on 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.
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:
HOTSPOT
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 a parameter A customer who is less than 5 years old gets in free A customer who is 65 years old or older gets in free A customer who is 5 years old to 17 years old, pays $10 USD All 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:
HOTSPOT
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);
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:
HOTSPOT
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 an exception occurs when invoking a function, you want to display a
message box with the following message:
The function does not exist.
How should you complete the code? To answer, select the appropriate code segment in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
DRAG DROP
You are creating a web page that requests a username.
You create the following HTML form:
You need to write a function that retrieves the username from the form.
How should you complete the code? To answer, drag the appropriate code segments 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.
NOTE: Each correct selection is worth one point.
Select and Place:
DRAG DROP
You are using JavaScript to create a calculator.
You create the following HTML. Line numbers are included for reference only.
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 answer area and arrange them in the correct order.
NOTE: Each correct selection is worth one point.
Select and Place:
DRAG DROP
Evaluate the following code. Line numbers are included for reference only.
What is the value of each variable at line 07? To answer, drag the appropriate value to the correct variable. Each value 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.
NOTE: Each correct selection is worth one point.
Select and Place:
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.)
A. onmouseup
B. onmouseout
C. onmosedown
D. onmouseover
E. onmouseenter