class 10 chapter 4 HTML FORMS (2)
class 10 chapter 4 HTML FORMS (2)
ny
2. Which attribute defines the file-select field?
a) file
b) checkbox
pa
c) button
d) text
om
Ans: a) file
3. Which of the following is not used with password attribute?
a) name
C
b) size
c) maxlength
d) min
&
Ans: d) min
d
b) textarea
ha
c) submit
d) radio button
Ans: b) textarea
C
b) value
c) checked
d) selected
Ans: d) selected
6. Which attribute is used with <select> element?
a) multiple
b) selected
c) name
d) value
Ans: a) multiple
THEORETICAL QUESTIONS
1. Mention the purpose of using Web Forms.
Ans: A web form is a medium that allows your visitors to get in contact with you and to send
information, such as an order, a catalogue request, or even a query, which is passed on to your
database.
3. Differentiate between
1. Get & Post methods of Form tag
2. Text Field and Text Area Controls
3. Radio buttons and Check box
ny
Ans:
1. The GET and POST method are used for sending the data to the server, and the main
pa
difference between them is that GET method append the data to the URI defined in the
form’s action attribute. Conversely, POST method attaches data to the requested body.
2. The major difference between a text area and a text field is that a text field only has one line
om
whereas a text area is usually has multiple lines.
3. Checkboxes allow the user to choose items from a fixed number of alternatives, while radio
buttons allow the user to choose exactly one item from a list of several predefined
C
alternatives.
Ans:
1. Text = type, name, value, size, maxlength
d
6. How can you select 3rd option by default in a list used in HTML Forms?
Ans: The default value of the select element can be set by using the 'selected' attribute on the
required option. This is a Boolean attribute. The option that is having the 'selected' attribute will be
displayed by default on the dropdown list.
ny
Output
pa
om
C
&
2. Write code to create the following HTML Form to accept User’s Information as part of a
d
Magazine Survey:
n
ha
C
S.
ny
Ans: An HTML form is a section of a document which contains controls such as text fields, password
fields, checkboxes, radio buttons, submit button, menus, etc.
An HTML form facilitates the user to enter data that is to be sent to the server for processing, such
pa
as name, e-mail address, password, phone number, etc.
om
4. Write a program to declare 2 radio buttons (Male, Female) and one check box (hobbies) in the
HTML form.
Ans: <form>
<label for="gender">Gender: </label>
C
Ans:
<body>
<form>
Please input your name<br>
<input type="text" name="username">
<input type="submit" value="submit">
</form>
</body>