MCQs of Class 11: Forms in HTML - Part 2
1. What is the purpose of the <select> element in an HTML form?
- A.
To create a dropdown list for user selection
- B.
To create a multi-line text input
- C.
To submit the form
- D.
To define a radio button group
Answer: A. To create a dropdown list for user
selection
2. Which attribute is used to specify the initial value
of a radio button group?
- A.
value
- B.
checked
- C.
name
- D.
type
Answer: B. checked
3. What does the multiple attribute do in a <select>
element?
- A.
Allows multiple options to be selected
- B.
Sets a default value for the dropdown
- C.
Disables the dropdown list
- D.
Changes the dropdown list to a list box
Answer: A. Allows multiple options to be selected
4. How do you make a checkbox default to being selected?
- A.
Set the value attribute
- B.
Add the checked attribute
- C.
Use the selected attribute
- D.
Set the default attribute
Answer: B. Add the checked attribute
5. What is the purpose of the enctype="multipart/form-data"
attribute in a form?
- A.
To specify the form method
- B.
To allow file uploads within the form
- C.
To define the form action URL
- D.
To enable form validation
Answer: B. To allow file uploads within the form
6. Which input type is used to create a file upload
field?
- A.
text
- B.
password
- C.
file
- D.
submit
Answer: C. file
7. What does the <fieldset> element do in an HTML
form?
- A.
Groups related form elements together
- B.
Creates a dropdown list
- C.
Adds a file upload field
- D.
Submits the form data
Answer: A. Groups related form elements together
8. How do you specify that an input field must be filled
out before the form can be submitted?
- A.
Add the required attribute to the input field
- B.
Set the value attribute to required
- C.
Use the validate attribute
- D.
Include a placeholder text
Answer: A. Add the required attribute to the input
field
9. Which HTML attribute provides additional information
about a link or form element when a user hovers over it?
- A.
alt
- B.
title
- C.
name
- D.
type
Answer: B. title
10. What is the purpose of the method attribute in an
HTML form?
- A.
To specify the form's submission target URL
- B.
To define how the form data is sent to the server
- C.
To set the form's action URL
- D.
To create form validation rules
Answer: B. To define how the form data is sent to the
server
11. Which element is used to create a button that does
not submit a form but performs a custom action?
- A.
<input type="submit">
- B.
<button type="button">
- C.
<input type="button">
- D.
<button type="submit">
Answer: B. <button type="button">
12. What is the correct HTML tag for creating a dropdown
list?
- A.
<list>
- B.
<input type="dropdown">
- C.
<select>
- D.
<option>
Answer: C. <select>
13. Which input type is used to accept a numeric value?
- A.
text
- B.
number
- C.
range
- D.
date
Answer: B. number
14. What does the action attribute specify in an HTML
form?
- A.
The method used to submit the form
- B.
The URL where the form data is sent
- C.
The type of data the form will handle
- D.
The form's appearance style
Answer: B. The URL where the form data is sent
15. How can you make sure that a text input field only
accepts email addresses?
- A.
Use type="text" and validate with JavaScript
- B.
Use type="email"
- C.
Add a pattern attribute with regex for email
- D.
Use type="password"
Answer: B. Use type="email"
These MCQs cover various aspects of advanced HTML form
elements and their attributes, helping students to assess their understanding
of the concepts discussed in Class 11.
4o mini
You said:
more
ChatGPT said:
ChatGPT
Here are additional MCQs for Class 11: Forms in HTML - Part
2:
MCQs
16. Which HTML element is used to create a dropdown list
of options?
- A.
<option>
- B.
<select>
- C.
<list>
- D.
<dropdown>
Answer: B. <select>
17. What does the placeholder attribute do in an HTML
input field?
- A.
Provides a hint about the expected value
- B.
Specifies the initial value of the input field
- C.
Defines the maximum length of the input
- D.
Sets the default value of the field
Answer: A. Provides a hint about the expected value
18. Which attribute is used to define the relationship
between a form and its processing script?
- A.
method
- B.
action
- C.
enctype
- D.
target
Answer: B. action
19. What is the purpose of the name attribute in form
elements?
- A.
To provide a label for the form element
- B.
To specify the data sent to the server
- C.
To create a unique ID for the form element
- D.
To define the form's style
Answer: B. To specify the data sent to the server
20. Which input type is used to create a password field?
- A.
text
- B.
password
- C.
hidden
- D.
email
Answer: B. password
21. How do you group related checkboxes in a form?
- A.
Use the same name attribute for all checkboxes
- B.
Use a <fieldset> element with a <legend>
- C.
Use <div> containers
- D.
Use a dropdown list
Answer: B. Use a <fieldset> element with a <legend>
22. What is the default behavior of a submit button in an
HTML form?
- A.
It clears all input fields
- B.
It submits the form data to the server
- C.
It opens a new page
- D.
It validates the form fields
Answer: B. It submits the form data to the server
23. How do you ensure that a text area allows multiline
input?
- A.
Set the type attribute to textarea
- B.
Use the <textarea> element with rows and cols attributes
- C.
Use the text input type with rows attribute
- D.
Use the textarea element without any attributes
Answer: B. Use the <textarea> element with rows
and cols attributes
24. What attribute should be added to an input field to
make it read-only?
- A.
disabled
- B.
readonly
- C.
value
- D.
required
Answer: B. readonly
25. Which HTML tag is used to create a submit button in a
form?
- A.
<input type="submit">
- B.
<button type="submit">
- C.
<form type="submit">
- D.
<submit>
Answer: A. <input type="submit">
26. What does the required attribute do in a form
element?
- A.
Makes the field optional
- B.
Specifies that the field must be filled out before submitting the form
- C.
Sets a default value for the field
- D.
Adds a placeholder text
Answer: B. Specifies that the field must be filled
out before submitting the form
27. Which attribute in the <form> tag specifies
that the form should be sent to a server-side script via POST?
- A.
action
- B.
method
- C.
enctype
- D.
target
Answer: B. method
28. What does the target attribute of the <form>
element specify?
- A.
The form’s action URL
- B.
The form’s submission method
- C.
Where to display the response after submitting the form
- D.
The form’s encoding type
Answer: C. Where to display the response after
submitting the form
29. How do you specify a maximum length for user input in
a text field?
- A.
Use the maxlength attribute
- B.
Use the size attribute
- C.
Set the max attribute
- D.
Define the length attribute
Answer: A. Use the maxlength attribute
30. Which HTML element is used to create a form button
that performs an action without submitting the form?
- A.
<input type="button">
- B.
<button type="reset">
- C.
<input type="submit">
- D.
<button type="submit">
Answer: A. <input type="button">
These additional MCQs cover various aspects of form elements
and their attributes, providing a comprehensive assessment of students'
understanding of the material.
4o mini
You said:
give more
ChatGPT said:
ChatGPT
Certainly! Here are more multiple-choice questions (MCQs) on
the topic of forms in HTML:
MCQs
31. What attribute is used to specify the size of a text
input field?
- A.
width
- B.
size
- C.
length
- D.
height
Answer: B. size
32. Which HTML element is used to group form controls for
styling purposes?
- A.
<fieldset>
- B.
<section>
- C.
<group>
- D.
<div>
Answer: A. <fieldset>
33. What does the action attribute in the <form>
tag define?
- A.
The method used to submit the form data
- B.
The URL where the form data should be sent
- C.
The type of data the form will handle
- D.
The visual style of the form
Answer: B. The URL where the form data should be sent
34. Which HTML attribute is used to specify a form's data
encoding type?
- A.
enctype
- B.
type
- C.
encoding
- D.
method
Answer: A. enctype
35. How can you specify that a form field should be
disabled?
- A.
Add the disabled attribute to the form field
- B.
Add the readonly attribute
- C.
Set the type attribute to disabled
- D.
Use the value attribute
Answer: A. Add the disabled attribute to the form
field
36. Which attribute allows a <textarea> element to
specify the number of visible rows?
- A.
rows
- B.
size
- C.
cols
- D.
length
Answer: A. rows
37. Which input type is used to allow users to select a
date?
- A.
text
- B.
date
- C.
datetime
- D.
calendar
Answer: B. date
38. What does the autocomplete attribute do in an HTML
form?
- A.
Allows the form to be submitted automatically
- B.
Controls whether the browser should automatically complete form fields
- C.
Validates the form before submission
- D.
Specifies the method of form submission
Answer: B. Controls whether the browser should
automatically complete form fields
39. How do you create a multi-line text input field in a
form?
- A.
Use <input type="text"> with the size attribute
- B.
Use <textarea> with rows and cols attributes
- C.
Use <input type="textarea">
- D.
Use <input type="multiline">
Answer: B. Use <textarea> with rows and cols
attributes
40. What attribute is used to define the default value of
a text input field?
- A.
default
- B.
value
- C.
initial
- D.
placeholder
Answer: B. value
41. How can you make sure that only one option from a
group of radio buttons is selected?
- A.
Use the name attribute with the same value for all radio buttons
- B.
Set the checked attribute on all radio buttons
- C.
Use the type attribute as radio for all buttons
- D.
Use the value attribute with the same value
Answer: A. Use the name attribute with the same value
for all radio buttons
42. What is the function of the action attribute in the <form>
tag?
- A.
Specifies the type of the form data
- B.
Sets the URL to which the form data is submitted
- C.
Defines the form's method
- D.
Determines the form's appearance
Answer: B. Sets the URL to which the form data is
submitted
43. What is the default value of the method attribute in
an HTML form?
- A.
POST
- B.
GET
- C.
PUT
- D.
DELETE
Answer: B. GET
44. Which HTML tag is used to create a clickable button
that submits the form data?
- A.
<input type="submit">
- B.
<button type="submit">
- C.
<button type="click">
- D.
<input type="button">
Answer: A. <input type="submit">
45. How can you group related options in a dropdown list?
- A.
Use the <optgroup> element
- B.
Use the <group> element
- C.
Use the <fieldset> element
- D.
Use the <section> element
Answer: A. Use the <optgroup> element
These additional questions should help deepen the assessment
of students' understanding of HTML forms and their various elements.
4o mini
You said:
Give more
ChatGPT said:
ChatGPT
Here are some more MCQs on the topic of forms in HTML:
MCQs
46. Which attribute is used to specify the URL for form
submission using JavaScript?
- A.
action
- B.
data-url
- C.
onsubmit
- D.
href
Answer: C. onsubmit
47. Which input type allows the user to select multiple
options from a list?
- A.
checkbox
- B.
radio
- C.
select-multiple
- D.
text
Answer: C. select-multiple
48. What does the value attribute define for an <input>
element of type checkbox?
- A.
The checkbox's label
- B.
The default state (checked or unchecked)
- C.
The value to be sent to the server when the checkbox is checked
- D.
The maximum number of checkboxes allowed
Answer: C. The value to be sent to the server when
the checkbox is checked
49. How can you add a form element that allows users to
upload files?
- A.
<input type="upload">
- B.
<input type="file">
- C.
<upload>
- D.
<file>
Answer: B. <input type="file">
50. Which attribute in the <form> tag is used to
specify whether the form data should be encoded as multipart form data?
- A.
enctype
- B.
method
- C.
action
- D.
target
Answer: A. enctype
51. What attribute can you use to specify a short hint
displayed in a text input field?
- A.
hint
- B.
placeholder
- C.
title
- D.
label
Answer: B. placeholder
52. What does the required attribute do for a form field?
- A.
Makes the field optional
- B.
Ensures the field is filled out before submitting the form
- C.
Sets a maximum length for the input
- D.
Provides a default value for the field
Answer: B. Ensures the field is filled out before
submitting the form
53. How do you specify that a <textarea> should
automatically adjust its height to fit its content?
- A.
Use the auto-grow attribute
- B.
Use CSS to set height: auto;
- C.
Use the rows attribute with a high number
- D.
This feature is not available in HTML
Answer: B. Use CSS to set height: auto;
54. Which HTML element can be used to display a short
description or instructions about a form element?
- A.
<div>
- B.
<span>
- C.
<label>
- D.
<p>
Answer: C. <label>
55. What does the type="reset" attribute on a
button do in a form?
- A.
Submits the form data
- B.
Resets all form fields to their default values
- C.
Clears the form data
- D.
Opens the form in a new window
Answer: B. Resets all form fields to their default
values
56. Which input type allows users to select a time?
- A.
time
- B.
datetime-local
- C.
date
- D.
text
Answer: A. time
57. What is the purpose of the method="POST"
attribute in a form tag?
- A.
To submit the form data as a URL query string
- B.
To submit the form data to the server without displaying it in the URL
- C.
To specify the form's action URL
- D.
To define the form's appearance
Answer: B. To submit the form data to the server
without displaying it in the URL
58. Which attribute is used to specify the number of rows
in a <textarea> element?
- A.
rows
- B.
height
- C.
size
- D.
length
Answer: A. rows
59. What is the purpose of the name attribute in form
controls?
- A.
It provides a label for the form control
- B.
It specifies the data sent to the server
- C.
It determines the control’s visual style
- D.
It defines the default value of the form control
Answer: B. It specifies the data sent to the server
60. How can you make an <input> element of type radio
in a form?
- A.
Use the type="radio" attribute
- B.
Use the input="radio" attribute
- C.
Use the radio tag
- D.
Use the type="checkbox" attribute
Answer: A. Use the type="radio" attribute
These additional questions cover a range of form elements
and attributes to help reinforce students' understanding of advanced form
techniques.
4o mini
You said:
give more
ChatGPT said:
ChatGPT
Certainly! Here are some more MCQs on the topic of forms in
HTML:
MCQs
61. How do you specify that a form should be submitted
via an email client instead of the server?
- A.
Use method="mail"
- B.
Use action="mailto:example@example.com"
- C.
Use target="_blank"
- D.
Use enctype="text"
Answer: B. Use action="mailto:example@example.com"
62. Which attribute is used to define a default option
for a <select> dropdown list?
- A.
selected
- B.
default
- C.
active
- D.
chosen
Answer: A. selected
63. What does the multiple attribute do in a <select>
element?
- A.
Allows multiple options to be selected
- B.
Defines the number of options displayed
- C.
Sets a default option
- D.
Groups related options together
Answer: A. Allows multiple options to be selected
64. Which of the following is true about the <button>
element with type="button"?
- A.
It submits the form data
- B.
It resets the form fields
- C.
It triggers a JavaScript function but does not submit the form
- D.
It closes the form
Answer: C. It triggers a JavaScript function but does
not submit the form
65. How can you specify a maximum number of characters
allowed in a text input field?
- A.
maxlength attribute
- B.
size attribute
- C.
limit attribute
- D.
max attribute
Answer: A. maxlength attribute
66. Which input type is used to create a password field?
- A.
password
- B.
text
- C.
hidden
- D.
secure
Answer: A. password
67. How do you create a form element that allows users to
enter a URL?
- A.
<input type="url">
- B.
<input type="text">
- C.
<input type="link">
- D.
<input type="address">
Answer: A. <input type="url">
68. What is the purpose of the action attribute in the <form>
tag?
- A.
To specify the form's method
- B.
To define where the form data is sent upon submission
- C.
To set the form's visual style
- D.
To determine the form's validation rules
Answer: B. To define where the form data is sent upon
submission
69. What does the pattern attribute do in an <input>
element?
- A.
Specifies a regular expression for validating the input
- B.
Sets the default value for the input
- C.
Defines the input's placeholder text
- D.
Controls the visibility of the input
Answer: A. Specifies a regular expression for
validating the input
70. How can you add an option for users to choose a file
to upload in a form?
- A.
<input type="upload">
- B.
<input type="file">
- C.
<file>
- D.
<upload>
Answer: B. <input type="file">
71. What does the checked attribute do in a checkbox or
radio button?
- A.
It sets the default value of the checkbox or radio button
- B.
It determines whether the checkbox or radio button is selected by default
- C.
It specifies the number of checkboxes or radio buttons in a group
- D.
It hides the checkbox or radio button from view
Answer: B. It determines whether the checkbox or
radio button is selected by default
72. Which HTML attribute can you use to provide a brief
explanation for an input field, displayed when the user hovers over it?
- A.
alt
- B.
title
- C.
description
- D.
help
Answer: B. title
73. What attribute is used to prevent users from
modifying a text input field?
- A.
disabled
- B.
readonly
- C.
locked
- D.
immutable
Answer: B. readonly
74. Which attribute in the <form> tag is used to
specify how the form data should be sent?
- A.
method
- B.
action
- C.
enctype
- D.
target
Answer: A. method
75. How do you create a submit button in a form?
- A.
<input type="submit">
- B.
<button type="submit">
- C.
<input type="button">
- D.
<button type="button">
Answer: A. <input type="submit"> or
B. <button type="submit">
These additional questions should provide a thorough
understanding of the HTML forms and their various elements.
4o mini
You said:
give more
ChatGPT said:
ChatGPT
Certainly! Here are some additional MCQs on the topic of
forms in HTML:
MCQs
76. Which HTML element is used to group related form
controls?
- A.
<fieldset>
- B.
<group>
- C.
<section>
- D.
<container>
Answer: A. <fieldset>
77. What does the autocomplete attribute do in an input
field?
- A.
Enables or disables automatic completion of form values based on previous
user input
- B.
Automatically submits the form when the user types
- C.
Specifies the character limit for the input
- D.
Automatically generates a default value for the input field
Answer: A. Enables or disables automatic completion
of form values based on previous user input
78. What is the purpose of the form attribute in an <input>
element?
- A.
It specifies which form the input belongs to when there are multiple forms
on the page
- B.
It defines the style of the form
- C.
It provides the default value for the form
- D.
It specifies the action URL for the form submission
Answer: A. It specifies which form the input belongs
to when there are multiple forms on the page
79. How can you set a minimum value for a number input
field?
- A.
min attribute
- B.
value attribute
- C.
limit attribute
- D.
minvalue attribute
Answer: A. min attribute
80. Which HTML attribute is used to specify a form
control's visual appearance?
- A.
style
- B.
appearance
- C.
design
- D.
look
Answer: A. style
81. How do you create a dropdown menu with pre-defined
options in a form?
- A.
<select> with <option> elements
- B.
<menu> with <item> elements
- C.
<dropdown> with <choice> elements
- D.
<list> with <entry> elements
Answer: A. <select> with <option>
elements
82. What does the value attribute do in a radio button?
- A.
Defines the label of the radio button
- B.
Specifies the value that will be sent to the server when the radio button
is selected
- C.
Sets the default checked state of the radio button
- D.
Defines the position of the radio button on the page
Answer: B. Specifies the value that will be sent to
the server when the radio button is selected
83. Which attribute in the <input> tag specifies a
default value for a text field?
- A.
value
- B.
default
- C.
placeholder
- D.
initial
Answer: A. value
84. What does the action attribute in the <form>
tag define?
- A.
The method of form submission (e.g., GET or POST)
- B.
The URL where form data is sent for processing
- C.
The visual style of the form
- D.
The form’s validation rules
Answer: B. The URL where form data is sent for
processing
85. How can you allow users to select a date from a date
picker in a form?
- A.
<input type="date">
- B.
<input type="calendar">
- C.
<datepicker>
- D.
<input type="datetime">
Answer: A. <input type="date">
86. What does the readonly attribute do for an input
field?
- A.
Prevents the field from being submitted with the form
- B.
Makes the field visible but uneditable
- C.
Hides the field from view
- D.
Sets a default value for the field
Answer: B. Makes the field visible but uneditable
87. Which attribute would you use to ensure that a
checkbox is checked by default?
- A.
checked
- B.
default
- C.
selected
- D.
initial
Answer: A. checked
88. How do you specify that an <input> field should
accept numeric values only?
- A.
type="number"
- B.
type="text"
- C.
type="integer"
- D.
type="digit"
Answer: A. type="number"
89. What does the disabled attribute do in a form field?
- A.
Hides the field from view
- B.
Makes the field read-only
- C.
Prevents the field from being interacted with and included in form
submissions
- D.
Specifies a default value for the field
Answer: C. Prevents the field from being interacted
with and included in form submissions
90. How can you create a button that performs a
JavaScript action when clicked but does not submit the form?
- A.
<button type="button">
- B.
<input type="button">
- C.
<button type="submit">
- D.
<input type="submit">
Answer: A. <button type="button">
These additional MCQs should further help in assessing
students’ understanding of HTML forms and their advanced features.
4o mini
You said:
more
ChatGPT said:
ChatGPT
Here are more MCQs on the topic of forms in HTML:
MCQs
91. Which HTML element is used to group multiple
checkboxes together to allow users to select multiple options?
- A.
<checkbox>
- B.
<group>
- C.
<fieldset>
- D.
<options>
Answer: C. <fieldset>
92. What is the purpose of the name attribute in an <input>
element?
- A.
It defines the display name of the input field.
- B.
It assigns a name to the input field to identify its value when the form
is submitted.
- C.
It sets the default value for the input field.
- D.
It specifies the form to which the input belongs.
Answer: B. It assigns a name to the input field to
identify its value when the form is submitted.
93. How do you ensure that a user cannot submit a form
without filling out a required field?
- A.
Use the required attribute in the input field.
- B.
Use the mandatory attribute in the input field.
- C.
Add a <required> element inside the form.
- D.
Use the validate attribute in the form tag.
Answer: A. Use the required attribute in the input
field.
94. What does the method="post" attribute in
the <form> tag do?
- A.
Submits the form data as URL parameters.
- B.
Submits the form data in the body of the HTTP request.
- C.
Displays the form data in the browser’s address bar.
- D.
Encrypts the form data before submission.
Answer: B. Submits the form data in the body of the
HTTP request.
95. What attribute would you use to specify the width of
a text input field?
- A.
width
- B.
size
- C.
length
- D.
widthsize
Answer: B. size
96. How can you add a placeholder text to an input field?
- A.
Use the placeholder attribute.
- B.
Use the text attribute.
- C.
Use the label attribute.
- D.
Use the hint attribute.
Answer: A. Use the placeholder attribute.
97. How can you create a form that includes a text area
for longer text input?
- A.
<textarea>
- B.
<input type="textarea">
- C.
<field>
- D.
<text>
Answer: A. <textarea>
98. What is the effect of the target="_self"
attribute in the <form> tag?
- A.
Opens the form submission in a new tab or window.
- B.
Submits the form data to the same frame or tab.
- C.
Prevents the form from being submitted.
- D.
Specifies an external URL for form data submission.
Answer: B. Submits the form data to the same frame or
tab.
99. Which of the following attributes can be used to
specify that a form field should accept a number only?
- A.
type="number"
- B.
type="text"
- C.
type="digit"
- D.
type="integer"
Answer: A. type="number"
100. How can you add a file input field to a form?
- A.
<input type="file">
- B.
<input type="upload">
- C.
<fileinput>
- D.
<input type="document">
Answer: A. <input type="file">
101. What is the purpose of the action attribute in a
form tag?
- A.
It determines how the form will be submitted (e.g., GET or POST).
- B.
It specifies the URL where the form data will be sent.
- C.
It provides a default value for the form fields.
- D.
It sets the appearance of the form elements.
Answer: B. It specifies the URL where the form data
will be sent.
102. Which HTML element is used to create a button that
resets all the fields in a form to their default values?
- A.
<input type="reset">
- B.
<button type="reset">
- C.
<input type="clear">
- D.
<button type="clear">
Answer: A. <input type="reset">
103. How do you create a radio button group where only
one option can be selected at a time?
- A.
Use the same name attribute for all radio buttons in the group.
- B.
Use different name attributes for each radio button.
- C.
Use the multiple attribute.
- D.
Use the group attribute.
Answer: A. Use the same name attribute for all radio
buttons in the group.
104. What attribute is used to define the maximum number
of characters allowed in a text input field?
- A.
max
- B.
maxlength
- C.
limit
- D.
length
Answer: B. maxlength
105. Which HTML element should you use to add a checkbox
to a form?
- A.
<input type="checkbox">
- B.
<input type="check">
- C.
<checkbox>
- D.
<input type="select">
Answer: A. <input type="checkbox">
These questions should further deepen the understanding of
HTML forms and their various elements.
4o mini
You said:
write lecture notes in detail for beginner students on Class
12: Forms in HTML - Part 3 Objective: Understand form structure, layout, and
submission basics. Outcome: Students will be able to group form elements
effectively and use basic validation attributes to ensure proper form
submission.
ChatGPT said: