Which code segment should you use?
Which code segment should you use?
You are developing an application that consumes an external web service that returns the latest stock rate.
The application has two methods:
The getResults() method makes an AJAX web servicerequest
The ShowRate() method displays the stock rate from the web service response
You need to ensure that the ShowRate() method always displays the latest stock rate.
Which code segment should you use?
Which three statements should you implement in sequence?
DRAG DROP
You are developing an application that reads information from a file.
The application must:
Execute a block of code if there is an error accessing the file
Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence? (To answer, move the appropriate statements from the list of actions to the answer area and arrange them in the correct order.)
How should you write the code?
HOTSPOT
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
Generate an error
Assign “200” to the error number
Assign “Invalid” to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, select the appropriate option from the drop-down list in the answer area.)
Which code segment should you use?
How should you build the code segment?
DRAG DROP
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a string that identifies the data type of the object.
You have the following requirements:
The function must return “Number” if the object is a number
The function must return “String” if the object is a string
The function must return “Unknown” if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all.
You may need to drag the split bar between panes orscroll to view content.)
Which line of code should you use?
You are testing the value of the following variablein JavaScript.
var height = “300”;
A block of code must execute if the following conditions are true:
– The height variable is set to 300
– The height variable is of type string
You need to implement the code to run the test.
Which line of code should you use?
Which code segment or segments should you use?
DRAG DROP
You are developing an application for an online retailer. The company ships only to certain countries.
The application must:
Store a list of country codes in an array
Validate the country code of the shipping address against the countries array
Include a Boolean value in the array that indicateswhether or not you can ship to the country
Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot
ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code segment or segments from the list of code segments to the correct location or locations in the work area. Each code segment may be used once, more than once, or not atall. You may need to drag the split bar between panes or scroll to view content.)
Which line of code should you use?
DRAG DROP
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker;
Register an event listener for the web worker
Start and stop the web worker
You need to define a function that performs the required tasks.
Which line of code should you use? (To answer, dragthe appropriate line or lines of code to the correct location or locations. Each line of code may be used once, more than once, or not at all. You may needto drag the split bar between panes or scroll to view content.)
Which three types of objects should you use? (Each correct answer presents a complete solution
You are developing a web application that uses web workers to process images extracted from an HTML5 CANVAS object on a web page.
You need to pass messages between the web workers and the web page.
Which three types of objects should you use? (Each correct answer presents a complete solution. Choose three.)