NCERT Solutions for Class 10th: Ch 4 Forms Computer Science
ExcerciseA. Multiple choice questions
1. A _____ can be inserted in HTML document which can act as a container for all the input elements.
(a) Text field
(b) Teaxt area
(c) Form
(d) Command Button
► (c) Form
2.________ method is used to sent form data as URL variables.
(a) get
(b) set
(c) post
(d) none of them
► (a) get
3. ________ method is used to sent form data as HTTP post.
(a) get
(b) set
(c) post
(d) none of them
► (c) post
4. What is the purpose of a web form?
(a) An outdated feature still used to help the page load faster
(b) An useful way to send information from the user directly to the search engines
(c) A way to input data into a website or an application
(d) To enable the user to navigate the website with ease
► (c) A way to input data into a website or an application
5. Which element allows for the creation of groups of options in a select menu?
(a) <select>
(b) <group>
(c) <option>
(d) <optgroup>
► (c) <option>
6. Which of the option will be selected with the following code snippet?
<select>
<option selected value=”Fiat”>Fiat</option>
<option value=”selected”>Saab</option>
<option value=”opel”>selected</option>
<option value=”audi”>Audi</option>
</select>
(a) Fiat
(b) Saab
(c) Selected
(d) Audi
► (a) Fiat
B. Answer the following questions:
1. Why forms are used in web pages?
Answer
HTML forms are used to pass data to a server. A form can be inserted in HTML documents using the HTML form element which acts as a container for all the input elements. All the information collected by a form can be submitted to a processing agent (a file containing a script made to process this information) that’s usually specified in the “action” attribute of the Form tag.
2. Explain all the attributes of Form tag.
Answer
1. Method: The method attribute specifies how to send form-data (the form-data is sent to the page
specified in the action attribute). The form-data can be sent as URL variables (with
method=”get”) or as HTTP post transaction (with method=”post”).
2. Action: The Action attribute subit collected information to a processing agent (a file containing a script made to process this information).
3. Differentiate between Get & Post methods of Form tag.
Answer
1. Get: It appends form-data into the URL in name/value pairs. The length of a URL is limited to about 3000 characters. Useful for form submissions where a user want to bookmark the result. It is better for non-secure data, like query strings in Google
2. Post: It appends form-data inside the body of the HTTP request (data is not shown is in
URL). It has no size limitations. Form submissions with POST cannot be bookmarked.
4. How text field and text area controls are different from each other?
Answer
Text Field accepts value in one line while Text area displays several text lines at a time and used for to prepare the body of the email or use it to take comment from the user.
5. Explain the use of Radio buttons in HTML forms with the help of an suitable example.
Answer
Radio buttons allow user to select one of the two from Lighting type i.e. either TubeLight or Bulb. Similarly, the user can select any one of the three from Lighting Size i.e. Long, Medium and Short. This is achieved by naming all options of a set the same. Here all light type has the name Ltype while all light size is name LSize. This is where the id attribute comes handy, especially if the value has to be used later on.
6. Mention all the attributes of Check box. Justify how it is different from Radio button.
Answer
Attributes of Checkboxes:
1. Name: It adds an internal name to the field so the program that handles the form can identify the fields.
2. Value: It defines what will be submitted if checked.
3. Align: It defines how the text field will be aligned on the form. Valid entries are: TOP, MIDDLE, BOTTOM, RIGHT, LEFT, TEXTTOP, BASELINE, ABSMIDDLE, ABSBOTTOM.
4. Tabindex: It defines in which order the different fields should be activated when the visitor clicks the tab key.
7. State the purpose of Submit and Reset button.
Answer
Submit buttons: When activated, a submit button submits a form. A form may contain more than one submit button.
Reset buttons: When activated, a reset button resets all controls to their initial values.
8. Which attributes are necessary to insert drop down list in a HTML page?
Answer
The attributes which are necessary to insert drop down list in a HTML page are:
1. Name: It adds an internal name to the field so the program that handles the form can identify the fields.
2. Size: It defines the number of items to be visible when user clicks on the drop down box.
3. Multiple: It allows for multiple selections.
4. Value: It defines what will be submitted to the computer when an item is selected.
9. Sometimes it is better to use the text area element instead of an input element of type text. Write a short note to explain when and why?
Answer
It is better to use the text area element instead of an input element of type text because textarea shows the content written wheras text field show only a part. Text Area shows several text lines which can easily show your whole content. You also have full control over textarea using wrap attribute while in text field it have single line. When you type more words then other words hide.
Go To Chapters