0% found this document useful (0 votes)
12 views8 pages

Chapter 5-1

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

Chapter 5-1

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

Chapter 5

Forms and Frames

Short Answer Type Questions


Question 1

Name the attributes which are used with the <INPUT> tag.
Answer

The attributes which are used with the <INPUT> tag are:

1. Type
2. Name
3. Value
4. Size
5. Maxlength

Question 2

Which tag helps in creating a drop-down list on a form area?

Answer

The <SELECT> tag along with the <OPTION> tag is used to create a drop-down list on a
form area.

Question 3

Which attribute of <INPUT> tag specifies what type of form control will be added to the
form area?
Answer

The 'type' attribute of <INPUT> tag determines the type of form control that will be added
to the form area

Question 4

Which tag adds a multi-line text box on the form area?

Answer

The <TEXTAREA> tag adds a multi-line text box on the form area.
Question 5

A form is divided into how many sections?

Answer

A form can be divided into three sections:

1. Form Header
2. Input Fields
3. Action Buttons

Question 6

What is the purpose of a password field?

Answer

The purpose of a password field is to securely input and hide confidential information like
passwords or PINs by displaying dots or asterisks instead of the actual data.

Question 7

What is the purpose of a scroll bar added with a combo box?

Answer

A scroll bar added to a combo box indicates that there are more elements in the list and
helps to navigate through this longer list of options.

Question 8

How can you select multiple options from the items displayed in a list?

Answer

We can select multiple options from the items displayed in a list by using the entity
"multiple". The Ctrl or Shift keys are used to select more than one element from the list.

Long Answer Type Questions

Question 1

What do you understand by the Method attribute? Differentiate between the Get method
and the Post method.

Answer

The Method attribute specifies that the form information should be posted to the URL given
in the action attribute. Possible values are GET and POST.
Differences between the Get method and the Post method are:

S.
Get Method Post Method
No.

Form data is sent as part of request


1. Form data is sent as part of URL.
body.

Less data can be sent compared to More data can be sent compared to
2.
Post method. Get method.

3. Less secure. More secure.

4. Can be bookmarked. Cannot be bookmarked.

Question 2

Explain any two input elements.

Answer

Two input elements are as follows:

1. Text Box — A text box allows a user to enter alphanumeric data that is a
combination of characters and numbers. It creates a single line text box. We can add
a text box to the form in the following way:
Syntax: <INPUT Type= "Text">
2. Checkbox — A checkbox is like a toggle switch which helps the user to select or
deselect one or more items. We have to type the label next to the checkbox.
Syntax: <INPUT Type = "Checkbox" Name = "Hobbies" Value = "Reading">

The below example shows the usage of textbox and checkbox in a form:

<HTML>
<BODY>
<FORM>
<P>
NAME :
<INPUT TYPE = "TEXT">
</P>
<P>
CHOOSE YOUR QUALIFICATION : <BR>
<INPUT TYPE = "CHECKBOX" NAME = "C1" VALUE = "GRADUATE">
GRADUATE <BR>
<INPUT TYPE = "CHECKBOX" NAME = "C2" VALUE = "POSTGRADUATE" >
POST GRADUATE
</P>
</FORM>
</BODY>
</HTML>

Question 3

Differentiate between:

1. Radio Button and Checkbox


2. Submit Button and Reset Button

Answer

1. Differences between Radio Button and Checkbox:

S.
Radio Button Checkbox
No.

Radio buttons are used when we want Checkboxes are used when we
1. users to select only one option from a want users to select multiple
set of choices. options from a list.

Radio buttons are typically represented Checkboxes are typically


2. as small circles or dots, and users can represented as small square boxes
select only one of them at a time. with a check mark inside them.

Selecting one option automatically


Users can check or uncheck
3. deselects any previously selected option
checkboxes independently.
within the same group.

2. Differences between Submit Button and Reset Button:

S.
Submit Button Reset Button
No.

A reset button is used to clear or reset the


Submit button is used to send the
contents of a form, reverting all form
1. data entered in the form to the
fields back to their default or initial
server for processing.
values.

It is defined as follows: It is defined as follows:


2. <INPUT Type = "Submit" Value <INPUT Type = "Reset" Value =
= "SEND"> "RESET">
Question 4

Write a short note on the application areas of forms.

Answer

Forms have diverse application areas which include the following:

1. Educational sites — They are used for collecting names, addresses, telephone
numbers, e-mail addresses, and other information of students which is required by
the websites to register them for an online course.
2. Online shopping — They are used for gathering information for the purchase of an
item. For example, if we want to purchase a book or any other item over the
Internet, we would be required to fill in our name, mailing address, mode of
payment that we wish to opt for, and so on.
3. Online Feedback Forms — They are used for collecting feedback about a website.
Most websites that offer a service encourage the users to send their feedback. Apart
from building customer relations, it is a source of information for modifications or
improvements.
4. Providing Interface for a Chat Session — Users are required to fill out a form if
they want to participate in a chat session or a discussion group.

Question 5

Define the following attributes associated with the <INPUT> tag:


i. Type

ii. Value

iii. Size

Answer

i. Type — This attribute specifies what kind of form control will be added to the form. The
default type for an input element is "Text". Type attribute can take different values like
"Text", "Checkbox", "Radio" or "Password".

ii. Value — It specifies the initial value for the element.

iii. Size — It specifies the width of the input field.

Question 6

Describe the Cols attribute and Rows attribute of the <TEXTAREA> tag.
Answer

Rows attribute of the <TEXTAREA> tag defines the height of the textarea and Cols
attribute of the <TEXTAREA> tag defines the width of the text area.
Consider the following example,
<HTML>
<HEAD>
<TITLE>Using text area</TITLE>
</HEAD>
<BODY>
<FORM>
Remarks : <TEXTAREA ROWS = "6" COLS = "50" NAME = "REMARKS">
Enter your remarks here. </TEXTAREA>
</FORM>
</BODY>
</HTML>
Application Based Questions

Question 1

Shagun wants to customize the width and height of the textarea in her form. How can she
do it?

Answer

Shagun can use the Rows and Cols attribute of the <TEXTAREA> tag to customize the
width and height of the textarea in her form. Rows attribute defines the height of the
textarea, and Cols attribute defines the width of the text area. Example code for
customizing the width and height of the textarea is:
<TEXTAREA ROWS = "6" COLS = "50" NAME = "REMARKS">
Enter your remarks here.
</TEXTAREA>

Question 2

Write the HTML code to create the following form elements:

Answer

HTML code to create the form elements is given below:


<HTML>
<HEAD>
<TITLE>Pizza Selection</TITLE>
</HEAD>
<BODY>
<FORM>
Pizza Size : <BR>
<INPUT TYPE = "RADIO" ID = "R1" NAME = "SIZE" VALUE = "SMALL" />
<LABEL FOR = "R1"> Small </LABEL>
<BR>
<INPUT TYPE = "RADIO" ID = "R2" NAME = "SIZE" VALUE = "MEDIUM"
CHECKED/>
<LABEL FOR = "R2"> Medium </LABEL>
<BR>
<INPUT TYPE = "RADIO" ID = "R3" NAME = "SIZE" VALUE = "LARGE" />
<LABEL FOR = "R3"> Large </LABEL>
<BR>
<INPUT TYPE = "SUBMIT" NAME = "Process Order" VALUE = "Click to order Pizza"
/>
<INPUT TYPE = "RESET" NAME = "Clear" VALUE = "Click to Clear" />
</FORM>
</BODY>
</HTML>

Question 3

In the examination, Suparna has been asked to write the code for placing a drop-down list
in the form area. She is also asked to indicate any one of the menu items as preselected.
Help her in solving the problem.

Answer

Suparna can use the selected attribute with the <OPTION> tag to indicate that one of the
menu items is preselected.
Consider the following example in which the user has to select his destination. Here, the
option "Chandigarh" is pre-selected.

<HTML>
<HEAD>
<TITLE>Drop-down Example</TITLE>
</HEAD>
<BODY>
<FORM>
<P> Select your destination: </P>
<SELECT Name = "Cities">
<OPTION Selected> Chandigarh</OPTION>
<OPTION> Kolkata </OPTION>
<OPTION> Bhopal </OPTION>
<OPTION> Lucknow </OPTION>
<OPTION> Patna </OPTION>
<OPTION> Shimla </OPTION>
<OPTION> Delhi </OPTION>
<OPTION> Mumbai </OPTION>
<OPTION> Chennai </OPTION>
</SELECT>
</FORM>
</BODY>
</HTML>

You might also like