html5 upwork test Questions and answers

1.       Which of the following is NOT a valid value for the < iframe > sandbox attribute in HTML 5.0?
Answer:  url
 

2.       What is the output when you use the HTML 5.0 code snippet shown below?
< body onload=”alert(this)” >
Answer:       It will alert saying “[object Window]” when the document is loaded.
 
3.       How does a button created by the < button > tag differ from the one created by an < input > tag?
Answer:      . An input tag button can be a reset button too.
 
4.       How will you change the value of the cookies and items in the Storage objects of the localStorage attributes in  HTML 5.0? 
        Answer:       By invoking the window. navigator.yieldForStorageUpdates() API method.
 
5.       What is the default background color for the canvas element in HTML 5.0?
Answer:         Transparent
 
6.     Which of the following values would be passed on by clicking the submit button on selecting Item 2 from the list? 
Answer:         90
7.       Which of the following statements is correct if you allow the user to select only one radio button from a group of radio buttons?
Answer:        The name of the input tag must be the same for all the radio buttons.
 
8.       When is the window onstorage event triggered in the HTML document? 
Answer:         It is triggered when a document performs an undo function.
 
9.       Which of the following video file formats are currently supported by the < video > element of HTML 5.0?
Answer:         MPEG 4,
  Ogg
 
10.   Which of the following < iframe > attributes are NOT supported in HTML 5.0?
Answer:        marginheight
 
11.   What is the function of the history traversal task source in HTML 5.0?
Answer:        It is used to queue calls to history.back() and similar APIs.
 
12.   A computer programming book has to go online. Which of the following tags is ideal for displaying the program snippets?
Answer:       < code > 
 
13.   Which of the following are valid HTML 5.0 elements?
Answer:     All are correct
 
14.   What does the icon attribute of the HTML 5.0 command tag define?
< command icon=”?” >Click Me!< /command >
Answer:     It is used to define the url of an image to display as the command.
 
15.   How will you return a reference to the parent of the current window or subframe in an HTML 5.0 web application?
Answer:     window.parent
 
16.   Which of the following are valid mouse events in HTML 5.0?
Answer:      All are correct
 
17.   Which of the following is NOT a valid attribute for the < link > element in HTML 5.0?
Answer:       hreflang
 
18.   Which media event is triggered when there is an error in fetching media data in HTML 5.0?
Answer:       onstalled
 
19.   Which of the following is NOT a valid syntax for the < h1 > element in HTML 5.0? 
Answer:     < h1 align=”center” > This is header 1< /h1 >
 
20.   Whichtag event is fired when the user leaves the document?
Answer:      onunload
 
21.   Which form event is fired on the click of a button using a button tag with its type attribute value equal to submit?
Options:
Answer:     onsubmit
 
22.   Which of the following is an INVALID value for the type attribute of command tag?
Answer:     command
 
23.   Which of the following is correct with regard to the oncanplaythrough event fired by media resources in the HTML 5.0 document?
Answer:       The script will run when the media is played to the end, without stopping for buffering.
 
24.   In HTML 5.0, 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:      button
 
25.   Which of the following is an INVALID keyword value for http-equiv attribute when used with the < meta > element in HTML 5.0?
Answer:     expires, set-cookie, keywords, author
 
26.   What will be the result if you use the following code to your HTML 5.0 document?
< p >I use < del >MAC< /del > < ins >Microsoft< /ins >!< /p > /p >
Answer:     I use MAC Microsoft!
 
27.   What is the role of the < dfn > element in HTML 5.0?
Answer:       It is used to define a definition term
 
28.   Which of the following is NOT a supported attribute of the < ol > element in HTML 5.0?
Answer:       compact
 
29.   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 href=”mailto:webmaster@xcompany.com” >webmaster< /a >
 
30.   While rendering your HTML 5.0 web page, which of the following < link > element files will get skipped by a compliant user agent if you include the link elements shown below in your document?
< link rel=”stylesheet” href=”A” type=”text/plain” > < link rel=”stylesheet” href=”B” type=”text/css” >

Answer:       A link element whose href is “A”
 
31.   In HTML 5.0, what is the function of the sandbox attribute when used with < iframe > as shown below?
< iframe src=”aaa ” sandbox=? >< /iframe >
Answer:      It is used to define the restrictions to the frame content.

32.   In HTML 5.0, how will the script be executed if you use the script element shown below?
< script src=”script.js” type=”text/javascript” defer=”defer” >< /script >
Answer:     The script will be executed when the page has finished parsing.
 
 
33.   Which of the following represents INVALID syntax for defining an attribute value in an HTML 5.0 document? 
Answer:     < input name=be evil / >
 
 
 34.  Which of the following is NOT a valid attribute for the element in HTML 5.0? 
     Answer:          http-equiv
 
 35.   Which of the following is NOT a valid attribute for the <video> element in HTML 5.0?

      Answer:         disabled 
 
 36. Which media event will be fired when a media resource element suddenly becomes empty?
Answer:        onemptied

 

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

 Answer: There is no limit                                                                
 
38. Which following are valid default values for the <input type=”date”> HTML5 element?
 
Answer:    2013-05-30
 
39. Which is the standard method for clearing a canvas?
Answer:     context.clearRect ( x, y, w, h);
 
40. Once an application is offline, it remains cached until the following happens (select all that apply):
 
Answer:       The manifest file is modified


41. Which HTML5 doctype declarations are correct?
Answer:      <!DOCTYPE html>
 
42. Which of the following <link> attributes are not supported in HTML5?
Answer:         Rev,  d.charset
 
43. The following are valid use cases of client file/directory access in HTML5, except:
 
Answer:        Use of HTML5 File API
 
44. Which method of HTMLCanvasElement is used to represent image of Canvas Element?
 
Answer:       toDataURL()
 
45. Which of the following is the correct way to store an object in a localStorage?
 
 Answer:       localStorage.setItem(‘testObject’, JSON.stringify(testObject))
  
 
46.  Which of the following examples contain invalid implementations of the ampersand character in HTML5?
 
        Answers:        foo &0; bar

 

 47.    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”);

48.  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]*” />

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

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

 

 

 
 



Categories: Upwork Test

1 Comment

Leave A Reply

Your email address will not be published.

error: Alltutorial.in content is protected !!