0% found this document useful (0 votes)
8 views3 pages

Lecture 4

Uploaded by

umarmalikk64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Lecture 4

Uploaded by

umarmalikk64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Multiple-Choice Questions (MCQs)

1. What tag is used to create a form in HTML?


o A) <input>
o B) <form>
o C) <fieldset>
o D) <textarea>
o Answer: B) <form>
2. Which attribute specifies where to send the form data?
o A) method
o B) action
o C) name
o D) value
o Answer: B) action
3. What method sends form data as URL parameters?
o A) POST
o B) GET
o C) PUT
o D) DELETE
o Answer: B) GET
4. Which input type masks the user's input?
o A) text
o B) password
o C) email
o D) hidden
o Answer: B) password
5. What does the required attribute do in HTML5 forms?
o A) Makes a field optional
o B) Ensures the field must be filled
o C) Hides the field
o D) Resets the field
o Answer: B) Ensures the field must be filled
6. Which input type allows users to select a color?
o A) color
o B) text
o C) date
o D) number
o Answer: A) color
7. Which attribute is used to display a hint in an input field?
o A) placeholder
o B) title
o C) label
o D) hint
o Answer: A) placeholder
8. What input type will display a calendar for date selection?
o A) date
o B) text
o C) datetime
o D) time
o Answer: A) date
9. Which element allows you to create a dropdown list?
o A) <input>
o B) <select>
o C) <option>
o D) <datalist>
o Answer: B) <select>
10. What is the purpose of the disabled attribute?
o A) To make a field editable
o B) To prevent form submission
o C) To make a field unresponsive
o D) To display a message
o Answer: C) To make a field unresponsive

Short Questions and Answers

1. What is an HTML form?


o An HTML form is a structured section of a web page that allows users to enter
and submit data to a server for processing.
2. How do you create a text input field in HTML?
o You create a text input field using the <input> tag with the type attribute set to
"text": <input type="text" name="name">.
3. What is the purpose of the action attribute in a form?
o The action attribute specifies the URL of the server-side script that will handle
the form's submitted data.
4. What does the pattern attribute do?
o The pattern attribute allows you to define a regular expression that user input
must match before submission, ensuring data validation.
5. What is the difference between a checkbox and a radio button?
o A checkbox allows users to select multiple options, while a radio button restricts
the selection to one option within a group.
6. How do you create a dropdown list in a form?
o You create a dropdown list using the <select> tag, with options defined by
<option> tags nested inside it.
7. What is the function of the readonly attribute?
o The readonly attribute makes an input field non-editable while allowing the user
to see its content.
8. How does the autocomplete attribute improve user experience?
o The autocomplete attribute enables the browser to suggest previously entered
values, making data entry quicker and more efficient.
9. What is a hidden field in a form?
o A hidden field is an input that is not visible to the user but stores data that can be
submitted with the form.
10. How do you create a file upload field in HTML?
o You create a file upload field using the <input> tag with the type attribute set to
"file": <input type="file" name="fileUpload">.

You might also like