oDesk HTML 5 Test Answers 2014

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”);
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?

Ans: 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>


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

           //...
          var storedNames = 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?
 var obj = { '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>


55. Which of the following input element variations will a numeric keypad in mobile browsers? 

       Ans: <input type='number' /> 

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

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

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? 
 Ans: Server-sent Events  
WebSockets
 
 
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
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
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-formsQuestion: 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.     <a href=”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
<iframe src=”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 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()Api mathod

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: href lang

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?
<iframe src= " 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?
 <bdo dir="rtl">
here is the some text that should be written to your document.
</bdo>

Ans: tnemucod ruoy ot enttirw eb dluohs taht txet emos si ereh.

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: 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>
<th rowspan=3>Contact</th>
</tr>
b.<tr>
<th>Customer Name</th>
<th colspan=3>Contact</th>
</tr>
c.<tr>
<th>Customer Name</th>
<th cellpadding=3>Contact</th>
</tr>
d.<tr>
<th>Customer Name</th>
<th cellspacing=3>Contact</th>
</tr>
Ans : b.<tr>
<th>Customer Name</th>
<th colspan=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 thewindow.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>
<th rowspan=3>Contact</th>
</tr>
b.            <tr>
   <th>Customer Name</th>
   <th colspan=3>Contact</th>
 </tr>
c.             <tr>
<th>Customer Name</th>
<th cellpadding=3>Contact</th>
</tr>
d.            <tr>
<th>Customer Name</th>
<th cellspacing=3>Contact</th>
</tr>
Ans : a.            window.clearInterval (handle)
b.            <tr>
<th>Customer Name</th>
<th colspan=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 orsubframe in 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?
<bdo dir=”rtl”>
Here is some text that should be written to your document.
</bdo>
a.            .tnemucod ruoy ot nettirw eb dluohs taht txet emos si ereH
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.            .tnemucod ruoy ot nettirw eb dluohs taht txet emos si ereH
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 onDelivered.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.appNameAPI 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 oncanplaythroughevent 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

Question:
What is the default background color for the canvas element in HTML 5.0?


a.            Black
b.            White
c.             Transparent
                d.            Gray
Question:
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
Question:
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
Question:
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
Question:
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>
Question:
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:
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:
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:
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:
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
This question is based upon the figure shown below

Question:
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
Question:
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.
Question:
What will be the result if you use the following code to your HTML 5.0 document?

<bdo dir=”rtl”>
Here is some text that should be written to your document.
</bdo>


a.            .tnemucod ruoy ot nettirw eb dluohs taht txet emos si ereH
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.
Question:
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:
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:
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.
Question:
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.
Question:
Which of the following is an INVALID value for the type attribute of command tag?


a.            checkbox
b.            radio
c.             command
                d.            text
Question:
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.
Question:
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>
Question:
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:
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.
Question:**
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
Question:
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
Question:
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
Question:
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>
Question:
Which <body> tag event is fired when the user leaves the document?


a.            onunload
b.            onundo
c.             onredo
                d.            onerror
Question:**
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
Question:
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:
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
Question:
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:
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”>
Question:**
Which of the following are valid HTML 5.0 elements?


a.            <canvas>
b.            <summary>
c.             <aside>
                d.            <video>
Question:
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:
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.
Question:
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.
Question:
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:
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:
Which <iframe> attribute is used to define the restrictions to the frame content in HTML 5.0?


a.            seamless
b.            sandbox
                c.             srcdoc
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:
In HTML 5.0, what is the function of the sandbox attribute when used with <iframe> as shown below?

<iframe src=”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:
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.
Question:
Which event is fired when the history of the browser window changes?


a.            onpopstate
b.            onstorage
c.             onresize
                d.            onhashchange
Question:
Which of the following <link> attributes are NOT supported in HTML 5.0?


a.            sizes
b.            rev
c.             rel
                d.            charset
This question is based upon the figure shown below

Question:
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.
Question:
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.
Question:**
Which of the following are valid mouse events in HTML 5.0?


a.            ondblclick
b.            ondragstart
c.             ondragenter
d.            onscroll
                e.            ondrop
Question:
Which of the following <iframe> attributes are NOT supported in HTML 5.0?


a.            height
b.            marginheight
c.             sandbox
                d.            scrolling
Question:
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
Question:
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
Question:
Which of the following is an INVALID parameter for the window.navigator.registerContentHandler API method in an HTML 5.0 web application?


a.            url
b.            mimeType
c.             scheme
                d.            title
Question:
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.
Question:
You specified a base tag and anchors as follows:

1. <base target=”_blank”>
2. <a href=”http://www.yahoo.com”>Yahoo</a>
3. <a href=”http://www.google.com” target=”_top”>Google</a>

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.
Question:
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.
Question:
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:
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:
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:
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:
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.
Question:
Which of the following events is NOT supported in HTML 5.0?


a.            oninput
b.            oninvalid
c.             ondrop
                d.            onreset
Question:
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)
Question:
Which of the following tags would assist in creating named groups within a select list?


a.            opt
b.            group
c.             optgroup
                d.            selectgroup
Question:
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
Question:
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
This question is based upon the figure shown below

Question:
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?


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:
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:
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:
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
Question:
Which event is fired when an element loses its focus in HTML 5.0 document?

a.            onfocus
b.            onload
c.             onblur
                d.            onselect
Question:
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.
Question:
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
Question:
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:
Which media event will be fired when a media resource element suddenly becomes empty?

a.            onerror
b.            onended
c.             onloadeddata
                d.            onemptied

Question:
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
Question:
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.
Question:
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:
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:
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>
HTML 5 Elements and attributes63%
HTML 5 Events86%
HTML 5 syntax88%
HTML 5 Web application APIs75%
Loading HTML 5 Web pages50%
d.            <section id=”Example”>…</section>
                e.            <section id=”example”>…</section>
 

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

<input name="username"  required />
<input name="pass"  type="password" required/>
<input name="username"  validate="true"/>
<input name="pass"  type="password" validate="true"/>
<input name="username"  validate/>
<input name="pass"  type="password" validate/>
There is no way to implement client-side validation for the username and password fields in HTML5.

Question 19 of 45

Does the closing tag is mandatory for HTML5? For example <span class="presentational"></span> could be written as '<span class="presentational" />" ' will cause any issue?

No it will not generate any issue.
yes, but If rendered as "application/xhtml+xml" then it is ok
It will work for all html5 enabled browsers without warning.
It may generate issue but will work fine for any browser.

Question 2 of 45

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

var video = document.getElementsByTagName('video')[0];
    video.onended = function(e) {
    }
var video = document.getElementsByTagName('video')[0];
    video.onPlayend = function(e) {
    }
var video = document.getElementsByTagName('video')[0];
    video.onPlayFinish = function(e) {
    }
var video = document.getElementsByTagName('video')[0];
    video.onPlayBackended = function(e) {
    }

Question 12 of 45

Which valid HTML5 tag defines a bigger text size?

<em>
<strong>
<big>
None of the above

Question 3 of 45

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

Question 4 of 45

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.
It means that streaming of a voice/video frame is first between one peer to the server thenthe server to another peer.
Communication does not rely on a shared relay server in the network.

Question 5 of 45

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.
SSEs can perform bi-directional (client-server and vice versa) data transfers, while WebSockets can only push data to the client/browser.
WebSockets and SSEs are functionally equivalent.
None of these.

Question 7 of 45

What is the internal/wire format of input type="date" in HTML5?

DD-MM-YYYY
YYYY-MM-DD
MM-DD-YYYY
YYYY-DD-MM

Question 8 of 45

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

<object type="application/pdf" data="filename.pdf" width="100%" height="100%"/>
<object type="application/pdf" id="filename.pdf" width="100%" height="100%"/>
<input type="application/pdf" data="filename.pdf" width="100%" height="100%"/>
<input type="application/pdf" src="filename.pdf" width="100%" height="100%"/>

Question 9 of 45
Which of the following code is used to prevent Webkit spin buttons from appearing on web pages?

input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    }
input[type=number]::-webkit-inner-spin-button,
  input[type=number]::-webkit-outer-spin-button {  
    -webkit-appearance: none;
    margin: 0;
   }
noindex:-o-prefocus,
   input[type=number] {
    padding-right: 1.2em;
    }
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
   padding-right: 1.2em;
    }

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

var obj = { 'one': 1, 'two': 2, 'three': 3 };

localStorage.setItem('obj', obj);
localStorage.setItem('obj', JSON.stringify(obj));
localStorage.setItem('testObject', JSON.parse(testObject));
localStorage.setItem(obj);

Question 10 of 45

Which of the following code snippets will create dotted strokes(e.g. -.-.-.-.-.) in an HTML5 canvas?

while(){
   $('element1').css('border-style','solid')
   $('element2').css('border-style,'dashed'')
}
while(){
   $('element1').css('width','20px')
   $('element2').css('width','3px')
}
while(){
   $('element1').css('border-bottom','1px solid #color1')
   $('element2').css('border-bottom','1px dotted #color2')
}
None of the above.

Question 11 of 45

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

Drag and drop files from the desktop
Full file system access
Use of the HTML5 File API
Use of files as HTML5 input types

Question 12 of 45

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


Note: There may be more than one right answer.
The application cache is programmatically updated.
The application cache gets automatically cleared by the browser.
The manifest file is modified.
The user clears their browser's data storage for the site.

Question 13 of 45

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


Note: There may be more than one right answer.
_blank
_self
_top
_bottom

Question 14 of 45

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


Note: There may be more than one right answer.
var snd = new Audio("file.wav");
snd.play();
<audio controls>
  <source src="file.ogg" type="audio/ogg">
  <source src="file.mp3" type="audio/mpeg">
</audio>
<source src="file.mp3" type="audio/mpeg">
All of these.

Question 15 of 45

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

toDataURL()
saveAsImage()
saveFile()
exportImage()

Question 16 of 45

How can audio files be played in HTML5?

var sound = new Audio("file.wav");

sound.begin();
sound.resume();
sound.start();
sound.play();

Question 17 of 45

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

console.log(WebSocket ? 'supported' : 'not supported');
console.log(window.WebSocket ? 'supported' : 'not supported');
console.log(window[WebSocket] ? 'supported' : 'not supported');
console.log(window['WebSocket'] ? 'supported' : 'not supported');


Question 18 of 45

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

localStorage.setItem('testObject', JSON.stringify(testObject))
localStorage.setItem('testObject', testObject)
localStorage.add('testObject', testObject)
localStorage.addItem('testObject', testObject)

Question 19 of 45

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

now
2013-05-30
2013-30-05
Today

Question 20 of 45

Which of the following are true regarding the <keygen> tag in HTML5?


Note: There may be more than one right answer.
The <keygen> tag specifies a key-pair generator field used for forms.
The <keygen> tag generates a public/private key pair and then creates a certificate request. This certificate request will be sent to a Certificate Authority (CA), which then creates a certificate and sends it back to the browser.
The <keygen> tag generates random passwords when the user requests for a password reset.
The <keygen> tag is deprecated in HTML5.

Question 21 of 45

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


Note: There may be more than one right answer.
Using _gaq.push(['_trackPageLoadTime']) with Google Analytics.
Using the Navigation Timing JavaScript API.
Page load times cannot be estimated.
Using built-in JavaScript methods.

Question 22 of 45

Can we store JavaScript Objects directly into localStorage?

Yes
No

Question 23 of 45

Which HTML5 doctype declarations are correct?


Note: There may be more than one right answer.
<!doctype html>
<!DOCTYPE html>
<!DOCTYPE HTML5>
<!DOCTYPE HTML>

Question 24 of 45

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.
All of the above.

Question 25 of 45

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


Note: There may be more than one right answer.
Every HTML element can have an ARIA role attribute specified.
Every HTML element is required have an ARIA role attribute specified.
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.
There is no ARIA attribute called "role".

Question 24 of 45

Which of the following is the correct way to know HTML5 video/audio tag supports the rtsp or rtp?


Note: There may be more than one right answer.
<video src="rtp://myserver.com/path/to/stream">
    Your browser does not support the VIDEO tag and/or RTP streams.
</video>
<video src="http://myserver.com:1935/path/to/stream/myPlaylist.m3u8">
    Your browser does not support the VIDEO tag and/or RTP streams.
</video>
Can add any text between the <video> and </video> tags, then will be displayed in browsers that do not support the <video> element.
There are no ways.
Question 26 of 45

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


Note: There may be more than one right answer.
play
loop
mute
pause

Question 27 of 45

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

toDataURL
toImageURL
saveAsPNG
saveAsJPEG

Question 28 of 45

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)

autocomplete
autofocus
placeholder
formnovalidate

Question 29 of 45

True or false:

JavaScript objects can be stored directly into localStorage.

True
False

Question 30 of 45

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

var localStorage[names]=new Array();
localStorage.names[0]=prompt("New member name?");
var names = [];
names[0] = prompt("New member name?");
localStorage["names"] = JSON.stringify(names);
var storedNames = JSON.parse(localStorage["names"]);
Storage.prototype.setObj = function(key, obj) {
    return this.setItem(key, JSON.stringify(obj))
}
Storage.prototype.getObj = function(key) {
    return JSON.parse(this.getItem(key))
}
localStorage.setItem('names_length', names.length);
localStorage.setItem('names_0', names[0]);
localStorage.setItem('names_1', names[1]);
localStorage.setItem('names_' + n, names[n]);


Question 31 of 45

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


Note: There may be more than one right answer.
<input type="text" pattern="[0-9]*" />
<input type="number" />
<input type="text" pattern="\d*"/>
<input type="text" pattern="number"/>


Question 32 of 45

What is the best way to define the character set of an HTML5 web page?

<meta http-equiv='charset' content='utf-8'>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<meta charset='utf-8'>

Question 33 of 45

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

isCanvasSupported()
!!document.createElement("canvas")
!isCanvasSupported()
!!window.HTMLCanvasElement

Question 34 of 45

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);
context.drawImage(img,20,10,10,10);
context.drawImage(img,10,20,10,10,20,20,10,10);
All of these

Question 35 of 45

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


Note: There may be more than one right answer.
#myCanvas {height: 100%; width: 100%;}
<script type="text/javascript">

        function resize_canvas(){
                               
            canvas = document.getElementById("canvas");
            if (canvas.width  < window.innerWidth)
            {
                canvas.width  = window.innerWidth;
            }

            if (canvas.height < window.innerHeight)
            {
                canvas.height = window.innerHeight;
            }
        }
    </script>
It depends upon the complexity of the canvas, and the frequency of redraws.
Calling the JavaScript getWidth() function.

Question 17 of 45

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

var obj = { 'one': 1, 'two': 2, 'three': 3 };

localStorage.setItem('obj', obj);
localStorage.setItem('obj', JSON.stringify(obj));
localStorage.setItem('testObject', JSON.parse(testObject));
localStorage.setItem(obj);

Question 22 of 45

What is the best way to define a character set of an HTML 5 Web Page?

<meta charset='utf-8'>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Type" content="text/html" encoding="utf-8">
<meta http-equiv="Content-Type" content="text/html" character-encoding="utf-8">

Question 18 of 45

What is the purpose of the double negative(!!) expression in JavaScript?

It results to a Boolean value.
It returns false if its single operand can be converted to true.
It returns the original Boolean value for any expression.
All of these.


Question 36 of 45

Which of the following input element variations will show a numeric keypad in mobile browsers?


Note: There may be more than one right answer.
<input type="text" pattern="[0-9]*" />
<input type="number" />
<input type="text" keyboard="numeric" />
<input type="text" keyboard="number11" />
Question 37 of 45

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


Note: There may be more than one right answer.
<tr class="foo" data-id-type="4">
<tr class="foo" id-type="4">
<tr class="foo" data-id_type="4">
All of the above.

Question 33 of 45

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

 foo & bar
foo &0 bar
foo &0; bar
foo&&& bar

Question 38 of 45

Which of the following choices will make the video element below work with HTML5?

<video width="640" height="360" controls id="video-player" poster="/movies/poster.png">
     <source src="/movies/640x360.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>

Add "Content-Type" : "video/ogg" in the code.
Add type video/ogg .ogv  in the .htaccess file.
Add "Content-Type" : "applicatoin/ogg" in the code.
Add type application/ogg .ogv  in the .htaccess file.
It will work without further modification.

Question 39 of 45

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

Server-Sent Events
SVG
Canvas
Web Workers

Question 40 of 45

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
All of these.


If the <html>, <head> and <body> tags were removed from a page, what would be the effect?

It will affect DOM parsing.
It will cause warnings/errors under W3C validators.
The view will not render properly.
All of the above
Which is the standard method for clearing a canvas?

context.clearRect ( x , y , w , h );
canvas.width = canvas.width;
context.clear();
All of these.
Which of the following is a possible way to get fullscreen video played from the browser using HTML5?

<object> <param name="allowFullScreen" value="true" />
<video allowFullScreen="true">
<video height="100%" width="100%">
None of these.

Which of the following is true while coding HTML5 in visual studio?

Visual studio has built in tag support and validation for HTML5
Visual Web Developer tools can be used to write HTML5 code and Validation
Visual studio provides a plugin for HTML5 Intellisense
HTML5 is not supported upto visual studio 2010
Applications) attribute?

ARIA attributes follow this format: <div data-role="log" title="chat log">
ARIA attributes provides tabindex to order the elements of an HTML form.
Legacy HTML also supports ARIA attributes.
None of the above (all the statements above are correct).

Question 25 of 45

Which of the following methods are valid for navigating to a fragment identifier?

http://demo.com/#foo


Note: There may be more than one right answer.
<a name="foo">bar</a>
<a id="foo">bar</a>
<div id="foo">bar</div>
<div class="foo">bar</div>

Question 37 of 45

Which of the following statements regarding the section element is incorrect?

The section element represents a generic section of a document or application.
A section can be a thematic grouping of content.
Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis.
The section element represents a self-contained composition in a document, page, application, or site.

 
Question:1
You have to add a list of products in a drop-down list. What will you use to group the identical products under a category name?
a.     Optgroup
b.     option
c.     menu
d.     var

Question:2
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 is “webmaster@xcompany.com”?
a.     <a href=”mailto:webmaster@xcompany.com”>webmaster</a> 
b.     <a href=”webmaster@xcompany.com”>webmaster</a>
c.     <a http=”mail:webmaster@xcompany.com”>webmaster</a>
d.     <mail http=”send:webmaster@xcompany.com”>webmaster</mail>
e.     <a href=”mailto://webmaster@xcompany.com”>webmaster</a>

Question:3
What is the character entity representation of the ‘less than’ sign (its entity name is ‘&lt;’) ?
a.     60;#
b.     &#60; 
c.     &60#;
d.     #60&;

Question:4
How will you specify the language attribute in XHTML?
a.     <div lang=”en” xml:lang=”en”>Listing A</div>
b.     <div language=”en”>Listing A</div>
c.     <div language=”en” xhtml:lang=”en”>Listing A</div>
d.     <div xml:language=”en”>Listing A</div>

Question:5
Which of the following is true for the “<param>” tag?
a.     It doesn’t need a closing tag
b.     The language attribute cannot be specified with it
c.     The name and type attributes are optional
d.     The class, id and title can be specified for it

Question:6
How will you specify a comment in an XHTML document?
a.     <!!– Here is a comment… –!>
b.     <– Here is a comment.. –>
c.     <!– Here is a comment.. –>
d.     <! Here is a comment… –!>

Question:7
You are developing a website. In one of the subscription forms, you need to get the subscription start date from the user.
The HTML code is as follows:
Day <input type=”text” size=”3? />
Month <input type=”text” size=”10? />
Year <input type=”text” size=”4? />
Which of the following will you use if you want to put these 3 text fields together in a box?
a.     <legend>
b.     <box>
c.     <fieldset>
d.     <area>

Question:8
Which of the following lines will be allowed by an XHTML parser?
a.     <p>This is the starting of a new paragraph
b.     <P>This is the starting of a new paragraph<P>
c.     Here is a break statement <br></br>
d.     New Horizontal line <hr />

Question:9
Which of the following is incorrect with regard to the <select> tag?
a.     The “name” should be specified
b.     The “disabled” attribute disables the drop-down list
c.     The “multiple” attribute allows the user to choose multiple options
d.     The text specified in the “value” is displayed in the drop-down list
e.     None of the above

Question:10
A <doctype> defines the document type of any XHTML document. It can be of three types:
a.     Strict, Transitional, and Frameset
b.     Strict, Transitional and Loose
c.     Fixed, Intermediate and Loose
d.     Fixed, Intermediate, Frameset

Question:11
Which of the following is correct for an image?
a.     An image must be resized in an editor to fit in the specified space on a webpage
b.     If you have a big image but specify smaller height and width attributes in the <img> tag, only the top left
portion of the image will be displayed in the browser
c.     Both a and b are correct
d.     The height and width attributes allow resizing the image on the webpage

Question:12
Which of the following is incorrect about the relation between HTML and XHTML?
a.     XHTML is a stricter and cleaner version of HTML *
b.     XHTML is almost identical to HTML 4.01
c.     XHTML and HTML both are used to generate dynamic content 
d.     XHTML brings together the elements of HTML and the syntax of XML

Question:13
Which of the following  statements is correct for the <blockquote> tag?
a.     The text under blockquote must be enclosed in a block level element in a strict DTD document
b.     The attribute  named “cite” must be specified
c.     Closing the tag is optional
d.     It doesn’t place an empty line after the text

Question:14
Which of these tags will create a single space character?
a.     <td>
b.     <th>
c.     &nbsp; 
d.     <b>

Question:15
Which of the following statements is correct with regard to DTDs?
a.     A strict DTD allows the user to use cascading style sheets
b.     A transitional DTD displays content in those browsers which don’t support CSS
c.     A frameset DTD is used to partition the browser window
d.     All of the above

Question:16
Which of the following represents the basic tag structure of an XHTML document?
a.     <html><head><body></body></html>
b.     <html><body></body></html>
c.     <html><head></head><body></body></html> 
d.     <html><head></head></html>

Question:17
Which attributes of the <table> tag is deprecated in HTML 4.01 and not supported in strict DTD XHTML?
a.     Align
b.     bgcolor
c.     cellspacing

Question:18
A developer wrote this image tag:
<img src =”states.gif” width =”330? height =”406? alt=”States”
usemap =”#statemap” />
What code should follow this?
a.     <map id =”statemap” name=”statemap”>
 
<area shape =”rect” coords =”0,0,82,126? href=”state1.htm” alt=”State1? />
 
</map>
b.     <map id =”statemap” name=”statemap”></map>
<area shape =”rect” coords =”0,0,82,126? href=”state1.htm” alt=”State1? />
c.     <map id =”statemap” name=”statemap”>
<imgarea shape =”rect” coords =”0,0,82,126? href=”state1.htm” alt=”State1? /></map>
d.     <map id =”statemap” name=”statemap”></map>
<imgarea shape =”rect” coords =”0,0,82,126? href=”state1.htm” alt=”State1? />

Question:19
What do you understand by cellspacing?
a.     It makes the cell span more than one column
b.     It specifies the space between the cell wall and the contents of the cell
c.     It specifies the space between two cells
d.     It makes the cell span more than one row

Question:20
You have defined the following image in an XHTML document:
<img src=”/image/logo.gif” id=”img1? />
a.     The code will only work properly in a browser that supports XHTML
b.     The code will work properly in a browser that supports both HTML 4.x and XHTML
c.     The code will only work properly in a browser that supports HTML 4.x
d.     The code is incorrect, it will not work in any browser

Question:21
Please choose the most appropriate option.
One of the differences between XHTML and HTML 4.01 is that the “name” attribute has been replaced by the “id” attribute
in:
a.     img and applet tags
b.     img and map tags
c.     map and frame tags 
d.     img, map, frame and applet tags
e.     frame, applet, style and map tags

Question:22
Which of the following statements is true about the table header, body and footer tags?
a.     The table header, body and footer tags are <tablehead>, <tablebody> and <tablefoot> respectively
b.     The table header, body and footer tags are <tabhead>, <tabbody> and <tabfoot> respectively
c.     It is recommended to first specify the table header followed by the footer and then the body tag 
d.     None of the above

Question:23
Which of the following is not correct for a <meta> tag?
a.     It is more useful if it is placed in a head element
b.     It can be used to specify the keywords for the search engines
c.     It can be used to redirect users to other URLs
d.     It is mandatory to specify the name or scheme attributes

Question:24
Which attribute specifies the submit URL in a form?
a.     method
b.     Action
c.     name
d.     id

Question:25
Within a table cell “<td>”:
a.     <p></p> tags can’t be used
b.     <ol></ol> tags can’t be used
c.     <table></table> tags can’t be used
d.     <form></form> tags can’t be used
e.     All the above tags can be used

Question:26
How will you import a style sheet named “basic.css” in your web page?
a.     <import name=”stylesheet” url=”basic.css”>
b.     <link rel=”stylesheet” type=”text/css” href=”basic.css”/>

Question:27
While designing the links page of your website, you want the link to open in a new window. How will you implement this
with XHTML using Transitional doc type?
a.     <anchor href=”http://www.mailer.com”>Mailer</anchor>
b.     <anchor href=http://www.mailer.com target=_blank>Mailer</anchor>
c.     <A HREF=”http://www.mailer.com”>Mailer</A>
d.     <a href=”http://www.mailer.com” target=”_blank”>Mailer</a>
c.     <style name=”stylesheet” url=”basic.css”>
d.     <link item=”stylesheet” type=”text/css” href=”basic.css”>

Question:28
While writing a strict DTD XHTML document, you want to create a table having 2 columns, both left aligned. What technique
will you choose to do this?
a.     <table align=”left” border=”1?>
<tr><td>Plan A </td>
<td align=”left”>Monthly payment of $60</td>
</tr>
. . .
. . .
</table>
b.     <table border=”1?>
 
<tr><td align=”left”>Plan A</td>
 
<td align=”left”>Monthly payment of $60</td>
 
</tr>
. . .
. . .
</table>
c.     <table align=”left” border=”1?>
<tr><td align=”left”>Plan A</td>
<td align=”left”>Monthly payment of $60</td>
</tr>
. . .
. . .
</table>
d.     <table border=”1?>
<tr><td align=”left”>Plan A</td>
<td>Monthly payment of $60</td>
</tr>
. . .
. . .
</table>

Question:29
You want to provide a form field to the users for writing lengthy comments on the quality of the services provided by you.
Which of the following tags will you use?
a.     <textarea rows=”8? cols=”20?> Your comments ….</textarea>
b.     <textarea row=”8? col=”20?> Your comments ….</textarea>
c.     <textarea rowcount=”8? colcount=”20?> Your comments ….</textarea>
d.     <input type=”text” maxlength=”100? />

Question:30
Your browser supports bidirectional text. Which tag will you use if you need to display text from right to left?
a.     <opposite>Text should go in opposite direction</opposite>
b.     <p direction=”rtl”>Text should go in opposite direction</p>
c.     <bdo dir=”rtl”>Text should go in opposite direction</bdo>
d.     <text dir=”rtl”>Text should go in opposite direction</text>

Question:31
Your website has moved to some other address. How will you automatically redirect a user to that address within 3 seconds
of landing on the old address?
a.     <meta http-equiv=”refresh” content=”3; url=http://www.newurl.com” /> 
b.     <meta http=”refresh” url=”www.newurl.com” />
c.     <meta scheme=”refresh” name=”redirect” http=”www.newurl.com” />
d.     <meta http-equiv=”redirect” content=”3? http=”www.newurl.com” />

Question:32
What do you understand by cellpadding?
a.     It makes the cell span more than one column
b.     It specifies the space between the cell wall and the contents of the cell
c.     It specifies the space between two cells
d.     It makes the cell span more than one row

Question:33
Which of the following is correct about the <!DOCTYPE …> tag?
a.     It is not considered to be mandatory as per the XHTML specification
b.     It must have a closing tag
c.     It should come just after the <html> tag
d.     Its declaration is not a part of the XHTML document itself
e.     None of the above

Question:34
Which of the following is correct regarding the frame attribute of the table tag?
a.     It is used to add a frame to the table *
b.     A “hsides” frame attribute will show the border lines for horizontal sides of the table only
c.     A “hsides” frame attribute will not show the border lines for horizontal sides of the table only
d.     A “hsides” frame attribute will add a scrollable frame on the horizontal sides of the table

Question:35
What do you understand by the following line of code?
<html xmlns=”http://www.w3.org/TR/REC-xml-names”>
a.     xmlns specifies the URL to qualify the names used in the XHTML document
b.     xmlns means html-xml number sequence
c.     Elimination of xmlns tag will result in the document not being validated by a w3.org validator
d.     The page will not be displayed properly if the URL is changed to “http://www.w3.org/1999/xhtml”

Question:36
The following registration form was coded by a programmer in XHTML:
1. <!– Start of the Form Fields –>
2. Name:
3. <input type=”text” name=”name” maxlength=”50? />
4. Registration Date:
5. <input readonly type=”text” value=”javascript:getDate();” />
6. Account Type:
7. <select name=”Account”>
8. <option “selected” value=”Primary”>Primary</option>
9. <option value=”Secondary”>Secondary</option>
10. </select>
Which of the following options is true with regard to this XHTML document?
a.     The syntax of the input tag at line 3 is incorrect
b.     The readonly attribute in line 5 is not correctly coded
c.     The syntax of the select tag is not correct
d.     Maxlength cannot be specified with text boxes

Question:37
Take a look at the following code:
<html>
<head>
<title>HTML AND XHML</title>
<body>
<h1>Defining HTML
</body>
What will happen when you run this code in the browser?
a.     With a .html extension, the page will be displayed with errors
b.     With a .html extension, the page will not be displayed at all
c.     With a .xhtml extension, the page will be displayed with errors
d.     With a .xhtml extension, the page will not be displayed at all

Question:38
On one of your web pages named “Listing.xhtml” you specified a target like this:
<a name=”target4?>Old Listing</a>
How will you make a link to the above target?
a.     <a url=”#target4?>Check Old Listing as well</a>
b.     <a href=”#target4?>Check Old Listing as well</a>
c.     <link url=”target4?>Check Old Listing as well</link>
d.     <a href=”Listing.target4?>Check Old Listing as well</a>

Question:39
You placed four radio buttons on a web form. You want the users to specify whether they are male or female and whether
they are married or single. The code is as follows:
Male: <input type=”radio” checked=”checked” name=”chk” value=”male” />
Female: <input type=”radio” name=”chk” value=”female” />
Married: <input type=”radio” checked=”checked” name=”chk” value=”married” />
Single: <input type=”radio” name=”chk” value=”single” />
What is wrong with the above code?
a.     It will allow the user to choose only the male and the married options
b.     It will allow the user to choose only the female and single options
c.     It will allow the user to choose only one option out of the four
d.     It will allow the user to choose all the four options at the same time

Question:40
You specified a base tag and anchors as follows:
1. <base target=”_blank”></base>
2. <a href=”http://www.yahoo.com”>Yahoo</a>
3. <a href=”http://www.google.com” target=”_top”>Google</a>
Which of the following is true for 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

Question: 01 - Which of the following <iframe> attributes are NOT supported in HTML 5.0?
a.                   height
  1. marginheight
  2. sandbox
  3. scrolling
Question: 2 - Which <body> tag event is fired when the user leaves the document?
a.                   onunload
  1. onundo
  2. onredo
  3. onerror
Question: 03 - Which of the following is NOT a valid value for the <iframe> sandbox attribute in HTML 5.0?
a.                   url
  1. allow-scripts
  2. allow-same-origin
  3. allow-forms
Question: 04 - Which of the following is an INVALID value for the type attribute of command tag?
a.                   checkbox
  1. radio
  2. command
  3. 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.
  1. 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.
  2. It is used to queue calls to history.back() and similar APIs.
  3. 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>/p>
a.                   I use MAC Microsoft!
  1. I use MAC Microsoft!
  2. I use MAC Microsoft!
  3. 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>
  1. <a href="webmaster@xcompany.com">webmaster</a>
  2. <a http="mail:webmaster@xcompany.com">webmaster</a>
  3. <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.
  1. The script will be executed when the page has finished parsing.
  2. 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.
  1. It will alert saying “[object Window]" when the document is loaded.
  2. It will alert saying “[this]" when the document is loaded.
  3. 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>
  1. <code>
  2. <dfn>
  3. <cite>


Question: 11 - 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:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAIqQlgfva6y1v4TkcW-lwfKgFhwDY3pFAUy-Zmm2I0Aijqe7-iDhCxSwCQL9su5OB5NfH5F48cDD22gb0zTPx8ZYtLFZqMwMvgM3MzM9sCV8RELQx0Jw-73_813rMcB-tJEkppAEOQI7-/s640/OdeskHTML-Img001.jpg

a.                   The contents of the element will be of red color and will inherit all the effects of style.css.
  1. The contents of the element will be of blue color and will inherit all the effects of style1.css.
  2. The contents of the element will be of white color and will inherit all the effects of style.css and style1.css.
  3. None of the style effects will be applied to the contents of the element.
Question: 12 - Which of the following are valid HTML 5.0 elements?
a.                   <canvas>
  1. <summary>
  2. <aside>
  3. <video>
All are correct
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.
  1. A button tag button can be a reset button too.
  2. An input tag button can include images as well.
  3. 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
  1. colgroup
  2. rowspan
  3. 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.
  1. The script will run when the media is played to the end, without stopping for buffering.
  2. The script will run when media data is loaded.
  3. The script will run when the length of the media is changed.
Question: 16 - The following link is placed on an HTML webpage.
<a href="http://msdn.com/" target="_blank"</a>
What do you infer from it?
a.                   It will open the site msdn.com in the same window.
  1. It will open the site msdn.com in a new window.
  2. It will open the site msdn.com in a frame below.
  3. It will not be clickable as it is not formed correctly.
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"
  1. A link element whose href is “A"
  2. None of the above
Question: 18 - 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.
  1. It is used to define the name of the radiogroup this command belongs to.
  2. It is used to define if the command is checked or not.
  3. It is used to define if the command is available or not.
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.
  1. By invoking the window. navigator.yieldForStorageUpdates() API method.
  2. 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.
  1. It is used to define computer code text.
  2. It is used to define sample computer code.
  3. It is used to define a definition term
Question: 21 - Which of the following is not a valid input type of the form tag?
a.                   checkbox
  1. image
  2. hidden
  3. button
  4. All are valid
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
  1. onsubmit
  2. onunload
  3. 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
  1. window.parent
  2. window.frameElement
  3. 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
  1. command
  2. checkbox
  3. radio
Question: 25 - What is the default background color for the canvas element in HTML 5.0?
a.                   Black
  1. White
  2. Transparent
  3. Gray
Question: 26 - Which of the following are valid mouse events in HTML 5.0?
a.                   ondblclick
  1. ondragstart
  2. ondragenter
  3. onscroll
  4. ondrop
All are correct
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
  1. JavaScript
  2. PostScript
  3. 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
  1. 90
  2. Item 1
  3. 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">
  1. <body background="Yellow">
  2. <body bgcolor="Yellow">
  3. <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.
  1. It triggers an event when the cache content has been marked as obsolete.
  2. It triggers an event when the cache content has been updated.
  3. 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’ />
  1. <input name=be evil />
  2. <input name = “be-evil" />
  3. All of the above.
Question: 32 - Which of the following is NOT a valid attribute for the <link> element in HTML 5.0?
a.                   hreflang
  1. rel
  2. http-equiv
  3. media
Question: 33 - 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:
undefined

a.                   User should define an accept attribute to the input element whose type is url.
  1. User should define multiple attribute to the input element whose type is url.
  2. User should define a list attribute to the input element whose type is url.
  3. User should define a placeholder attribute to the input element whose type is url.
Question: 34 - 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.
  1. The value of the input tag must be the same for all the radio buttons.
  2. The display text of the input tag must be the same for all the radio buttons.
  3. All the radio buttons must be added to the same group using the <optgroup> tag.
Question: 35 - 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
  1. expires
  2. set-cookie
  3. keywords
  4. refresh
  5. author
Question: 36 - Which media event is triggered when there is an error in fetching media data in HTML 5.0?
a.                   onstalled
  1. onwaiting
  2. onsuspend
  3. oninvalid
Question: 37 - In HTML 5.0, what is the function of the sandbox attribute when used with <iframe> as shown below? 
<iframe src="aaa " sandbox=?></iframe>
a.                   It is used to define the restrictions to the frame content.
  1. It is used to define the URL of the document that should appear in the iframe.
  2. It is used to specify that an iframe should appear as if it is part of the document the iframe is in.
Question: 38 - Which of the following is NOT a supported attribute of the <ol> element in HTML 5.0?
a.                   type
  1. reversed
  2. start
  3. compact
Question: 39 - When is the window onstorage event triggered in the HTML document?
a.                   It is triggered when the window is resized.
  1. It is triggered when a document loads.
  2. It is triggered when a document performs an undo function.
  3. It is triggered when the window becomes visible.
Question: 40 - Which of the following is NOT a valid attribute for the <video> element in HTML 5.0?
a.                   controls
  1. autoplay
  2. disabled
  3. preload
Question: 41 - Which of the following is NOT a valid syntax for the <h1> element in HTML 5.0?
a.                   <h1> This is header 1</h1>
  1. <h1 align="center"> This is header 1</h1>
  2. <h1 onClick="dothis(‘sc1′)" >This is header </h1>
  3. <h1 style="cursor:auto;">This is header </h1>
Question: 42 - Which of the following video file formats are currently supported by the <video> element of HTML 5.0?
a.                   CCTV
  1. MPEG 4
  2. Ogg
  3. 3GPP

Que: 01 – Which of the following attributes are NOT supported in HTML 5.0?
Options:
A. height
B. marginheight
C. sandbox
D. scrolling
Que: 2 – Which tag event is fired when the user leaves the document?
Options:
A. onunload
B. onundo
C. onredo
D. onerror
Que: 03 – Which of the following is NOT a valid value for the sandbox attribute in HTML 5.0?
Options:
A. url
B. allow-scripts
C. allow-same-origin
D. allow-forms
Que: 04 – Which of the following is an INVALID value for the type attribute of command tag?
Options:
A. checkbox
B. radio
C. command
D. text
Que: 05 – What is the function of the history traversal task source in HTML 5.0?
Options:
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.
Ques: 06 – What will be the result if you use the following code to your HTML 5.0 document?
I use MAC Microsoft!
/p >
Options:
A. I use MAC Microsoft!
B. I use MAC Microsoft!
C. I use MAC Microsoft!
D. I use MAC Microsoft!
Ques: 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?
Options:
A. webmaster
B. webmaster
C. webmaster
D. webmaster
Ques: 08 – In HTML 5.0, how will the script be executed if you use the script element shown below?
Options:
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.
Ques: 09 – What is the output when you use the HTML 5.0 code snippet shown below?
Options:
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.
Ques: 10 – A computer programming book has to go online. Which of the following tags is ideal for displaying the program snippets?
Options:
A.
B. 
C.
D.
Ques: 11 - 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:
OdeskHTML-Img001
Options:
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.
Ques: 12 - Which of the following are valid HTML 5.0 elements?
Options:
A.
B.
C.

Comments

Post a Comment

Popular posts from this blog

Freelancer Wordpress Exam Answers 2016

Computer Aptitude Test Answers 2021 - Upwork Computer Aptitude Test Answers 2021