Upwork Test Answer HTML5 Skill Test (Latest)

Upwork Test Answers of HTML5 Skill Test

Question: 01
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>
Answer: c. var context = canvas.getContext(“2d”);


Question: 02
Can we store JavaScript Objects directly into localStorage?
Answer: b. No


Question: 03
For 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?
Answer: b. 90


Question: 04
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?
Answer: a. Ctx.drawImage(img, 10, 10);


Question: 05
How can an HTML5 canvas size be changed so that it fits the entire window?
Answer: b. <script type=”text/javascript”>
              function resize_canvas() {
                       canvas = document.gatElementById(“”canvas);
                      if (canvas.width < window.innerWidth)
                      {
                           Canvas.width = window.innerWidth;
                      }
                     if (canvas.height < window.innerHeight)
                      {
                           Canvas. height = window.innerHeight;
                      }
             }
</script>


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


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


Question: 08
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>
Answer: a. Button


Question: 09
Once an application is offline, it remains cached until the following happens (select all that apply):
Answer: b. The manifest file is modified


Question: 10
The following are valid use cases of client file/directory access in HTML5, except:
Answer: c. Use of HTML5 File API


Question: 11
The following link is placed on an HTML webpage:
<a href="http://msdn.com/" target="_blank"> MSDN </a>
What can be inferred from it
Answer: b. It will open the site msdn.com in a new window.


Question: 12
True or False:
HTML5 Canvas can be used to create images.
Answer: a. True


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


Question: 14
What is the difference between server-sent Events (SSEs) and websockets in HTML?
Answer: a. Websockets can perform bi-directional (client-server and  vice versa) data transfers, while SSEs can only push data to the client/browser.


Question: 15
What is the internal/wire format of input type=”date” in HTML5?
Answer: a. YYYY-MM-DD


Question: 16
What is the limit to the length of HTML attributes?
Answer: a. There is no limit


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



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


Question: 19
Which event is fired when an element loses its focus in an HTML5 document?
Answer: c. Onblur


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


Question: 21
Which HTML5 doctype declarations are correct?
Answer: c. <!DOCTYPE html>


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


Question: 23
Which media event is triggered when there is an error in fetching media data in HTML5?
Answer: a.Onstalled


Question: 24
Which media event will be fired when a media resource element suddenly becomes empty?
Answer: c. Onemptied


Question: 25
Which method of HTMLCanvasElement is used to represent image of Canvas Element?
Answer: a. toDataURL()


Question: 26
Which of the following <link> attributes are not supported in HTML5?
Answer: a. Rev,  d.charset


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


Question: 28
Which of the following are the valid values of the <a> element's target  attribute in HTML5?
Answer: a._blank
           b. _self
           c. _top


Question: 29
Which of the following are true about the ARIA role attribute in HTML5?
Answer: a. Every HTML element can have an ARIA role attribute specified.


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


Question: 31
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)
Answer: c. placeholder


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


Question: 33
Which of the following examples contain invalid implementations of the ampersand character in HTML5?
Answer: c. foo &0; bar


Question: 34
Which of the following HTML5 features is capable of taking a screenshot of a web page?
Answer: c. Canvas


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


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


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


Question: 38
Which of the following is the best method to detect HTML5 Canvas support in web browsers?
Answer: d. !!window.HTMLCanvasElement


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


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


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


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


Question: 43
Which of the following is the correct way to store an object in a localStorage?
Answer: a. localStorage.setitem(‘testobject’, JSON.stringify(testobject))


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


Question: 45
Which of the following methods can be used to estimate page load times?
Answer: b. Using the Navigation Timing Javascript API


Question: 46
Which of the following shows correct use of client-side data validation in HTML5, on username and password fields in particular?
Answer: a.  <input name="username" required/>
<input name="usernamepass" type="password" required/>


Question: 47
Which of the following statements are correct with regard to the <hr> and <br> elements of HTML5?
Answer: b. 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: 48
Which of the following statements regarding WebSockets is true?
Answer: d. All of the above


Question: 49
Which of the following video file formats are currently supported by the <video> element of HTML5?
Answer: b. MPEG 4
        c. Ogg


Question: 50
Which of the following video tag attributes are invalid in HTML5?
Answer: d. pause


Question: 51
Which of the following will detect when an HTML5 video has finished playing?
Answer: a. var video = document.getElementsByName('video')[0];
               video.onended = function(e) {
               }


Question: 52
Which of the following will restrict an input element to accept only numerical values in a text field?
Answer: a. <input type="text" pattern="[0-9]*"/>
          b. <input type="number"/>
          c. <input type="text" pattern="/d*"/>


Question: 53
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?
Answer: D. formtarget


Question: 54
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?
Answer: a. <a href="mailto:webmaster@xcompany.com" >webmaster</a>


Question: 55
Which of the following input element variations will a numeric keypad in mobile browsers?
Answer: <input type='number' />


Question: 56
Which of the following is true while coding HTML5 in visual studio?
Answer: Visual studio has built in tag support and validation for HTML5


Question: 57
What is the best way to define the character set of an HTML5 web page?
Answer: <meta charset='utf-8'>


Question: 58
Which of the following are possible ways to make the browser automatically adds new images and discards deleted images with server-side events in HTML5?
Answer: Server-sent Events 
              WebSockets

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

1 Comment

All UpWork Test Answer Solution - http://upworktestanswer.com/

ReplyReply Delete