Exercise & Question Answers Class X

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Exercise & Question Answers

Chapter 5
Class X
D. Short answer questions:
a) What tag would be best for starting a web from where user can input information?

Ans. A <form> tag is used to create HTML form. The input tag is enclosed in the form tag and helps to
create the various form controls depending on its type attribute. For example:

<input type= “text”> Defines a single line text input field

<input type= “radio”> Defines a radio button

Syntax:

<form action= “Script URL” method = “GET/POST”>

Form controls like input, textarea etc.

<form>

b) Write the steps for making a drop down list in HTML form.

Ans. The <select> element is a form control and can be used in a form to collect users input. We can use
the <select element to create a drop-down list or combo box in the form. The <option> tag is used inside
the <select> element to define the options available in the list.

Example:

<html>
<body>
<form>
Name:<input type= “text” name=“name” value=””><br><br>
Class:
<select name=“class” >
<option value=“nine”>9</option>
<option value=“tenth”>10</option>
<option value=“eleventh”>11</option>
<option value=“twelve”>12</option>
</select>
</form>
</body>
</html>
c) What is the use of CSS float property?

Ans. The float property is used for positioning and formatting content i.e. it can be used to wrap text
around image. The float property can have one of the following values.

Left- the element float to the left of its container.

Right- the element float to the right of its container.

None- this is the default value. The element does not float and will be displayed as it is placed.

Inherit- the element inherit the float value of its parent.

d) Explain the creation of button, checkbox and radio-button in HTML forms.

Ans. Button, checkbox and radio button can be created using input tag and changing the value of type
attribute.

Creating submit and reset button:

<input type=”submit” name =”submit” value=”Submit”>

<input type=”Reset” name =”Reset” value=”Reset”>

Creating checkbox:

<input type=”checkbox” name =”maths” value=”maths”>

<input type=”checkbox” name =”science” value=”science”>

Creating radio-button:

<input type=”radio” name =”gender” value=”male”>

<input type=”radio” name =”gender” value=”female”>

e) In how many ways can you add CSS to an HTML file? Explain briefly.

Ans. CSS can be added to HTML elements in 3 ways:

• External Stylesheet- defines style sheet rules in a separate .css file and then include that file in
HTML document using HTML <link> tag.
• Internal Style Sheet- Define style sheet rules in header section of the HTML document using
<style> tag.

• Inline Style Sheet- Define style sheet rules directly along with the HTML elements using style
attribute.

f) What is the use of CSS margin property?

Ans. The CSS margin property is used to create space around elements i.e. between the text and any
border which is defined. There are properties for setting the margin for each side of an element as-

 Margin-top
 Margin-right
 Margin- bottom
 Margin-left
g) How is the CSS font family useful?

Ans. The CSS font family property defines the font to be used. The font-family property is used to define
several font names which can be used in the webpage. If the browser does not support the first font
then it tries the next font.

The font family names are of two types:

Family-name:- these are names of a font-family, like “times”, “courier”, “arial” etc.

Generic-family:- Genericfamily names are, like “serif”, “sans-serif”, “monospace” etc.

h) What property will you use to change the color of the text of the webpage?

Ans. Color property is used to set the text color of the webpage.

Syntax: <p style=color:red>this is a paragraph</p>

i) What are the advantages of the CSS?

Ans. Advantages of CSS

i. Superior Style: CSS has a much wider range of attributes than HTML, which helps us to give a
better look to our HTML page.
ii. Simple to use: It is easy to learn and understand.
iii. Save time: CSS saves time as we can define a style sheet once and reuse the same for many
different webpages.
iv. Pages loads faster: If we are using CSS, we do not need to write HTML, tag attributes every time.
So, as we have less code, the pages will load much faster.
v. Easy to maintain: we can make changes in the style sheet and this will be updated in all the web
pages automatically. So it easy to update the webpages.
vi. Global web standards: as more and more HTML attributes are being deprecated, it is better to
use CSS keeping the future compatibility in mind.
vii. Multiple Device Compatibility: Using style sheet the content of the same HTML page can be
optimized for different devices like Tablets, PDAs etc.
j) Why are forms used in web page?
Ans. A form is used to collect input from the user. We must have filled up many different types of forms.
For example, a form to take a mobile connection or a form to give feedback in a restaurant. A n HTML
form contains form elements. Form controls or elements are different types of input elements, like text
fields, checkboxs, radio buttons, submit button etc.

k) What is the difference between inline and internal style sheet?

Ans. Internal Style Sheet-

 Define style sheet rules in header section of the HTML document using <style> tag.
 Used to apply style sheet property on all or specifies elements.

Inline Style Sheet-

 Define style sheet rules directly along with the HTML elements using style attribute.
 Used to apply style sheet property on a specific element only.

You might also like