Single Choice Question

  1. What is the purpose of a form in HTML?
    1. To display images.
    2. To collect user input.
    3. To style web pages.
    4. To validate server-side scripts.
  2. What is the purpose of the "required" attribute in an input field?
    1. To make the field mandatory.
    2. To validate the input data.
    3. To style the form.
    4. To submit the form.
  3. What is the purpose of the "placeholder" attribute in an input field?
    1. To provide a default value for the field.
    2. To display a message when the field is empty.
    3. To style the form.
    4. To submit the form.
  4. Which attribute is used to specify the action to be performed when the form is submitted?
    1. action
    2. operation
    3. url
    4. method
  5. What attribute is used to define the action URL of an HTML form?
    1. type
    2. method
    3. action
    4. src
  6. Which input type is used to create a single-line text field?
    1. text
    2. password
    3. submit
    4. reset
  7. What is the default method of an HTML form if it is not specified?
    1. GET
    2. POST
    3. PUT
    4. DELETE
  8. How do you create a radio button group in HTML?
    1. Use the same name attribute for all radio buttons in the group.
    2. Use the same id attribute for all radio buttons in the group.
    3. Wrap the radio buttons in a <div> element.
    4. Use the type="group" attribute for the first radio button.
  9. What attribute is used to define a placeholder text for an input field?
    1. placeholder
    2. value
    3. default
    4. text
  10. Which input type is used to create a checkbox?
    1. checkbox
    2. radio
    3. button
    4. image
  11. What is the purpose of the enctype attribute in an HTML form?
    1. To define the character encoding of the form data.
    2. To define the MIME type of the form data when submitting files.
    3. To define the color scheme of the form.
    4. To define the font size of the form.
  12. How do you create a submit button in an HTML form?
    1. Use <input type="submit">
    2. Use <button> without specifying a type.
    3. Use <button type="reset">
    4. Use <input type="text"> with a placeholder text.
  13. What is the purpose of the autocomplete attribute in an HTML form?
    1. To automatically fill in form fields based on user's previous entries.
    2. To validate form data on the client side.
    3. To submit form data to the server automatically.
    4. To encrypt form data before submission.
  14. Which input type is used to create a drop-down list?
    1. select
    2. dropdown
    3. list
    4. menu
  15. How do you create a multi-line text field (textarea) in HTML?
    1. Use <input type="textarea">
    2. Use <textarea> with opening and closing tags.
    3. Use <input type="multiline">
    4. Use <multiline> with opening and closing tags.
  16. What is the purpose of the required attribute in an HTML form input?
    1. To indicate that the input field is for read-only data.
    2. To make the input field mandatory for form submission.
    3. To automatically submit the form when the field is filled.
    4. To validate the input format based on a predefined pattern.
  17. How do you create a form element in HTML?
    1. Use <form> with opening and closing tags.
    2. Use <input type="form">
    3. Use <div class="form">
    4. Use <section> with a specific class for forms.
  18. What is the purpose of the novalidate attribute in an HTML form?
    1. To disable browser-side form validation.
    2. To enable automatic form submission on page load.
    3. To encrypt form data before sending it to the server.
    4. To change the color of form fields when they are invalid.
  19. Which HTML element is used to group related form controls?
    1. <fieldset>
    2. <section>
    3. <div>
    4. <group>
  20. How do you define a label for an input field in HTML?
    1. Use <label> with the for attribute matching the input's id.
    2. Use <input> with a label attribute.
    3. Wrap the input inside a <label> element.
    4. Both A and C are correct.
  21. What attribute is used to specify the character encoding of form data?
    1. enctype
    2. charset
    3. accept-charset
    4. encoding
  22. How do you create a file input field in HTML?
    1. Use <input type="file">
    2. Use <input type="upload">
    3. Use <file> with opening and closing tags.
    4. Use <input type="text" accept="file/*">
  23. What is the purpose of the name attribute in an HTML form input?
    1. To define the value of the input field.
    2. To assign a unique identifier to the input field for server-side processing.
    3. To change the color of the input field.
    4. To define the placeholder text for the input field.
  24. Which input type is used to create a button that resets the form to its initial values?
    1. reset
    2. clear
    3. erase
    4. initialize

True or False Question

  1. An HTML form can be submitted without a submit button.
  2. The <input type="text"> element is used for multiple-line text inputs.
  3. The <select> element allows the user to select one from a dropdown menu.
  4. The <textarea> element defines a single-line text input control?
  5. The <input type="password"> element displays the characters as asterisks for security.
  6. The <input type="radio"> element allows the user to select only one of a limited number of choices.
  7. The <input type="checkbox"> element allows the user to select multiple options from a list of checkboxes.
  8. The <input type="submit"> element defines a submit button that submits the form data to a server.
  9. The method attribute of an HTML form is used to specify the HTTP method used to submit the form data.
  10. The post method is more secure than the get method.
  11. The <input type="hidden"> element is used to define a hidden input field.

Definition of Term

  1. Form
  2. Input control

Short Answer

  1. Try to explain the function of the form element.
  2. Explain types of button controls in HTML.
  3. Explain the difference between put and post method in form.
  4. List and explain the most important attributes of an input control.(at least 5)
  5. List and explain the most commonly used input type controls in a form.(at least 5)