Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
 
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

Upwork HTML5 test Answer (New)

1. Which of the following statements regarding WebSockets is true?
 Answers: • All of the above.

 2. Assuming that some text needs to be written on an HTML5 canvas, select a replacement for the commented line below:
 <canvas id="e" width="200" height="200"></canvas>
 <script>
 var canvas = document.getElementById("e");
 //insert code here
 context.fillStyle = "blue";
 context.font = "bold 16px Arial";
 context.fillText("Zibri", 100, 100);
 </script>
 Answers: • var context = canvas.getContext("2d");

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

 4. Which of the following is a possible way to get fullscreen video played from the browser using HTML5?
 Answers: • <video height="100%" width="100%">

 5. 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


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

 7. Which of the following are the valid values of the <a> element's target attribute in HTML5?
 Answers: • _blank

 8. 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.

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

 10. Can we store JavaScript Objects directly into localStorage?
 Answers: • No

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

 12. Once an application is offline, it remains cached until the following happens (select all that apply):
 Answers: • The manifest file is modified.

 13. What is the internal/wire format of input type="date" in HTML5?
 Answers: • YYYY-MM-DD

 14. 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">

 15. 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.

 16. Which of the following will detect when an HTML5 video has finished playing?
 Answers: • var video = document.getElementsByTagName('video')[0]; video.onended = function(e) { }

 17. 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.

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

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

 20. 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>

 21. Which method of the HTMLCanvasElement is used to represent an image of a canvas element?
 Answers: • toDataURL

 22. 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));

 23. Assuming that some text needs to be written on an HTML5 canvas, select a replacement for the commented line below:

 <canvas id="e" width="200" height="200"></canvas>
 <script>
 var canvas = document.getElementById("e");
 //insert code here
 context.fillStyle = "blue";
 context.font = "bold 16px Arial";
 context.fillText("Zibri", 100, 100);
 </script>
 Answers: • var context = canvas.getContext("2d");

 24. 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; }

 25. Which of the following will restrict an input element to accept only numerical values in a text field?
 Answers: • <input type="text" pattern="[0-9]*" />

 26. 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%"/>

 27. Which of the following is the best method to detect HTML5 Canvas support in web browsers?
 Answers: • !!window.HTMLCanvasElement

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

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

 30. Which of the following video file formats are currently supported by the <video> element of HTML5?
 Answers: • MPEG 4

 31. Which of the following shows correct use of client-side data validation in HTML5, on username and password fields in particular?
 Answers: • <input name="username" required /> <input name="pass" type="password" required/>

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

 33. Consider the following JavaScript code:

 var c=document.getElementById("myCanvas");
 var ctx=c.getContext("2d");
 var img=document.getElementById("img");

 Which method will correctly draw an image in the x=10, y=10 position?
 Answers: • ctx.drawImage(img,10,10);

 34. Which of the following is the correct way to store an object in a localStorage?
 Answers: • localStorage.setItem('testObject', JSON.stringify(testObject))

 35. How can audio files be played in HTML5?

 var sound = new Audio("file.wav");
 Answers: • sound.play();

 36. 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>

 37. Which HTML5 doctype declarations are correct?
 Answers: • <!DOCTYPE html>

 38. 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>

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

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

 41. 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

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

 43. 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.

 44. Which of the following video tag attributes are invalid in HTML5?
 Answers: • pause

 45. True or False:

 HTML5 Canvas can be used to create images.
 Answers: • True

 46. 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.

 47. The following link is placed on an HTML webpage:

 <a href="http://msdn.com/" target="_blank"> MSDN </a>

 What can be inferred from it?
 Answers: • It will open the site msdn.com in a new window.

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

 49. True or false:

 JavaScript objects can be stored directly into localStorage.
 Answers: • False
 50. What is the limit to the length of HTML attributes?
 Answers: • There is no limit.

 51. Which of the following examples contain invalid implementations of the ampersand character in HTML5?
 Answers: • foo &0; bar

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

 53. Which of the following <link> attributes are not supported in HTML5?
 Answers: • rev

 54. In HTML5, which of the following is not a valid value for the type attribute when used with the <command> tag shown below?

 <command type="?">Click Me!</command>
 Answers: • button

 55. 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

 56. Which event is fired when an element loses its focus in an HTML5 document?
 Answers: • onblur

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

 58. 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

 59. Which of the following is the best method to store an array in localStorage?
 Answers: • var names = []; names[0] = prompt("New member name?"); localStorage["names"] = JSON.stringify(names); var storedNames = JSON.parse(localStorage["names"]);