HTML5 oDesk Test Answer 2015



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


Ans. c) canvas.getContext(“2d”);

2. Can we store JavaScript Objects directly into localStorage?

Ans. b) No

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

 Ans. b) 90

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

Ans. a) ctx.drawImage(img,10,10);


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

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


Ans. b) 

6. How can audio files be played in HTML5? 

var sound = new Audio(“file.wav”); 

Ans. d) sound.play(); 

7. How does a button created by the <button> tag differ from the one created by  an <input> tag?

Ans. d) A button tag can include images as well.

8. In HTML5, which of the following is not a valid value for the type attribute when  used with the tag shown below? Click Me!

Ans. a)  button 

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

Ans. a) The application cache is programmatically updated.
        c) The manifest file is modified.
        d) The user clears their browser’s data storage for the site.


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

Ans. c) Use of the HTML5 File API

11. The following link is placed on an HTML webpage:
 
         http://msdn.com/&#8221; target=”_blank”> MSDN


What can be inferred from it?

Ans. b) It will open the site msdn.com in a new window.

12. True or False:

HTML5 Canvas can be used to create images.

Ans. a) True

13. True or false:

JavaScript objects can be stored directly into localStorage.

Ans. b) False

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

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

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

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

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

Ans. b) YYYY-MM-DD

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

Ans. c) There is no limit.

18. What is the purpose of the " element in HTML5?"

Ans. c) It is used to define the start of a short quotation.

19. What is the role of the element in HTML5?

Ans. d) It is used to define a definition term.

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

Ans. b) It gets fired when an element leaves a valid drop target.

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

Ans. c) onblur

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

Ans. b) 2013-05-30

23. Which HTML5 doctype declarations are correct?

Ans. b)
        d) 


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

Ans. a) context.clearRect ( x , y , w , h );

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

Ans. a) onstalled

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

Ans. d) onemptied

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

Ans. a) toDataURL()

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

Ans. a) toDataURL

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

  Ans. b) rev
          c) charset 


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

Ans. d) All of these.

31. Which of the following are the valid values of the element’s target attribute in HTML5?

Ans. a) _blank
        b) _self
        c) _top 


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

Ans. a) Every HTML element can have an ARIA role attribute specified.
        c) 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.


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


Ans. a)
        c) 


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


Ans. c) placeholder

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


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


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

Ans. c) foo &0; bar

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

Ans. c) Canvas

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

Ans. c)

39. Which of the following is not a valid attribute for the element in HTML5?

Ans. c) disabled

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

Ans. d) !!window.HTMLCanvasElemen 





Share on Google Plus

About Unknown

I'm a professional web designer and wordpress theme developer. I also like to write blog post.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment