Get Full Version of the Exam
You must complete the ShowCanWeAfford() function:
Display the message Denied! If the PaymentAmount variable is greater than 500. Display the message Approved! If the PaymentAmount variable is less than 300.
Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater than 300.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code segments and arranging them in the correct order.)
You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on the page.
The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page.
You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as described. Select No if it does not. Make only one selection in each column.
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No if it does not. Make only one selection in each column.
A CSS style sheet must be applied dynamically. The style must visibly change the appearance of the paragraph on the page.
You need to apply a style the paragraph. Which line of code should you use?
document.getElementById(quot;testquot;).style.border = quot;0quot;;
document.getElementById(quot;testquot;).style.position = quot;staticquot;;
document.getElementById (quot;testquot;).style.padding = quot;15pxquot;;
document.getElementById(quot;testquot;).style.top = quot;5pxquot;;
Correct Answer: C
The padding clears an area around the content (inside the border) of an element. The padding is affected by the background color of the element.
You develop an HTML5 web application. The web application contains a form that allows users to enter only their month of birth.
The value that the users enter must be numbers between 1 and 12, inclusive. You need to implement the form element for the month of birth.
Which element should you use?
lt;input type=quot;timequot; options=quot;monthquot; /gt;
lt;input types=quot;submitquot; value=quot;monthquot; /gt;
lt;input type=quot;rangequot; min=quot;1quot; max=quot;12quot; /gt;
lt;input type=quot;monthquot; itemscope=quot;numericquot; /gt;
Correct Answer: C Explanation: Example:
lt;input type=quot;rangequot; name=quot;rangeInputquot; min=quot;0quot; max=quot;100quot; onchange=quot;updateTextInput(this.value);quot;gt;
lt;input type=quot;textquot; id=quot;textInputquot; value=quot;quot;gt;
You are developing an HTML5 web application for an architectural company that displays architectural blueprints.
The application must:
Display the blueprints at different zoom levels without loss of detail Print the blueprints without loss of detail
Work from only one source file per blueprint
You need to ensure that blueprints display according to the requirements. Which HTML5 element should you use?
Correct Answer: C
You develop an HTML5 application that allows users to upload files from their local computers. The user interface must remain responsive during the upload.
You need to implement the file upload functionality for the application.
Which two actions should you perform? (Each correct answer presents a complete solution. Choose two.)
Use an HTML form with a file type INPUT element that targets a hidden IFRAME element.
Use a file type INPUT element, and then use the Web Storage API to upload the file.
Use a FormData object and upload the file by using XMLHttpRequest.
Register the file protocol by using protocol handler registration API and then upload the file by using XMLHttpRequest.
Use the FileSystem API to load the file, and then use the jQuery post method to upload the file to the server.
Correct Answer: BD
Example (notice the web storage api upload.aspx):
lt;titlegt;Upload Files using XMLHttpRequest – Minimallt;/titlegt; lt;/headgt;
lt;form id=quot;form1quot; enctype=quot;multipart/form-dataquot; method=quot;postquot; action=quot;Upload.aspxquot;gt; lt;div class=quot;rowquot;gt;
lt;label for=quot;fileToUploadquot;gt;Select a File to Uploadlt;/labelgt;lt;br /gt; lt;input type=quot;filequot; name=quot;fileToUploadquot; id=quot;fileToUploadquot; onchange=quot;fileSelected();quot;/gt; lt;/divgt;
lt;input type=quot;buttonquot; onclick=quot;uploadFile()quot; value=quot;Uploadquot; /gt; lt;/divgt;
Because we#39;re using XMLHttpRequest, the uploading is happening in the background. The page the user is on remains intact. Which is a nice feature to have if your business process can work with it.
The XMLHttpRequest object has gotten a facelift in the Html5 specifications. Specifically the XMLHttpRequest Level 2 specification (currently the latest version) that has included the following new features:
Handling of byte streams such as File, Blob and FormData objects for uploading and downloading
Progress events during uploading and downloading Cross-origin requests
Allow making anonymous request – that is not send HTTP Referer The ability to set a Timeout for the Request
You are developing a web application that can function when users are not connected to the Internet.
You need to check the Internet connectivity status of a user#39;s browser. Which method should you use?
Correct Answer: D
navigator.onLine is a property that maintains a true/false value (true for online, false for offline). This property is updated whenever the user switches into quot;Offline Modequot; by selecting the corresponding menu item
You are creating a page that contains detailed employee information for a company portal. The page uses a jQuery library. The page contains a hidden button named btnEdit that is defined by the following code.
lt;button id=quot;btnEditquot; style=quot;display: none;ngt;Editlt;/buttongt; The button is not displayed by default.
The button must be displayed only if the user is logged on.
You need to add code to the document.ready() function to meet the requirements for the button. Which line of code should you use?
$ (`#btnEdit#39;).appear ();
$ (`#btnEdit#39;).visible = true;
Correct Answer: C
With no parameters, the .show() method is the simplest way to display an element:
$( quot;.targetquot; ).show();