Sunday, 8 June 2025

MCQs Of Class 7 - Forms Part 2 (Advanced Elements)

  MCQs  Of Class 7 - Forms Part 2 (Advanced Elements)

MCQs on Advanced Form Elements

1.   What is the purpose of the checked attribute in checkboxes and radio buttons?

o    a) It specifies the background color of the input.

o    b) It defines the default selected state of the input.

o    c) It disables the input field.

o    d) It groups multiple inputs together.
Answer: b) It defines the default selected state of the input.
Explanation: The checked attribute ensures that the input is preselected when the page loads.


2.   Which attribute is mandatory for grouping radio buttons?

o    a) value

o    b) name

o    c) checked

o    d) type
Answer: b) name
Explanation: All radio buttons in a group must share the same name attribute to ensure mutual exclusivity.


3.   What does the <option> tag represent in a <select> menu?

o    a) An individual option in a dropdown list.

o    b) A group of options in the dropdown.

o    c) A placeholder text.

o    d) The default value for the dropdown.
Answer: a) An individual option in a dropdown list.
Explanation: The <option> tag specifies each choice in a <select> menu.


4.   Which input type is used to select multiple items from a list?

o    a) Radio button

o    b) Checkbox

o    c) Text

o    d) Password
Answer: b) Checkbox
Explanation: Checkboxes allow multiple selections from a group of inputs.


5.   What happens if multiple radio buttons in a group have different name attributes?

o    a) They function as independent inputs.

o    b) They are automatically grouped together.

o    c) Only the first button works.

o    d) They display an error message.
Answer: a) They function as independent inputs.
Explanation: Radio buttons with unique name attributes are treated as separate groups.


6.   Which attribute is used to specify the value of a selected <option>?

o    a) value

o    b) name

o    c) id

o    d) type
Answer: a) value
Explanation: The value attribute holds the data sent to the server when the option is selected.


7.   What does the <label> tag do in a form?

o    a) Groups related form fields.

o    b) Links a text description to an input field.

o    c) Styles the form.

o    d) Adds a tooltip to the input.
Answer: b) Links a text description to an input field.
Explanation: Using <label> improves accessibility by associating text with its corresponding input.


8.   Which input type allows users to select a single option from a predefined list?

o    a) Checkbox

o    b) Radio button

o    c) Select menu

o    d) Text
Answer: b) Radio button
Explanation: Radio buttons allow users to select one option from a group.


9.   What happens when you do not include the value attribute in a checkbox?

o    a) The checkbox cannot be selected.

o    b) The value defaults to "on".

o    c) It throws an error.

o    d) It uses the text of the label.
Answer: b) The value defaults to "on".
Explanation: Without a value attribute, checkboxes default to sending "on" when selected.


10.                     Which tag is used to create a dropdown menu in HTML?

o    a) <dropdown>

o    b) <select>

o    c) <input type="dropdown">

o    d) <menu>
Answer: b) <select>
Explanation: The <select> tag is used for dropdown menus.


Additional MCQs

11.                     What attribute ensures a dropdown option is preselected?

o    a) checked

o    b) selected

o    c) default

o    d) active
Answer: b) selected

12.                     Which of the following is used to group related options in a dropdown menu?

o    a) <option>

o    b) <select>

o    c) <optgroup>

o    d) <label>
Answer: c) <optgroup>

13.                     What does the for attribute in a <label> tag reference?

o    a) The input's name attribute

o    b) The input's value attribute

o    c) The input's id attribute

o    d) The form's action attribute
Answer: c) The input's id attribute

14.                     What is the default type for the <input> tag?

o    a) text

o    b) password

o    c) radio

o    d) button
Answer: a) text

15.                     Which tag is used to create a multiline text input field?

o    a) <input type="text">

o    b) <textarea>

o    c) <input type="textarea">

o    d) <multiline>
Answer: b) <textarea>

16.                     What does the disabled attribute do?

o    a) Hides the input field.

o    b) Prevents users from interacting with the input.

o    c) Highlights the input.

o    d) None of the above.
Answer: b) Prevents users from interacting with the input.

17.                     What is the purpose of the multiple attribute in a <select> tag?

o    a) Allows multiple options to be selected.

o    b) Duplicates the dropdown.

o    c) Changes the layout of the dropdown.

o    d) Groups options.
Answer: a) Allows multiple options to be selected.


Explanations

For the above questions, explanations relate to basic behaviors and attributes of form controls and ensure students understand the practical implementation in HTML. Would you like more MCQs, or focus on additional aspects of these elements?

You said:

rest 33

ChatGPT said:

ChatGPT

Here are the remaining 33 MCQs on advanced form elements:


18.                     What does the placeholder attribute in an input field do?

o    a) Provides a tooltip for the input field.

o    b) Sets the initial value of the input field.

o    c) Displays a hint text inside the input field.

o    d) Sets the label for the input field.
Answer: c) Displays a hint text inside the input field.


19.                     Which input type is used for selecting a file to upload?

o    a) text

o    b) file

o    c) upload

o    d) browse
Answer: b) file


20.                     What does the readonly attribute do in an input field?

o    a) Makes the field editable only once.

o    b) Prevents the field from being edited but still allows it to be copied.

o    c) Hides the field.

o    d) Makes the field disabled.
Answer: b) Prevents the field from being edited but still allows it to be copied.


21.                     Which attribute is used to define a default value for an input field?

o    a) value

o    b) placeholder

o    c) default

o    d) input
Answer: a) value


22.                     What is the use of the autocomplete attribute in a form?

o    a) Automatically submits the form after filling.

o    b) Fills fields based on previously entered values.

o    c) Suggests values for input fields.

o    d) Displays validation messages.
Answer: b) Fills fields based on previously entered values.


23.                     Which input type is used to select a date?

o    a) datetime

o    b) date

o    c) time

o    d) calendar
Answer: b) date


24.                     What does the min attribute in a number input field specify?

o    a) The minimum number of characters.

o    b) The minimum value allowed.

o    c) The default value.

o    d) The step value.
Answer: b) The minimum value allowed.


25.                     Which attribute is used to provide a hint for expected input values?

o    a) pattern

o    b) title

o    c) placeholder

o    d) name
Answer: a) pattern


26.                     What does the <datalist> tag do?

o    a) Creates a dropdown list of predefined values for an input field.

o    b) Acts as a placeholder for input.

o    c) Defines a range of values.

o    d) Groups related fields.
Answer: a) Creates a dropdown list of predefined values for an input field.


27.                     What is the purpose of the step attribute in input fields?

o    a) Defines the number of characters allowed.

o    b) Sets the incremental value for numeric inputs.

o    c) Specifies the size of the input field.

o    d) Limits the input to even numbers only.
Answer: b) Sets the incremental value for numeric inputs.


28.                     Which input type allows selecting a range of values?

o    a) number

o    b) range

o    c) slider

o    d) scale
Answer: b) range


29.                     What does the multiple attribute do in an input of type file?

o    a) Allows multiple files to be selected.

o    b) Enables file compression.

o    c) Displays a preview of uploaded files.

o    d) Limits file selection to one.
Answer: a) Allows multiple files to be selected.


30.                     What does the novalidate attribute in a <form> tag do?

o    a) Disables server-side validation.

o    b) Disables client-side validation.

o    c) Ignores required fields.

o    d) Prevents form submission.
Answer: b) Disables client-side validation.


31.                     What is the role of the <fieldset> tag in forms?

o    a) Groups related fields visually and semantically.

o    b) Adds a placeholder to form fields.

o    c) Validates input data.

o    d) Hides fields.
Answer: a) Groups related fields visually and semantically.


32.                     Which tag is used to provide a caption for a <fieldset>?

o    a) <caption>

o    b) <legend>

o    c) <label>

o    d) <title>
Answer: b) <legend>


33.                     What input type is used to mask sensitive data?

o    a) password

o    b) text

o    c) hidden

o    d) secure
Answer: a) password


34.                     Which input type allows entering an email address with validation?

o    a) email

o    b) text

o    c) url

o    d) search
Answer: a) email


35.                     Which attribute specifies the URL to send the form data to?

o    a) method

o    b) action

o    c) target

o    d) url
Answer: b) action


36.                     Which value of the method attribute sends form data as a URL query string?

o    a) post

o    b) get

o    c) put

o    d) delete
Answer: b) get


37.                     What input type is best for entering a URL?

o    a) email

o    b) url

o    c) text

o    d) link
Answer: b) url


38.                     What does the required attribute do in a form field?

o    a) Prevents the field from being submitted if empty.

o    b) Automatically fills the field.

o    c) Hides the field.

o    d) Validates the field format.
Answer: a) Prevents the field from being submitted if empty.


39.                     Which attribute specifies where to display the response after form submission?

o    a) target

o    b) action

o    c) method

o    d) url
Answer: a) target


40.                     Which input type is used for entering a telephone number?

o    a) text

o    b) tel

o    c) number

o    d) phone
Answer: b) tel


41.                     What does the pattern attribute do in an input field?

o    a) Sets the background image of the input field.

o    b) Defines a regular expression for input validation.

o    c) Limits the input length.

o    d) Enables autocompletion.
Answer: b) Defines a regular expression for input validation.


42.                     Which attribute is used to group a set of radio buttons for selection?

o    a) type

o    b) name

o    c) value

o    d) checked
Answer: b) name

 

No comments:

Post a Comment

Search This Blog

Powered by Blogger.