HTML Questions & Answers – Common HTML5 Attributes Reference

This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Common HTML5 Attributes Reference”.

1. What does wrap attribute denote?
a) Whether the text is in bold
b) Whether the text is wrapped
c) Whether the text is in italics
d) Whether the text is highlighted
View Answer

Answer: b
Explanation: wrap is the attribute of <textarea> element and it indicates whether the text should be wrapped. Syntax: <textarea wrap=””> if we use wrap=”hard” it will contain newlines in the submission of a form. This attribute is newly introduced by HTML5 and is supported by all the browsers.

2. With which element width attribute is not define?
a) <input>
b) <object>
c) <embed>
d) <textarea>
View Answer

Answer: d
Explanation: width attribute is defined with <object>, <iframe>, <img>, <video>, <canvas>, <embed>, <input>. <textarea> is used commonly with autofocus, cols, dirname, disabled, form, maxlength, minlength, name, placeholder, readonly, rows and many other attributes.

3. Which of the following defines a default value on page load?
a) <object>
b) <input>
c) <progress>
d) <area>
View Answer

Answer: c
Explanation: <button>, <li>, <progress>, <param>, <meter>, <input>, <option> are some elements used with value attribute and defines a default value on the page load. <object> element is used with many attributes like border, data, form, height etc. <area> is used with attributes like alt, cords, download, href, hreflang and many more.
advertisement
advertisement

4. How title attribute works?
a) Displays text when hovering over the element
b) Focus text when hovering over the element
c) Highlight text when hovering over the element
d) Zoom in and zoom out text when hovering over the element
View Answer

Answer: a
Explanation: the title is a global attribute that displays text in a tooltip when hovered over the element. Syntax is:

<p><abbr title=”Indian Association Service”>IAS</abbr> is India’s one of the most difficult job.</p>

Output: IAS is India’s one of the most difficult job.

5. Which attribute is not for overriding the actions?
a) Formaction
b) Style
c) Tabindex
d) Slot
View Answer

Answer: d
Explanation: formaction is used for overriding <form> action, style is a global attribute that overrides previously set styles, tabindex is also a global attribute which overrides default tab order. A slot is a global attribute which assigns a slot in a shadow.
advertisement

6. srclang attribute is used with the element ____________
a) <track>
b) <input>
c) <iframe>
d) <table>
View Answer

Answer: a
Explanation: srclang attribute is used with <track>. It specifies the language of text. E.g <track src=”xyz.ogg” srclang=”en” label=”English”>, <input> is used with many attributes like accept, alt, async, autocomplete, autofocus, checked, dirname, disabled, form, formaction, height, list and many more.

7. What is the use of spellcheck attribute?
a) Checks spelling
b) Indicates if spell checking is allowed
c) Checks spelling and corrects it
d) Checks spelling of a given particular text only
View Answer

Answer: b
Explanation: spellcheck is a global attribute, it indicates if spell checking is allowed or not for the element. Syntax is

advertisement
<p contenteditable=”true” spellcheck=”true”> William Shakespeare was a great novelist. </p>

Output:

William Shakespeare was a great novelist.

.

8. Which parameter is commonly used for size attribute?
a) centimeter
b) pixels
c) inch
d) millimeter
View Answer

Answer: b
Explanation: Size is an attribute commonly used with <input> and <select> element, it defines the width of element in pixels. If we have password or text as attribute then it will be count number of characters. Sizes is a attribute use with <link>, <source>, <img>

9. Which attribute indicates a descending order of displaying a list?
a) reversed
b) forward
c) straight
d) circular
View Answer

Answer: a
Explanation: Reverse attribute commonly use with <ol> element. It indicates that if the list is to be displayed in descending order instead of ascending order or not. There is no reference for options like forward, straight and circular in HTML.

10. The major difference between minlength and min attribute is ______
a) ‘minlength’ is for the minimum number of characters and ‘min’ is for the minimum value
b) ‘minlength’ is for the minimum value and ‘min’ is for the minimum number of characters
c) ‘minlength’ is for multiple values and ‘min’ is for the single value
d) ‘minlength’ is for single value and ‘minlength’ is for multiple values
View Answer

Answer: a
Explanation: minlength attribute use with <input>, <textarea> elements and it defines minimum number of character allowed. Min is used with <input>, <meter> elements and indicates minimum value allowed in element.

11. loop attribute is not used with _____________
a) <audio>
b) <marquee>
c) <video>
d) <track>
View Answer

Answer: d
Explanation: loop attribute is commonly use with <audio>, <bgsound>, <video>, <marquee> and denotes whether the media should start playing from the beginning when it is finished. <track> element is use with default attribute and it checks whether the track is enabled or not.

12. How does download attribute work?
a) An indication that hyperlink is to be used for downloading
b) Directly downloads as per the need of the user
c) Gives various source links to download
d) List the topics which one can download from a certain page
View Answer

Answer: a
Explanation: Download attribute basically use by <a> and <area> elements. It shows the hyperlink is to be used to download a resource when user clicks on it.

13. datetime attribute is not related with ______________
a) <del>
b) <time>
c) <ins>
d) <form>
View Answer

Answer: d
Explanation: datetime shows the date and time related with the element. Commonly use with <del>, <time>, <ins> elements. <del> is use with cite attribute, <ins> is also use with cite attribute, <form> element is use with various attributes like accept, action, accept-charset etc.

14. cols attribute is use with ___________
a) <td>
b) <th>
c) <textarea>
d) <ol>
View Answer

Answer: c
Explanation: cols indicates number of columns in a certain textarea, use with <textarea> element. <td> element is use with align attribute, <th> is also use with align attribute, <ol> is basically use with reversed attribute.

15. Use of checked attribute is ____________
a) Whether on page load element should be checked
b) Whether on page load all form element should be checked
c) Whether on page load all list element should be checked
d) Whether on page load all multimedia elements should be checked
View Answer

Answer: a
Explanation: checked is use with <command>, <input> elements and it indicates if element is checked on loading of the page or not.

Sanfoundry Global Education & Learning Series – HTML.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.