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
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?
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?
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.
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
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?
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.
6. srclang attribute is used with the element ____________
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
Explanation: spellcheck is a global attribute, it indicates if spell checking is allowed or not for the element. Syntax is
<p contenteditable=”true” spellcheck=”true”> William Shakespeare was a great novelist. </p>
William Shakespeare was a great novelist.
8. Which parameter is commonly used for size attribute?
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?
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.
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
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 _____________
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
Explanation: This attribute basically use by <a> and <area> elements. It shows the hyperlink is to be used to download a resource.
13. datetime attribute is not related with ______________
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 ___________
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
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.