HTML Objective Questions - HTML5 Form Changes

1. The __________ element may contain not just links but also other interactive items, including the newly introduced command element.
a) progress
b) meter
c) details
d) menu

Answer: d
Explanation: A scalar measurement within a range or fractional value is defined by meter tag. The menu tag defines a list/menu of commands. The menu tag is used for context menus, toolbars and for listing form controls and commands. The details tag specifies additional details that the user can view or hide on demand. The details tag can be used to create an interactive widget that the user can open and close. Any sort of content can be put inside the <details> tag. Progress of a task is done by progress element.

2. The __________ attribute effectively renders the iframe as an inline include, which allows the parent document’s CSS to affect the contents of the iframe.
a) allow-forms
b) seamless
c) embed
d) allow-scripts

Answer: b
Explanation: Embed attribute attach external content at a specified point in document. The seamless attribute is a boolean attribute. When present, it specifies that the iframe should look like it is a part of the containing document (no borders or scrollbars). Allow-forms re-enables from submission. Scripts are re-enabled by allow-scripts.

3. Which of the following allows the sandboxed iframe to run scripts from the same domain?
a) allow-same-origin
b) allow-forms
c) allow-scripts
d) allow-pointer-lock

Answer: c
Explanation: Scripts are re-enabled by allow-scripts. The sandbox attribute enables an extra set of restrictions for the content in the iframe. Allow-forms re-enables from submission. Allow-same-origin allows iframe content to be treated as being from the same origin. API’s are re-enable by allow-pointer-lock.

4. _________ allows the iframe to pull in content from elsewhere in the same domain.
a) allow-same-origin
b) allow-forms
c) allow-scripts
d) allow-pointer-lock

Answer: a
Explanation: Scripts are re-enabled by allow-scripts. Allow-forms re-enables from submission. Allow-same-origin allows iframe content to be treated as being from the same origin. API’s are re-enable by allow-pointer-lock.

5. Which of the following is not a HTML5 added form element?
a) <datalist>
b) <keygen>
c) <output>
d) <password>

Answer: d
Explanation: <datalist>, <keygen> and <output> are HTML5 added form element. Element <password> is not a HTML5 added form element. Password is an attribute used in input type in HTML.

6. Which element specifies a list of pre-defined options for an input element?
a) <datalist>
b) <keygen>
c) <output>
d) <password>

Answer: a
Explanation: The datalist tag is used to provide an “autocomplete” feature on input elements. Users will see a drop-down list of pre-defined options as they input data. Password defines password field in HTML. It is attribute for input-type. The <keygen> element references from data after form has submitted. Result of calculation (script) is represented by output tag.

7. Which of the following defines a group of related options in a drop-down list?
a) <form>
b) <optgroup>
c) <output>
d) <option>

Answer: b
Explanation: HTML form element is used in its <form> tag having its own structure which is used by users for various tasks. If you have a long list of options, groups of related options are easier to handle for a user. Result of calculation (script) is represented by output tag. A drop down list of items is defined by <option> tag in HTML.

8. Which one is correct syntax?
a) <p id=”1td”>
b) <p id=”td”>
c) <p id=”%td”>
d) <p id=”#td”>

Answer: b
Explanation: <p id=”td”> is the correct syntax for id type declaration. Id attribute’s value should start with a letter or an underscore. We cannot use any number or other character for defining name of the id.

9. Which of the following is not example of block element?
a) <h1>
b) <ul>
c) <p>
d) <a>

Answer: d
Explanation: The elements which always appear to start on a new line in browser are known as block level elements. Examples are <h1>,<ul>,<li> and <p>.

10. What does semantic markup not define?
a) provides extra information
b) where an emphasis is placed in a sentence
c) meaning of an acronym
d) that describes paragraphs

Answer: d
Explanation: <Semantic markup> which provides extra information, such as where emphasis is placed in a sentence, that something you have written is a quotation, the meaning of acronyms etc.