HTML Questions and Answers Part-22

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

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>

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>

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.

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

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

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

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.

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

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

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

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

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

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

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.