HTML MCQs – HTML Forms and Input Elements

21.) Which attribute is used to specify whether an input field in an HTML form is disabled or not?

A) disabled
B) enabled
C) readonly
D) active

Answer: Option A

Explanation: The “disabled” attribute is used to specify whether an input field in an HTML form is disabled or not.

22.) Which attribute is used to specify the width of an input field in an HTML form?

A) width
B) size
C) length
D) width

Answer: Option B

Explanation: The “size” attribute is used to specify the width of an input field in an HTML form.

23.) Which input type is used for capturing multiline text input in HTML forms?

A) text
B) multiline
C) textarea
D) inputarea

Answer: Option C

Explanation: The element is used to capture multiline text input in HTML forms.

24.) Which attribute is used to specify the maximum number of characters allowed in a text input field in HTML forms?

A) maxlength
B) maxchars
C) charlimit
D) maxtext

Answer: Option A

Explanation: The “maxlength” attribute is used to specify the maximum number of characters allowed in a text input field in HTML forms.

25.) Which attribute is used to specify the default selected option in a dropdown list in HTML forms?

A) default
B) selected
C) defaultoption
D) initial

Answer: Option B

Explanation: The “selected” attribute is used to specify the default selected option in a dropdown list in HTML forms.

26.) Which input type is used for capturing numeric input in HTML forms with controls for incrementing and decrementing the value?

A) numeric
B) spinner
C) number
D) counter

Answer: Option C

Explanation: The input type “number” is used for capturing numeric input in HTML forms with controls for incrementing and decrementing the value.

27.) Which attribute is used to specify the alignment of the text within a text input field in HTML forms?

A) align
B) text-align
C) alignment
D) style

Answer: Option B

Explanation: The “text-align” attribute is used to specify the alignment of the text within a text input field in HTML forms.

Leave a Reply

Your email address will not be published. Required fields are marked *