Friday, July 11, 2014

odesk test html 5 ans

Question no.1: Which media event is triggered when there is an error in fetching media data in HTML 5.0?

Ans: on stalled.

Question no.2: which of the following video file formats are currently supported by the <video> element of HTML 5.0?

Ans: MPEG 4


Question no.3:   which of the following is an invalid  value for the type attribute of command tag?

Ans: command

Question no.4: which of the following is NOT a valid value for the <i frame> sand box attribute in HTML 5.0?

Ans: url

Question no.5: what is the function of the history traversal task source in HTML 5.0?

Ans: it is used to queue calls to history .back () and similar APIs

Question no.6: 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> 

Ans: i use MAC microsoft

Question no.7: 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 webmaeter@xcompany.com?

Ans: <a href = "mailto.webmaster@xcompany.com">webmaster</a>

Question no.8: in HTML 5.0 how will the script be executed  if you use the script element shown below?
  <script src="script.js"type="text/java script"defer="defer"></script> 

Ans: b. the script will be the executed when the page has finished parsing.

Question no.9: what is the output when you use the HTML 5.0 code snippet shown below?
<body on load=" alert (this)">

Ans: it will be alert saying "[object window]" when the document is loaded.

Question no.10: a computer programming book has to go online. what of the following tags is ideal for displaying the program snippet?

Ans:<code>

Question no.11: how will you bind the details option (shown below) with an <input> element, whose type attribute is set to url to get the result shown in the image?

 Ans: user should define a list attribute to the input element whose type is url.

Question no.12: which of the following are valid a html 5.0 element?

Ans: (check ALL)

Question no.13: how does a button created by the <button> tag differ from the one created by an <input > tag?

Ans: an input tag button can be a reset button too.

Question no.14: which of the following attributes comes in handy when borders have to be put between group of columns instead of every column?

Ans: col group

Question no.15: which of the following is correct with regard to the on can play through event fired by media recourse in the HTML 5.0 document?

Ans: the script will run when the media is played to the end, without stopping for buffering.

Question no.16: what does the icon attribute of the HTML 5.0 command tag define?
<command icon="?">click me!</command>

 Ans:it is used to define the url of an image to display as the command.

Question no.17: 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 element shown belowin your document?
<link rel ="stylesheet"href="A"type = "text/plain">
<link rel=stylesheet"href="B"type="text/css">

Ans: a link element whose href  is= "A"

Question no.18: which <body> tag event is find when the user leaves the document?

Ans: on unload

Question no.19: how will you change the value of the cookies and items in the storage objects of the local storage attribute in HTML 5.0?

Ans: by invoking the window .navigator. yield For Storage updates()Apimathod

Question no.20: what is the role of the <dfn> element in HTML 5.0?

Ans: it is used to define a definition term.

Question no.21: which of the following is NOT a valid syntax for the <h1>element in HTML 5.0?

Ans: <h1 align="center">this is header 1</h1>

Question no.22: which from event is fired on the click of a button using a button tag with its type attributes value equal to submit?

Ans: on submit

Question no.23: how will you return a reference to the parent of the current window or subframe in an HTML5.0 web application    ?

ans: window parent.

 Question no.24: in HTML 5.0,which of the following is NOT a valid value for the type attribute when used the when  used with the<command>tag shown below?
<command type="?">Click me!</command>

Ans: button.

Question no.25: what is the default background color for the canvas element in HTML 5.0?

 Ans: Transparent

Question no.26: which of the following are valid mouse events in HTML 5.0?

Ans: (check ALL) 


   
Question no.27: which of the following language will you use to print the graphic designed using the HTML 5.0 <canvas> tag?

Ans: java script

Question no.28: consider the following item s 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 a selecting item 2 from the list?

Ans: 90

Question no.29: when is the window on stored event triggered in the HTML document?

Ans: it is triggered when a document perform an undo function.

Question no.30: which of the following is NOT a value attributes for the <video> element in HTML 5.0?

Ans: disabled

Question no.31: which of the following represents INVALID syntax for defining as attribute value in a HTML 5.0 document?

Ans: <input name= be evil/>

question no.32: consider the above code. what will be the impact upon the contents element if both the style sheets define the same class?
 the question is based upon the figure shown below:  

Ans: the content of the element will be of blue color and will inherit all the effects of style1.css 

Question no.33: which of the following is NOT a valid attribute for the <link> element in HTML 5.0?

 Ans: hreflang

Question no.34: which of the following is an INVALID keyword value for http equiv attribute when used with the <meta> element in HTML 5.0?

Ans: expires , set cookies , keyword, author

  Question no.35: which of the following statements is correct if you allow the user to select only one radio button from a group of the radio buttons? 

Ans: the name of the input tag must be the same for all the radio buttons.

Question no.36: which of the following <iframe> attribute are NOT supported in HTML 5.0?

Ans: margin height, srolling

question no.37: in HTML 5.0 ,what is the function of the sandbox attribute when used with <iframe> as shown below?
<iframesrc= " aaa"sandbox=?></iframe>

Ans: it is used to define the restriction to the frame content.

Question no.38: which of the following is NOT a supported attribute of the <ol> element in HTML 5.0?

Ans: compact

Question no.39:which of the following   would give a yellow background to the web page?
 note: the  code used in the "correct" answer below was deprecated in HTML 4.01! use style instead for new code.

 Ans: <body bgcolor= "yellow">

Question no.40: what is the function of on obsolete ,an application cache API method in HTML 5.0?

Ans: it triggers an event when the cache content has been marked as obsolute.

  Question no.41: suppose you add the input code given about your HTML web page. what result will be returned by the java script function when you click the button marked as A in the image?

Ans: text

question no.42: how does a button created by the <button> tag differ from one created by an <input>tag?

Ans: an input tag button can include images as well.

Question no.43: which of the following HTML 5.0 elements is used to embed java applets into your HTML 5.0 web page?

Ans: <object>

Question no.44: which of the following is NOT a valid attribute for the element in HTML 5.0? 

  Ans: http equie.

Question no.45: which of the following are valid values for the content editable attribute of three element in HTML 5.0?

Ans: true,false

Question no.46: you want to display a table listing out customer names and their content information . the heading of the table is shown in the figure . what is the code for creating the first line of the table heading?

  Ans: b <tr>
<th>customer Name</th>
<th col span=3 contact </th>
</tr>

question no.47: which of the following <section> elements have the correct attributes assignment as per HTML 5.0?

 ans: c.<section id="EXAMPLE">...</section>
d. <section id="EXAMPLE">...</section>
<section id="EXAMPLE">...</section>

question no.48: which of the following statements is correct if you invoke the window prompt (message,default) web application API method in HTML 5.0?

Ans: both b and c

Question no.49:which of the following is NOT an attribute of the <meta> element in HTML 5.0?

Ans: scheme 

 Question no.50: which media event will be fired when a media resource element suddenly becomes empty?

 Ans: on emptied

Question no.51: what is the purpose of the <keygen> element in HTML 5.0?

Ans: it is used to generate a public private key pair in an HTML 5.0web page.

Question no.52: which event is fired when an element loses its focus in HTML 5.0 document?

Ans : on blur

Question no.53: a piece of text contains many blank space within it. which of the following tags would be suitable to display the text as it was originally formatted?

Ans: pre

Question no.54: which HTML 5.0 element will you use to group the related options in a drop down list?

 Ans: opt group

Question no.55: 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.0 attributes will you use?

Ans: form target.

Question no.56: which of the following tags would assist in creating named groups within a select list?

Ans: opt group.

   Question no.57: how will you cancel the timeouts that are set with the set Interval() API method identified by the handlers in HTML 5.0?

Ans:a. window. clear Interval(handle)
b. <tr>
<th> customer Name</th>
<th col span= 3> contact</th>
</tr>

Question no.58: what is the default background color for the canvas element in HTML 5.0?

Ans: transparent.

Question no.59: which of the following are valid values for the content editable attribute of the <figure > element in HTML 5.0?

Ans: false 

Question no.60: which media event is triggered when there is triggered when there is an error in fetching media data in HTML 5.0?

Ans: on suspend.

Question no.61: which of the following is NOT a valid attribute for the <link> element in HTML 5.0?

Ans: http equiv.

Question no.62: which of the following HTML 5.0 elements is used to embed java applets into your HTML 5.0 web page?

Ans: <object>

Question no.64: how does a button created by the <button> tag differ from the one created by an <input> tag?

Ans: an input tag button can include images as well.

Question no.65: how will you return a reference to the parent of the current window or sub frame in an HTML 5.0 wed application?

Ans: window.parent

Question no.66: suppose you add the input code given above to your HTML web page. what result will be returned  by the Java script function when you click the button market as A in the image?

ans: text.

Question no.67: which of the following statement is correct if you allow the user to select only one radio button from a group of radio buttons?

Ans: the name of the input tag must be the same for all the radio buttons.

Question no.68: what will be the result if you use the code to your HTML 5.0 document?
 <bdodir="rtl">
here is the some text that should be written to your document.
</bdo>

Ans: tnemucodruoyotenttirwebdluohstahttxetemossiereh.

Question no.69: which of the following would give a yellow background to the webpage?
note : the  code used in the "correct" answer below was deprecated in HTML 4.01! use styles instead  for new code.

Ans: <body bgcolor = "Yellow">

Question no.70: how will you change the value of the cookies and items in the storage object  the local Storage attributes in HTML 5.0?

Ans: by invoking the window .navigator .yieldForStorageUpdates() API method.




Question no.71: how will the target URL open when you define the <a> element in your HTML 5.0 document as shown below?

Ans: the target URL will open in the same document in which it was clicked.


Question no.72: what will be the browsing context if the browsing context if the browsing context name is _ top when the HTML 5.0 web page is loading?

Ans: it will load the linked document in the topmost frame.

Question no.73: which of the following is an INVALID value for the type attribute of command tag?

Ans: text


Question no.74: the following link is placed on an HTML webpage.

Ans: it will open the site msdn.com in a new window.  


Question no.75: you have the following directory structure.
webroot->products->ordered->delivered
the product directory has a page called Product. HTML.and the delivered directory has a page called Delivered.html. you want to provide a link to the products page on Delivered.html.the idea code should be:

Ans: <a href= "/..product.html">all product</a>

Question no.76: what will be result if you use the following code to your HTML 5.0 document?

<p>I use<del>MAC</del><ins>Microsoft</ins>!</p>

Ans:i use MAC Microsoft

Question no.77: which of the following is the correct syntax to define  charset in the html 5 <meta> element?

Ans: <meta char set=ISO-8859-1"> 

Question no.78: which of the following is the correct method to load another web page or reload the seme page in HTML 5.0?

Ans: all of the above

Question no.79: which <body> tag event fired when the user leaves the document?

Ans: on unload.

Question no.80: which event is fired when the history of the browser window changes?

Ans: on pop state. 


Question: 03
Which of the following is NOT a valid value for the <iframe> sandbox attribute in HTML 5.0?
a.     url
b.     allow-scripts
c.     allow-same-origin
d.     allow-forms

Question: 04
Which of the following is an INVALID value for the type attribute of command tag?
a.     checkbox
b.     radio
  c.     command
d.     text
Question: 05
What is the function of the history traversal task source in HTML 5.0?
a.     It is used for features that react to user interaction, for example, keyboard or mouse input.
b.     It is used for features that react to DOM manipulations, for example, the things that happen asynchronously when an element is inserted in the document.
   c.     It is used to queue calls to history.back() and similar APIs.
d.     All of the above.
Question: 06
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>
a.     I use MAC Microsoft!
b.     I use MAC Microsoft!
  c.     I use MAC Microsoft!
d.     I use MAC Microsoft!
Question: 07
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?
a.     <a href=”mailto:webmaster@xcompany.com”>webmaster</a>
b.     <ahref=”webmaster@xcompany.com”>webmaster</a>
c.     <a http=”mail:webmaster@xcompany.com”>webmaster</a>
d.     <mail http=”send:webmaster@xcompany.com”>webmaster</mail>
Question: 08
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>
a.     The script is fetched and executed immediately, before the user agent continues parsing the page.
  b.     The script will be executed when the page has finished parsing.
c.     The script will be executed asynchronously, as soon as it is available.
Question: 09
What is the output when you use the HTML 5.0 code snippet shown below?
<body onload=”alert(this)”>
a.     It will alert saying “[object HTMLBodyElement]” when the document is loaded.
b.     It will alert saying “[object Window]” when the document is loaded.
c.     It will alert saying “[this]” when the document is loaded.
d.     The alert message is not properly defined in the body element and an error will be generated when the document is loaded.
Question: 10
A computer programming book has to go online. Which of the following tags is ideal for displaying the program snippets?
a.     <emp>
b.     <code>
c.     <dfn>
d.     <cite>
Question: 11
How will you bind the datalist option (shown below) with an <input> element, whose type attribute is set to url, to get the result shown in the image?
 This question is based upon the figure shown below:
odesk answer test
a.     User should define an accept attribute to the input element whose type is url.
b.     User should define multiple attribute to the input element whose type is url.
c.     User should define a list attribute to the input element whose type is url.
d.     User should define a placeholder attribute to the input element whose type is url.
Question: 12
Which of the following are valid HTML 5.0 elements?
    a.     <canvas>     b.     <summary>
(Check ALL)
Question: 13
How does a button created by the <button> tag differ from the one created by an <input> tag?
   a.     An input tag button can be a reset button too.
b.     A button tag button can be a reset button too.
c.     An input tag button can include images as well.
d.     A button tag can include images as well.
Question: 14
Which of the following attributes comes in handy when borders have to be put between groups of columns instead of every column?
a.     col
    b.     colgroup
c.     rowspan
d.     row
Question: 15
Which of the following is correct with regard to the oncanplaythrough event fired by media resources in the HTML 5.0 document?
a.     The script will run when the media has reached the end.
  b.     The script will run when the media is played to the end, without stopping for buffering.
c.     The script will run when media data is loaded.
d.     The script will run when the length of the media is changed.
Question: 16
What does the icon attribute of the HTML 5.0 command tag define?
<command icon=”?”>Click Me!</command>
a.     It is used to define the url of an image to display as the command.
b.     It is used to define the name of the radiogroup this command belongs to.
c.     It is used to define if the command is checked or not.
d.     It is used to define if the command is available or not.
Question: 17
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”>
a.     A link element whose href is “B”
b.     A link element whose href is “A”
c.     None of the above
Question: 18
Which<body> tag event is fired when the user leaves the document?
a.     onunload
b.     onundo
c.     onredo
d.     onerror
Question: 19
How will you change the value of the cookies and items in the Storage objects of the localStorage attributes in HTML 5.0?
a.     By invoking the window.dialogArguments() API method.
  b.     By invoking the window. navigator.yieldForStorageUpdates() API method.
c.     By invoking the window.navigator.appName API method.
Question: 20
What is the role of the <dfn> element in HTML 5.0?
a.     It is used to define important text.
b.     It is used to define computer code text.
c.     It is used to define sample computer code.
d.     It is used to define a definition term
Question: 21
Which of the following is NOT a valid syntax for the <h1> element in HTML 5.0?
a.     <h1>This is header 1</h1>
   b.     <h1 align=”center”>This is header 1</h1>
c.     <h1 onClick=”dothis(‘sc1′)” >This is header </h1>
d.     <h1 style=”cursor:auto;”>This is header </h1>
Question: 22
Which form event is fired on the click of a button using a button tag with its type attribute value equal to submit?
a.     onload
b.     onsubmit
c.     onunload
d.     onreset
Question: 23
How will you return a reference to the parent of the current window or subframe in an HTML 5.0 web application?
a.     window.top
b.     window.parent
c.     window.frameElement
d.     None of the above
Question: 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>
a.     button
b.     command
c.     checkbox
d.     radio
Question: 25
What is the default background color for the canvas element in HTML 5.0?
a.     Black
b.     White
  c.     Transparent
d.     Gray
Question: 26
Which of the following are valid mouse events in HTML 5.0?
    a.     ondblclick     b.     ondragstart
(Check ALL)
Question: 27
Which of the following languages will you use to paint the graphics designed using the HTML 5.0 <canvas> tag?
a.     VB script
b.     JavaScript
c.     PostScript
d.     None of the above
Question: 28
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?
a.     89
   b.     90
c.     Item 1
d.     Item 2
Question: 29
Which of the following would give a yellow background to the web page?
Note: The code used in the “correct” answer below was deprecated in HTML 4.01! Use styles instead for new code.
a.     <body backcolor=”Yellow”>
b.     <body background=”Yellow”>
c.     <body bgcolor=”Yellow”>
d.     <body color=”Yellow”>
Question: 30
What is the function of onobsolete, an application cache API method in HTML 5.0?
a.     It reflows the HTML document using updated cached content.
b.     It triggers an event when the cache content has been marked as obsolete.
c.     It triggers an event when the cache content has been updated.
d.     It updates the cache for the current document in the background.
Question: 31
Which of the following represents INVALID syntax for defining an attribute value in an HTML 5.0 document?
a.     <input name =’be evil’ />
b.     <input name=be evil />
c.     <input name = “be-evil” />
d.     All of the above.
Question: 32
Consider the above code. What will be the impact upon the contents of the element if both the style sheets define the same class?
This question is based upon the figure shown below:
odesk answer test
a.     The contents of the element will be of red color and will inherit all the effects of style.css.
  b.     The contents of the element will be of blue color and will inherit all the effects of style1.css.
c.     The contents of the element will be of white color and will inherit all the effects of style.css and style1.css.
d.     None of the style effects will be applied to the contents of the element.
Question: 33
a.     hreflang
b.     rel
c.     http-equiv
d.     media
Question: 34
a.     The name of the input tag must be the same for all the radio buttons.
b.     The value of the input tag must be the same for all the radio buttons.
c.     The display text of the input tag must be the same for all the radio buttons.
d.     All the radio buttons must be added to the same group using the <optgroup> tag.
Question: 35
a.     content-type
b.     expires
c.     set-cookie
d.     keywords
e.     refresh
f.     author
Question: 36
a.     height
b.     marginheight
c.     sandbox
d.     scrolling
Question: 37
<iframesrc=”aaa ” sandbox=?></iframe>
a.     It is used to define the restrictions to the frame content.
b.     It is used to define the URL of the document that should appear in the iframe.
c.     It is used to specify that an iframe should appear as if it is part of the document the iframe is in.
Question: 38
a.     type
b.     reversed
c.     start
d.     compact
Question: 39
a.     It is triggered when the window is resized.
b.     It is triggered when a document loads.
c.     It is triggered when a document performs an undo function.
d.     It is triggered when the window becomes visible.
Question: 40
a.     controls
b.     autoplay
c.     disabled
d.     preload
                                              

Question: 01 
Which media event is triggered when there is an error in fetching media data in HTML 5.0?
a.     onstalled
b.     onwaiting
c.     onsuspend
d.     oninvalid-
Ans : a.     onstalled

Question: 02
Which of the following video file formats are currently supported by the <video> element of HTML 5.0?
a.     CCTV
 b.     MPEG 4
c.     Ogg
d.     3GPP
Ans :   b.     MPEG 4
Question: 03
Which of the following is NOT a valid value for the
a. It is used to define the restrictions to the frame content. 
b. It is used to define the URL of the document that should appear in the iframe.
c. It is used to specify that an iframe should appear as if it is part of the document the iframe is in.
 Ans : a. It is used to define the restrictions to the frame content. 
Question: 38-Which of the following is NOT a supported attribute of the <ol> element in HTML 5.0?
a. type
b. reversed
c. start
d. compact
 Ans : d. compact
Question: 29-When is the window onstorage event triggered in the HTML document?
a. It is triggered when the window is resized.
b. It is triggered when a document loads.
c. It is triggered when a document performs an undo function.
d. It is triggered when the window becomes visible.
Ans : c. It is triggered when a document performs an undo function.
Question: 30-Which of the following is NOT a valid attribute for the <video> element in HTML 5.0?
a. controls
b. autoplay
c. disabled
d. preload
Ans : c. disabled
Question: 41-Suppose you add the input code given above to your HTML web page. What result will be returned by the JavaScript function when you click the button marked as A in the image?
a.number
b.text
c.button
d.None of the above
Ans :b.text
Question : 42-How does a button created by the <button> tag differ from the one created by an <input>tag ?
a. An input tag button can be a reset button too.
b. A button tag button can be a reset button too.
c. An input tag button can include images as well.
d. A button tag can include images as well.
Ans : c. An input tag button can include images as well.
Question: 43-Which of the following HTML 5.0 elements is used to embed Java applets into your HTML 5.0 web page?
a.<applet>
b.<object>
c. <source>
d.<progress>
Ans : b.<object>
Question : 44-Which of the following is NOT a valid attribute for the element in HTML 5.0?
a.hreflang
b.rel
c.http-equiv
d.media
Ans :c.http-equiv
Question: 45-Which of the following are valid values for the contenteditable attribute oftheelement in HTML 5.0?
a.true
b.false
c.0
d.1
Ans :a.true
b.false
Question : 46-You want to display a table listing out customer names and their contact information. The heading of the table is shown in the given figure. What is the code for creating the first line of the table heading?
a. <tr>
<th>Customer Name</th>
<throwspan=3>Contact</th>
</tr>
b.<tr>
<th>Customer Name</th>
<thcolspan=3>Contact</th>
</tr>
c.<tr>
<th>Customer Name</th>
<thcellpadding=3>Contact</th>
</tr>
d.<tr>
<th>Customer Name</th>
<thcellspacing=3>Contact</th>
</tr>
Ans : b.<tr>
<th>Customer Name</th>
<thcolspan=3>Contact</th>
</tr>

Question: 47-Which of the following <section> elements have the correct attribute assignment as per HTML 5.0?
a.            <section id=”example”>…</section id=”example”>
b.            <section id=”example”>…</section id=”example2″>
c.             <section id=”EXAMPLE”>…</section>
d.            <section id=”Example”>…</section>
e.            <section id=”example”>…</section>
Ans : c.             <section id=”EXAMPLE”>…</section>
d.            <section id=”Example”>…</section>
e.            <section id=”example”>…</section>
Question: 48-Which of the following statements is correct if you invoke the window.prompt(message, default) web application API method in HTML 5.0?
a.            It will only show the modal text field prompt with the given message to the user.
b.            It will show the modal text field prompt with the given message to the user, and ask the user to respond with a positive or negative response.
c.             It will show the modal text field prompt with the given message to the user, and ask the user to either respond with a string value or abort.
d.            Both b and c.
 Ans : d.            Both b and c.
Question: 49- Which of the following is NOT an attribute of the <meta> element in HTML 5.0?
a.            charset
b.            content
c.             http-equiv
d.            scheme
 Ans : d.            scheme
Question: 50 -Which media event will be fired when a media resource element suddenly becomes empty?
a.            onerror
b.            onended
c.             onloadeddata
d.            onemptied
 Ans : d.            onemptied
Question: 51-What is the purpose of the <keygen> element in HTML 5.0?
a.            It is used to define a keyboard text in an HTML 5.0 web page.
b.            It is used to generate a public-private key pair in an HTML 5.0 web page.
c.             It is used to define a definition term in an HTML 5.0 web page.
d.            It is used to define a variable in an HTML 5.0 web page.
 Ans : b.            It is used to generate a public-private key pair in an HTML 5.0 web page.
Question: 52 -Which event is fired when an element loses its focus in HTML 5.0 document?
a.            onfocus
b.            onload
c.             onblur
d.            onselect
 Ans : c.             onblur
Question: 53 -A piece of text contains many blank spaces within it. Which of the following tags would be suitable to display the text as it was originally formatted?
a.            td
b.            p
c.             ls
d.            pre
 Ans : d.            pre
Question: 54 -Which HTML 5.0 element will you use to group the related options in a drop-down list?
a.            optgroup
b.            option
c.             menu
d.            var
e.            nav
 Ans : a.            optgroup
Question: 55 -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.0 attributes will you use?
a.            accept
b.            autofocus
c.             autocomplete
d.            formtarget
 Ans : d.            formtarget
Question: 56 -Which of the following tags would assist in creating named groups within a select list?
a.            opt
b.            group
c.             optgroup
d.            selectgroup
Ans : c.             optgroup
Question: 57 -How will you cancel the timeouts that are set with the setInterval() API method identified by the handlers in HTML 5.0?
a.            window.clearInterval (handle)
b.            window.clearTimeout (handle)
c.             window.setInterval (code, timeout)
d.            window.setTimeout (code, timeout)
a.            <tr>
<th>Customer Name</th>
<throwspan=3>Contact</th>
</tr>
b.            <tr>
   <th>Customer Name</th>
   <thcolspan=3>Contact</th>
 </tr>
c.             <tr>
<th>Customer Name</th>
<thcellpadding=3>Contact</th>
</tr>
d.            <tr>
<th>Customer Name</th>
<thcellspacing=3>Contact</th>
</tr>
Ans : a.            window.clearInterval (handle)
b.            <tr>
<th>Customer Name</th>
<thcolspan=3>Contact</th>
</tr>

Question: 58 -What is the default background color for the canvas element in HTML 5.0?
a.            Black
b.            White
c.             Transparent
d.            Gray
 Ans : c.             Transparent
Question: 59 -Which of the following are valid values for the contenteditable attribute of the <figure> element in HTML 5.0?
a.            true
b.            false
c.             0
d.            1
Ans : a.            true
b.            false

Question: 60 -Which media event is triggered when there is an error in fetching media data in HTML 5.0?
a.            onstalled
b.            onwaiting
c.             onsuspend
d.            oninvalid
 Ans : c.             onsuspend
Question: 61 -Which of the following is NOT a valid attribute for the <link> element in HTML 5.0?
a.            hreflang
b.            rel
c.             http-equiv
d.            media
 Ans : c.             http-equiv
Question: 62 -Which of the following HTML 5.0 elements is used to embed Java applets into your HTML 5.0 web page?
a.            <applet>
b.            <object>
c.             <source>
d.            <progress>
 Ans : b.            <object>
Question: 63 -How does a button created by the <button> tag differ from the one created by an <input> tag?
a.            An input tag button can be a reset button too.
b.            A button tag button can be a reset button too.
c.             An input tag button can include images as well.
d.            A button tag can include images as well.
 Ans : c.             An input tag button can include images as well.
Question: 64 -Which form event is fired on the click of a button using a button tag with its type attribute value equal to submit?
a.            onload
b.            onsubmit
c.             onunload
d.            onreset
 Ans : b.            onsubmit
Question: 65 -How will you return a reference to the parent of the current window or subframein an HTML 5.0 web application?
a.            window.top
b.            window.parent
c.             window.frameElement
d.            None of the above
 Ans : b.            window.parent
Question: 68 -Suppose you add the input code given above to your HTML web page. What result will be returned by the JavaScript function when you click the button marked as A in the image?
a.            number
b.            text
c.             button
d.            None of the above
 Ans : b.            text
Question: 69 -Which of the following statements is correct if you allow the user to select only one radio button from a group of radio buttons?
a.            The name of the input tag must be the same for all the radio buttons.
b.            The value of the input tag must be the same for all the radio buttons.
c.             The display text of the input tag must be the same for all the radio buttons.
d.            All the radio buttons must be added to the same group using the <optgroup> tag.
 Ans : a.            The name of the input tag must be the same for all the radio buttons.
Question: 70 -What will be the result if you use the following code to your HTML 5.0 document?
<bdodir=”rtl”>
Here is some text that should be written to your document.
</bdo>
a.            .tnemucodruoy ot nettirwebdluohstahttxetemossiereH
b.            Here is some text that should be written to your document.
c.             Here is some text that should be written to your document.
d.            None of the above.
 Ans : a.            .tnemucodruoyotnettirwebdluohstahttxetemossiereH
Question: 71 -Which of the following would give a yellow background to the web page?
Note: The code used in the “correct” answer below was deprecated in HTML 4.01! Use styles instead for new code.
a.            <body backcolor=”Yellow”>
b.            <body background=”Yellow”>
c.             <body bgcolor=”Yellow”>
d.            <body color=”Yellow”>
Ans : c.             <body bgcolor=”Yellow”>
Question: 72 -How will you change the value of the cookies and items in the Storage objects of the localStorage attributes in HTML 5.0?
a.            By invoking the window.dialogArguments() API method.
b.            By invoking the window. navigator.yieldForStorageUpdates() API method.
c.             By invoking the window.navigator.appName API method.
 Ans : b.            By invoking the window. navigator.yieldForStorageUpdates() API method.
Question: 73 -How will the target URL open when you define the <a> element in your HTML 5.0 document as shown below?
<a href=”http://www.yahoo.com” target=”_self”>Click here</a>
a.            The target URL will open in the parent document.
b.            The target URL will open in a new window.
c.             The target URL will open in the same document in which it was clicked.
d.            The target URL will open in the full body of the window.
 Ans : c.             The target URL will open in the same document in which it was clicked.
Question: 74 -What will be the browsing context if the browsing context name is _top when the HTML 5.0 web page is loading?
a.            It will put the new document in the same window and frame as the current document.
b.            It will load the linked document in the topmost frame.
c.             It is used in the situation where a frameset file is nested inside another frameset file.
d.            Both a and c.
 Ans : b.            It will load the linked document in the topmost frame.
Question: 75 -Which of the following is an INVALID value for the type attribute of command tag?
a.            checkbox
b.            radio
c.             command
d.            text
 Ans : d.            text
Question: 76 -The following link is placed on an HTML webpage.
<a href=”http://msdn.com/” target=”_blank”> MSDN </a>
What do you infer from it?
a.            It will open the site msdn.com in the same window.
b.            It will open the site msdn.com in a new window.
c.             It will open the site msdn.com in a frame below.
d.            It will not be clickable as it is not formed correctly.
 Ans : b.            It will open the site msdn.com in a new window.
Question:77 -You have the following directory structure.
webroot->products->ordered->delivered
The products directory has a page called Products.html and the delivered directory has a page called Delivered.html. You want to provide a link to the Products page on Delivered.html. The ideal code should be:
a.            <a href=”././Products.html”> All Products </a>
b.            <a href=”../../Products.html”> All Products </a>
c.             <a href=”…/…/Products.html”> All Products </a>
d.            <a href=”../Products.html”> All Products </a>
e.            <a href=”Products.html”> All Products</a>
 Ans : b.            <a href=”../../Products.html”> All Products </a>

Question:78 -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>
a.            I use MAC Microsoft!
b.            I use MAC Microsoft!
c.             I use MAC Microsoft!
d.            I use MAC Microsoft!
 Ans : a.            I use MAC Microsoft!
Question:79 -Which of the following is the correct syntax to define a charset in the HTML 5 <meta> element?
a.            <meta http-equiv=”content-type” content=”text/html; charset=ISO-8859-1″>
b.            <meta charset=”ISO-8859-1″>
c.             Neither a nor b.
 Ans : b.            <meta charset=”ISO-8859-1″>
Question:80 -Which of the following is NOT a supported attribute of the <ol> element in HTML 5.0?
a.            type
b.            reversed
c.             start
d.            compact
 Ans : d.            compact
Question:81 -Which of the following is a valid attribute for the <colgroup> element in an HTML 5.0 document?
a.            char
b.            span
c.             align
d.            width
 Ans : b.            span
Question:82 -Which of the following is the correct method to load another web page or reload the same page in HTML 5.0?
a.            <head>
<meta http-equiv=refresh content=5>
</head>
b.            <html>
<head>
<title>Auto Reload</title>
<script language=”JavaScript”>
<!–
var time = null
function move() {
window.location = ‘http://site.com’
}
//–>
</script>
</head>
<body onload=”timer=setTimeout(‘move()’,5000)”>
<p>see this page refresh itself in 5 secs.<p>
</body>
</html>
c.             <head>
<meta http-equiv=refresh content=”5;URL=http://yahoo.com >
</head>
d.            All of the above
Ans :  d.            All of the above
Question:83 -Which of the following elements preserves spaces and line breaks, and displays the text in fixed-width font?
a.            <xmp>
b.            <pre>
c.             <p>
d.            <q>
e.            <br>
Ans : b.            <pre>
Question:84 -Which <body> tag event is fired when the user leaves the document?
a.            onunload
b.            onundo
c.             onredo
d.            onerror
 Ans : a.            onunload
Question:85 -Which of the following is an INVALID keyword value for http-equiv attribute when used with the <meta> element in HTML 5.0?
a.            content-type
b.            expires
c.             set-cookie
d.            keywords
e.            refresh
f.             author
 Ans : b.            expires
c.             set-cookie

Question:86 -A computer programming book has to go online. Which of the following tags is ideal for displaying the program snippets?
a.            <emp>
b.            <code>
c.             <dfn>
d.            <cite>
 Ans : b.            <code>
Question:87 -Which of the following is NOT a valid value for the type attribute of the <input> element in HTML 5.0?
a.            url
b.            week
c.             tel
d.            radio
e.            datetime-local
f.             All of the above are the valid values for <input> element
 Ans : f.             All of the above are the valid values for <input> element
Question:88 -What is the role of the <dfn> element in HTML 5.0?
a.            It is used to define important text.
b.            It is used to define computer code text.
c.             It is used to define sample computer code.
d.            It is used to define a definition term
 Ans : d.            It is used to define a definition term
Question:89 -Which of the following is NOT a valid syntax for the <link> element in HTML 5.0?
a.            <link rel=”icon” href=”abc.jpg” sizes=”16×16″>
b.            <link rev=”stylesheet” href=”abc.css” type=”text/css” target=”_parent”>
c.             <link rel=”alternate” type=”application/pdf” hreflang=”fr”  href=”manual-fr”>
 Ans : c.             <link rel=”alternate” type=”application/pdf” hreflang=”fr”  href=”manual-fr”>
Question:90 -Which of the following are valid HTML 5.0 elements?
a.            <canvas>
b.            <summary>
c.             <aside>
d.            <video>
Ans : a.            <canvas>
c.             <aside>
d.            <video>
Question:91 -Which of the following is NOT a valid syntax for the <h1> element in HTML 5.0?
a.            <h1>This is header 1</h1>
b.            <h1 align=”center”> This is header 1</h1>
c.             <h1 onClick=”dothis(‘sc1′)” >This is header </h1>
d.            <h1 style=”cursor:auto;”>This is header </h1>
 Ans : b.            <h1 align=”center”> This is header 1</h1>
Question: 92 -Which of the following statements are correct with regard to <hr> and <br> elements of HTML 5.0?
a.            <hr> element acts in the same way as the Tab key on your keyboard and <br> element acts in the same way as the SHIFT key on your keyboard.
b.            <hr> element is used to insert the horizontal line within your document and <br> element is used to insert a single line break.
c.             <hr> element is used to put a line across the page and <br> element acts in the same way as the ENTER key on your keyboard.
Ans : b.            <hr> element is used to insert the horizontal line within your document and <br> element is used to insert a single line break.
Question:93 -What will be the return value when using the window.navigator.appName API method in an HTML 5.0 web application?
a.            It will return the version of the browser.
b.            It will return the complete User-Agent header.
c.             It will return the name of the platform.
d.            It will return the name of the browser.
 Ans : d.            It will return the name of the browser.
Question:94 -Which of the following languages will you use to paint the graphics designed using the HTML 5.0 <canvas> tag?
a.            VB script
b.            JavaScript
c.             PostScript
d.            None of the above
 Ans : b.            JavaScript
Question:95 -What is the function of the history traversal task source in HTML 5.0?
a.            It is used for features that react to user interaction, for example, keyboard or mouse input.
b.            It is used for features that react to DOM manipulations, for example, the things that happen asynchronously when an element is inserted in the document.
c.             It is used to queue calls to history.back() and similar APIs.
d.            All of the above.
 Ans : c.             It is used to queue calls to history.back() and similar APIs.
Question:96 -Which <iframe> attribute is used to define the restrictions to the frame content in HTML 5.0?
a.            seamless
b.            sandbox
c.             srcdoc
Ans : b.            sandbox
Topic:    Correct Answers
HTML 5 Events
Loading HTML 5 Web pages
HTML 5 Web application APIs
HTML 5 Elements and attributes
HTML 5 syntax
Question:97 -In HTML 5.0, what is the function of the sandbox attribute when used with <iframe> as shown below?
a.            It is used to define the restrictions to the frame content.
b.            It is used to define the URL of the document that should appear in the iframe.
c.             It is used to specify that an iframe should appear as if it is part of the document the iframe is in.
 Ans : a.            It is used to define the restrictions to the frame content.
Question:98 -Which of the following statements is/are correct for a blockquote?
a.            It makes the text a bit bigger for emphasizing.
b.            It defines the start of a long quote.
c.             It makes the text slightly bolder.
 Ans : b.            It defines the start of a long quote.
Question:99 -Which event is fired when the history of the browser window changes?
a.            onpopstate
b.            onstorage
c.             onresize
d.            onhashchange
 Ans : a.            onpopstate
Question:100 -Which of the following <link> attributes are NOT supported in HTML 5.0?
a.            sizes
b.            rev
c.             rel
d.            charset
 Ans : d.            charset
Question:101 -Suppose you placed four radio buttons on a web form. Which of the following statements is correct for the code shown above?
a.            The user can choose only the male and the married options.
b.            The user can choose only the female and single options.
c.             The user can choose only one option out of the four.
d.            The user can choose all the four options at the same time.
e.            The user can choose one option from Male/Female and one from Married/Single.
 Ans : c.             The user can choose only one option out of the four.
Question:102 -When does the ondragleave mouse event get fired in HTML 5.0?
a.            It gets fired when an element has been dragged to a valid drop target.
b.            It gets fired when an element leaves a valid drop target.
c.             It gets fired at the end of a drag operation.
d.            It gets fired while an element is being dragged.
 Ans : b.            It gets fired when an element leaves a valid drop target.
Question:103 -Which of the following are valid mouse events in HTML 5.0?
a.            ondblclick
b.            ondragstart
c.             ondragenter
d.            onscroll
e.            ondrop
 Ans : a.            ondblclick
b.            ondragstart
c.             ondragenter
d.            onscroll
e.            ondrop
Question:104 -Which of the following <iframe> attributes are NOT supported in HTML 5.0?
a.            height
b.            marginheight
c.             sandbox
d.            scrolling
 Ans : b.            marginheight
d.            scrolling
Question:105 -In HTML 5.0, which of the following attributes of the <object> element refers to the location of the object’s data?
a.            type
b.            codebase
c.             data
d.            usemap
 Ans : c.             data
Question:106 -In which of the following conditions is a browsing context A allowed to navigate a second browsing context B?
a.            When the browsing context A is a nested browsing context and its top-level browsing context is B.
b.            When the browsing context B is an auxiliary browsing context and A is allowed to navigate B’s opener browsing context.
c.             The origin of the active document of A is the same as the origin of the active document of B.
d.            All of the above
 Ans : d.            All of the above
Question:107 -Which of the following is an INVALID parameter for thewindow.navigator.registerContentHandler API method in an HTML 5.0 web application?
a.            url
b.            mimeType
c.             scheme
d.            title
Ans : c.             scheme
Question:108 -How will the target URL open when you define the <a> element in your HTML 5.0 document as shown below?
<a href=”http://www.yahoo.com” target=”_self”>Click here</a>
a.            The target URL will open in the parent document.
b.            The target URL will open in a new window.
c.             The target URL will open in the same document in which it was clicked.
d.            The target URL will open in the full body of the window.
 Ans : c.             The target URL will open in the same document in which it was clicked.
Question:109 -You specified a base tag and anchors as follows:
1. <base target=”_blank”>
2. <a href=”http://www.yahoo.com”>Yahoo>
3. <a href=”http://www.google.com” target=”_top”>Google</a>
 Ans : 2. <a href=”http://www.yahoo.com”>Yahoo>
Question:110 -Which of the following is true of the above code?
a.            Only the Yahoo link will open in a new window.
b.            Only the Google link will open in a new window.
c.             Both links will open in a new window.
d.            Both links will open in the same window.
 Ans : a.            Only the Yahoo link will open in a new window.
Question:111 -When is the window onstorage event triggered in the HTML document?
a.            It is triggered when the window is resized.
b.            It is triggered when a document loads.
c.             It is triggered when a document performs an undo function.
d.            It is triggered when the window becomes visible.
 Ans : b.            It is triggered when a document loads.
Question:112 -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>
a.            The script is fetched and executed immediately, before the user agent continues parsing the page.
b.            The script will be executed when the page has finished parsing.
c.             The script will be executed asynchronously, as soon as it is available.
 Ans : b.            The script will be executed when the page has finished parsing.
Question:113 -Which of the following is correct with regard to the oncanplaythrough event fired by media resources in the HTML 5.0 document?
a.            The script will run when the media has reached the end.
b.            The script will run when the media is played to the end, without stopping for buffering.
c.             The script will run when media data is loaded.
d.            The script will run when the length of the media is changed.
Ans : b.            The script will run when the media is played to the end, without stopping for buffering.
Question:114 -What is the output when you use the HTML 5.0 code snippet shown below?
<body onload=”alert(this)”>
a.            It will alert saying “[object HTMLBodyElement]” when the document is loaded.
b.            It will alert saying “[object Window]” when the document is loaded.
c.             It will alert saying “[this]” when the document is loaded.
d.            The alert message is not properly defined in the body element and an error will be generated when the document is loaded.
Ans : b.            It will alert saying “[object Window]” when the document is loaded.
Question:115 -Which of the following represents INVALID syntax for defining an attribute value in an HTML 5.0 document?


a.            <input name =’be evil’ />
b.            <input name=be evil />
c.             <input name = “be-evil” />
d.            All of the above.
 Ans : d.            All of the above.
Question:116 -What is the purpose of the <q> element in HTML 5.0?
a.            It is used to define the start of a term in a definition list.
b.            It is used to define attribute values for one or more columns in a table.
c.             It is used to define the start of a short quotation.
d.            It is used to define what to show browsers that do not support the ruby element.
 Ans : c.             It is used to define the start of a short quotation.
Question:117 -Which of the following events is NOT supported in HTML 5.0?
a.            oninput
b.            oninvalid
c.             ondrop
d.            onreset
 Ans : d.            onreset



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

2.       Can we store JavaScript Objects directly into localStorage?

Ans: b. No

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

Ans: b. 90

4.       Consider the following javascript code:
var c=document.getElementById(“myCanvas”);
varctx=c.getcontext(“2d”);
varimg=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?

Ans: b. <script type=”text/javascript”>
              functionresize_canvas() {
                       canvas = document.gatElementById(“”canvas);
                      if (canvas.width<window.innerWidth)
                      {
                           Canvas.width = window.innerWidth;
                      }
                     if (canvas.height<window.innerHeight)
                      {
                           Canvas.height = window.innerHeight;
                      }
             }
</script>


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 <command> tag shown below?  <command type="?">Click Me!</command>

Ans: a.       Button

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

Ans: b.       The manifest file is modified

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

Ans: c.        Use of HTML5 File API


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

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

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

Ans: a. YYYY-MM-DD

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

Ans: a. There is no limit

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

Ans: b. It is used to define a definition term

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

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

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

Ans:c. Onblur

20.    Which following are valid default values for the <input type="date"> HTML5 element?

Ans: b. 2013-05-30

21.    Which HTML5 doctype declarations are correct?

Ans: c. <!DOCTYPE html>

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

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

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

Ans: a.Onstalled

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

Ans: c. Onemptied

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

Ans: a. toDataURL()

26.    Which of the following <link> attributes are not supported in HTML5?

Ans: a. Rev,  d.charset

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

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

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

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


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)
Ans: c. placeholder


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


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


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


35. Which of the following is a possible way to get fullscreen video 

played from the browser using HTML5?
Ans: c. <video height="100%" width="100%">


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


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


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


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

Ans: 
b. var names = [];
               names[0] = prompt("New member name?");
               localStorage["names"] = JSON.stringify(names);

           //...
          varstoredNames = JSON.parse(localStorage["names"]);


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



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


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


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


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


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


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


47. Which of the following statements are correct with regard to the <hr> and <br> elements of HTML5?
Ans: 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.


48. Which of the following statements regarding WebSockets is true?
Ans: d. All of the above


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


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

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


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

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?
Ans: D. formtarget

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