Tuesday, December 13, 2016

HTML5 Upwork (oDesk) TEST ANSWERS 2016

Question:     Which method of HTMLCanvasElement is used to represent image of Canvas Element?
Answers:     toDataURL()

Question:     You want to create a link for your website allowing users to email the webmaster. How will you implement this if the webmaster's email address is webmaster@xcompany.com?
Answers:     <a href="mailto:webmaster@xcompany.com">webmaster</a>

Question:     What is the limit to the length of HTML attributes?
Answers:     There is no limit.

Question:     Which of the following is the correct way to store an object in localStorage? var obj = { 'one': 1, 'two': 2, 'three': 3 };
Answers:     localStorage.setItem('obj', JSON.stringify(obj));

Question:     Which of the following are valid ways to associate custom data with an HTML5 element?
Answers:     <tr class="foo" data-id-type="4">

Question:     Which of the following statements are correct with regard to the <hr> and <br> elements of HTML5?
Answers:     The <hr> element is used to insert the horizontal line within the document and the <br> element is used to insert a single line break.

Question:     Which of the following video tag attributes are invalid in HTML5?
Answers:     Pause

Question:     When does the ondragleave mouse event get fired in HTML5?
Answers:     It gets fired when an element leaves a valid drop target.

Question:     Which of the following is the correct way to check browser support for WebSocket?
Answers:     console.log(window.WebSocket ? 'supported' : 'not supported');

Question:     Which of the following HTML5 features is capable of taking a screenshot of a web page?
Answers:     Canvas

Question:     You are writing the code for an HTML form and you want the browser to retain the form's input values. That is, if a user submits the form and presses the browser's back button, the fully populated form is displayed instead of a blank form. Which of the following HTML 5 attributes will you use?
Answers:     Autocomplete

Question:     How can audio files be played in HTML5? var sound = new Audio("file.wav");
Answers:     sound.play();

Question:     Which of the following code is used to prevent Webkit spin buttons from appearing on web pages?
Answers:     input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

Question:     Which media event will be fired when a media resource element suddenly becomes empty?
Answers:     onemptied

Question:     Consider the following items of a <select> list: <option value="89">Item 1</option> <option value="90">Item 2</option> Which of the following values would be passed on by clicking the submit button on selecting Item 2 from the list?       
Answers:     90

Question:     Which is the standard method for clearing a canvas?
Answers:     context.clearRect ( x , y , w , h );

Question:     Which of the following methods can be used to estimate page load times?    
Answers:     Using the Navigation Timing JavaScript API.

Question:     What is the role of the <dfn> element in HTML5?
Answers:     It is used to define a definition term.

Question:     What is the difference between Server-Sent Events (SSEs) and WebSockets In HTML5?
Answers:     WebSockets can perform bi-directional (client-server and vice versa) data transfers, while SSEs can only push data to the client/browser.

Question:     What does P2P streaming mean when web applications establish a P2P HTTP connection using HTML?
Answers:     It means that streaming of a voice/video frame is direct, without using any server between them.

Question:     Which of the following statements regarding WebSockets is true?
Answers:     All of the abvoe

Question:     Which HTML5 doctype declarations are correct?
Answers:     <!DOCTYPE html>

Question:     The following are valid use cases of client file/directory access in HTML5, except:
Answers:     Use of the HTML5 File API

Question:     How does a button created by the <button> tag differ from the one created by an <input> tag?
Answers:     A button tag can include images as well.

Question:     Which of the following <link> attributes are not supported in HTML5?
Answers:     "rev" or "charset"

Question:     Which of the following is the correct way to display a PDF file in the browser?      
Answers:     <object type="application/pdf" data="filename.pdf" width="100%" height="100%"/>

Question:     True or false: JavaScript objects can be stored directly into localStorage.
Answers:     False

Question:     Which media event is triggered when there is an error in fetching media data in HTML5?
Answers:     onstalled

Question:     Which of the following are sample use cases for HTML5 web workers?
Answers:     All of these.

Question:     Which of the following is the correct way to play an audio file in HTML5?  
Answers:     <audio controls> <source src="file.ogg" type="audio/ogg"> <source src="file.mp3" type="audio/mpeg"> </audio>

Question:     Once an application is offline, it remains cached until the following happens (select all that apply):
Answers:     The manifest file is modified. or The user clears their browser's data storage for the site.

Question:     Can we store JavaScript Objects directly into localStorage ?
Answers:     NO

Question:     Which of the following attributes gets hidden when the user clicks on the element that it modifies? (Eg. hint text inside the fields of web forms)
Answers:     placeholder

Question:     What is the purpose of the <q> element in HTML5?
Answers:     It is used to define the start of a short quotation

Question:     Which of the following is the correct way to play an audio file in HTML5?  
Answers:     21 u <audio controls> <source src="file.ogg" type="audio/ogg"> <source src="file.mp3" type="audio/mpeg"> </audio>

Question:     Which of the following are true about the ARIA role attribute in HTML5?   
Answers:     The attribute must have a value that is a set of space-separated tokens representing the various WAI-ARIA roles that the element belongs to.

Question:     Which following are valid default values for the <input type="date"> HTML5 element?
Answers:     2013-05-30

Question:     Which of the following is not a valid attribute for the <video> element in HTML5?         
Answers:     disabled

Question:     Which of the following is not a valid syntax for the <link> element in HTML5?    
Answers:     <link rev="stylesheet" href="abc.css" type="text/css" target="_parent">

Question:     How can an HTML5 canvas size be changed so that it fits the entire window?


Answers:     <script type="text/javascript"> function resize_canvas(){ canvas = document.getElementById("canvas"); if (canvas.width < window.innerWidth) { canvas.width = window.innerWidth; } if (canvas.height < window.innerHeight) { canvas.height = window.innerHeight; } } </script>

No comments: