HTML5 Freelancing Test Questions and Answers

HTML5 is the upgraded version of HTML (Hyper Text Markup Language). HTML5 is the lots of new tags and code is updated So you can easily use in your website.

Well in my blog I have provided a Latest Questions answers of HTML5 Language. Which is Very useful in the Interview as well as clear Freelancing Exam.

1. Which of the following is the best method to store an array in localStorage?

  • var names = []; names[0] = prompt(“New member name?”); localStorage[“names”] = JSON.stringify(names); var storedNames = JSON.parse(localStorage[“names”]);

2. 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?

  • 90

3. What is the purpose of the <q> element in HTML5?

  • It is used to define the start of a short quotation.

Which event is fired when an element loses its focus in an HTML5 document?

  • Onblur

4. 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)

  • Placeholder

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

  • Button

6. Which of the following attributes are not supported in HTML5?

  • Rev

7. Which is the standard method for clearing a canvas?

  • context.clearRect ( x , y , w , h );

8. Which of the following examples contain invalid implementations of the ampersand character in HTML5?

  • foo &0; bar

9. Which of the following statements regarding WebSockets is true?

  • It communicates with the server with only the data required by the application. It lowers the latency of connections for interactive web applications. It scales better and consumes less server resources than HTTP AJAX/long-poll.

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

  • var context = canvas.getContext(“2d”);

11. What is the role of the <dfn> element in HTML5?

  • It is used to define a definition term.

12. Which of the following is a possible way to get fullscreen video played from the browser using HTML5?

  • <video height=”100%” width=”100%”>

13. 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?

  • 90

14. The following are valid use cases of client file/directory access in HTML5, except:

  • Use of the HTML5 File API

15. Which of the following are the valid values of the <a> element’s target attribute in HTML5?

  • _blank

16. How does a button created by the tag differ from the one created by an tag?

  • A button tag can include images as well.

17. Which method of HTMLCanvasElement is used to represent image of Canvas Element?

  • toDataURL()

18. Can we store JavaScript Objects directly into localStorage?

  • No

19. When does the ondragleave mouse event get fired in HTML5?

  • It gets fired when an element leaves a valid drop target.

20. Once an application is offline, it remains cached until the following happens (select all that apply):

  • The manifest file is modified.

21. What is the internal/wire format of input type=”date” in HTML5?

  • YYYY-MM-DD

22. Which of the following is not a valid syntax for the

element in HTML5?

23. What does P2P streaming mean when web applications establish a P2P HTTP connection using HTML?

  • It means that streaming of a voice/video frame is direct, without using any server between them.

24. Which of the following will detect when an HTML5 video has finished playing?

  • var video = document.getElementsByTagName(‘video’)[0]; video.onended = function(e) { }

25. What is the difference between Server-Sent Events (SSEs) and WebSockets in HTML5?

  • WebSockets can perform bi-directional (client-server and vice versa) data transfers, while SSEs can only push data to the client/browser.

26. Which of the following methods can be used to estimate page load times?

  • Using the Navigation Timing JavaScript API.

27. Which of the following are valid ways to associate custom data with an HTML5 element?

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

29. Which method of the HTMLCanvasElement is used to represent an image of a canvas element?

toDataURL

30. Which of the following is the correct way to store an object in localStorage?

  • localStorage.setItem(‘obj’, JSON.stringify(obj));

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

  • var context = canvas.getContext(“2d”);

32. Which of the following code is used to prevent Webkit spin buttons from appearing on web pages?

  • input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

33. Which of the following will restrict an input element to accept only numerical values in a text field?

34. Which of the following is the correct way to display a PDF file in the browser?

35. Which of the following is the best method to detect HTML5 Canvas support in web browsers?

  • !!window.HTMLCanvasElement

36. Which media event is triggered when there is an error in fetching media data in HTML5?

  • Onstalled

37. Which of the following is the correct way to check browser support for WebSocket?

  • console.log(window.WebSocket ? ‘supported’ : ‘not supported’);

38. Which of the following video file formats are currently supported by the

element of HTML5?

  • MPEG 4

39. Which of the following shows correct use of client-side data validation in HTML5, on username and password fields in particular?

40. Which of the following is not a valid attribute for the

element in HTML5?

  • Disabled

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

  • ctx.drawImage(img,10,10);

42. Which of the following is the correct way to store an object in a localStorage?

  • localStorage.setItem(‘testObject’, JSON.stringify(testObject))

43. How can audio files be played in HTML5?

  • sound.play();

44. Which of the following is the correct way to play an audio file in HTML5?

45. Which HTML5 doctype declarations are correct?

46. 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 [email protected]?

47. Which of the following are sample use cases for HTML5 web workers?

  • Polling URLs in background, Syntax highlighting without blocking code editing capabilities in online IDEs, Motion tracking input in realtime with a video element

48. Which media event will be fired when a media resource element suddenly becomes empty?

  • Onemptied

49. 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?

  • Autocomplete

50. Which of the following HTML5 features is capable of taking a screenshot of a web page?

  • Canvas

51. Which of the following are true about the ARIA role attribute in HTML5?

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

52. Which of the following video tag attributes are invalid in HTML5?

  • Pause

53. True or False:

HTML5 Canvas can be used to create images.

  • True

54. Which of the following statements are correct with regard to the


and
elements of HTML5?

  • The
    element is used to insert the horizontal line within the document and the
    element is used to insert a single line break.

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

MSDN

What can be inferred from it?

  • It will open the site msdn.com in a new window.

56.Which following are valid default values for the HTML5 element?

  • 2013-05-30

57. True or false:

JavaScript objects can be stored directly into localStorage.

  • False

58. What is the limit to the length of HTML attributes?

  • There is no limit.

About The Massive Technolab

Avatar
Who We Are

Massive Technolab is a Leading IT services Company in India that expertise in web Development, Web Design and SEO at affordable rates.

Leave a Comment

comments powered by Disqus