HTML Questions & Answers – XHTML & HTML Element Reference

This set of HTML Mcqs focuses on “XHTML & HTML Element Reference”.

1. Which attribute specifies a unique alphanumeric identifier to be associated with an element?
a) class
b) id
c) article
d) html
View Answer

Answer: b
Explanation: HTML is Hyper Text Markup Language which is used to create web pages and applications. The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id. Class is a name given to HTML elements which can be used by CSS and JavaScript for styling the web pages. A self-contained content is called attribute.

2. The _____________ attribute specifies an inline style associated with an element, which determines the rendering of the affected element.
a) dir
b) style
c) class
d) article
View Answer

Answer: b
Explanation: Style attribute specifies an inline style for an element. The style attribute will override any style set globally, e.g. styles specified in the style tag or in an external style sheet. A self-contained content is called attribute. Class is a name given to HTML elements which can be used by CSS and JavaScript for styling the web pages. List of directory files is given by dir tag which is not supported in HTML5.

3. Which attribute is used to provide an advisory text about an element or its contents?
a) tooltip
b) dir
c) title
d) head
View Answer

Answer: c
Explanation: The extra information about an element is specified by title tag. The information is most often shown as a tooltip text when the mouse moves over the element. List of directory files is given by dir tag which is not supported in HTML5. Tooltip or else infotip is a graphical user interface of an element. Container of metadata is called head.
advertisement
advertisement

4. The __________ attribute sets the text direction as related to the lang attribute.
a) lang
b) sub
c) dir
d) ds
View Answer

Answer: c
Explanation: The dir attribute specifies the text direction of the element’s content. List of directory files is given by dir tag which is not supported in HTML5. The language of an element’s content is given by lang attribute. The subscript text is defined by sub attribute.

5. Which of the following is the attribute that specifies the column name from the data source object that supplies the bound data?
a) dataFormatAs
b) datafld
c) disabled
d) datasrc
View Answer

Answer: b
Explanation: DataFormatAs specifies how data is rendered. The identifier for data source is set by dataSrc. Datafld attribute specifies the column name from the data source object that supplies the bound data. This attribute is specific to Microsoft’s data binding. A Disabled is a boolean attribute which specifies that <input> element should be disabled.

6. Which of the following is the attribute that indicates the name of the data source object that supplies the data that is bound to this element?
a) dataFormatAs
b) datafld
c) disabled
d) datasrc
View Answer

Answer: d
Explanation: The identifier for data source is set by dataSrc. When the dataSrc property is applied to a tabular data consumer, the entire data set is repeated by the consuming elements. DataFormatAs specifies how data is rendered. A Disabled is a boolean attribute which specifies that <input> element should be disabled.

7. Which of the following is the attribute that specifies additional horizontal space, in pixels, to be reserved on either side of an embedded item like an iframe, applet, image, and so on?
a) height
b) hspace
c) hidefocus
d) datasrc
View Answer

Answer: b
Explanation: Height of element is pixels is specified by height attribute. The hspace attribute specifies the whitespace on left and right side of an object. The hidefocus specifies whether a focused rectangle is drawn around an object. The identifier for data source is set by dataSrc.
advertisement

8. The accesskey attribute specifies a keyboard navigation accelerator for the element.
a) True
b) False
View Answer

Answer: a
Explanation: The accesskey attribute specifies a shortcut key to activate/focus an element. It specifies a keyboard navigation accelerator for the element. We can use accesskey attribute in forms or links.

9. Which of the following is the attribute that is used to set a global identifier for a microdata item?
a) key
b) id
c) itemclass
d) itemid
View Answer

Answer: d
Explanation: The unique id for an element in html is specified by id attribute. Itemmid allows a vocabulary to define a global identifier for a microdata item, for example an ISBN number on a book. Use itemid on the same element as the item’s itemscope and itemtype attributes.
advertisement

10. Which of the following is the attribute that is used to add a name/value pair to a microdata item?
a) itemscope
b) itemref
c) itemprop
d) itemid
View Answer

Answer: c
Explanation: A boolean global attribute which specifies scope of associated metadata is itemscope. Itemmid is unique global identifier of item. To add a property to an item, the itemprop attribute is used on one of the item’s descendants. Markup without the microdata-related attributes does not have any effect on the microdata model. Itemref provides list of elements id’s with extra/additional properties in the document.

Sanfoundry Global Education & Learning Series – HTML.

To practice MCQs on all areas of HTML, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.