Skip to content
htmlbeginner

HTML Forms

Form elements and validation

6 questions

By EZ4Code Team

1. Which element is used for multi-line text input?

<textarea>
<input type='text'>
<input type='multiline'>
<p>
Explanation: <textarea> is used for multi-line text input; size can be controlled via rows/cols; input is single-line.

2. What does an input type of email do?

Provides email format validation and mobile keyboard optimization
Encrypts the email
Sends an email
Hides the field
Explanation: type='email' validates the email format on submission and pops up a more suitable keyboard (@ symbol) on mobile.

3. What does the required attribute do?

The field must be filled in before submission
Field is read-only
Field is hidden
Field is disabled
Explanation: required is a boolean attribute that marks a field as mandatory; if empty on submission, the browser blocks it and prompts.

4. How is a <label> associated with a form control?

The label's for attribute equals the control's id
The label's name equals the control's name
The label must wrap the control
Associated via class
Explanation: <label for='id'> associates with the control's id; clicking the label focuses/activates the control, improving accessibility and usability.

5. What is the <select> element used for?

Dropdown selection box
Text input
Button
Image
Explanation: <select> combined with <option> creates a dropdown selection box; multiple can be used for multi-select.

6. What are the two methods of form submission?

GET (query string) and POST (request body)
PUT and DELETE
HEAD and OPTIONS
FETCH and AJAX
Explanation: GET appends parameters to the URL query string, with length limits and insecure; POST puts them in the request body, suitable for sensitive/large data.

More html Quizzes