0% found this document useful (0 votes)
71 views190 pages

Mar 2023 - 6th 7th 8th 9th 10th Standard Print

The document discusses how to use Microsoft Word's mail merge feature to create form letters, mailing labels, and envelopes by linking a main document to a data source. It explains the six steps to complete a mail merge, including choosing the document type, selecting recipients from an existing list, writing the main document and inserting merge fields, previewing and completing the merge.

Uploaded by

Bsamsungb99 S
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)
71 views190 pages

Mar 2023 - 6th 7th 8th 9th 10th Standard Print

The document discusses how to use Microsoft Word's mail merge feature to create form letters, mailing labels, and envelopes by linking a main document to a data source. It explains the six steps to complete a mail merge, including choosing the document type, selecting recipients from an existing list, writing the main document and inserting merge fields, previewing and completing the merge.

Uploaded by

Bsamsungb99 S
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/ 190

Chapter 2

Word Processing (MS Word)

Inside this chapter : Header and footer, Formatting of paragraph, Mail merge, Envelop and labels, Page
column, Hyperlink, Drop cap.

Microsoft word or MS-Word (often called word) is a graphical word processing program
by Microsoft Corporation. The purpose of the MS Word is to allow the users to type and save
documents. Similar to other word processors, it has various helpful tools to make documents.

How to start MS Word


Click on start menu and find Microsoft Office ->Microsoft Word 2010

18
You will see the application window of MS Word as below

After starting MS Word, you will see the menu bar items as below

Working with Headers and Footers


Headers and footers can help keep longer documents organized and make them easier
to read. Text entered in the header or footer will appear on each page of the document. Let us
see a demonstration.

1. Click on Insert menu

19
2. Find Header and Footer

3. Click on Header and select Blank (Three Columns) option

The Design tab will appear on the Ribbon, and the header or footer will appear in the
document.
Here you can place Date & Time, Page number, Picture Clip Art and other desired
information.
When you have finished editing, click Close Header and Footer in the
Design tab, or hit the Esc key.
After you close the header or footer, it will still be visible, but it will be locked. To edit it again,
just double-click anywhere on the header or footer margin and it will become unlocked for
editing.

To insert the date or time into a header or footer:


1. Double-click anywhere on the header or footer to unlock it. The Design tab will
appear.
2. From the Design tab, click the Date & Time command.
3. Select a date format in the dialog box that appears.
4. Place a check mark in the Update Automatically box
if you would like it to always reflect the current date.
Otherwise, it will not change when the document is
opened at a later date.
5. Click OK. The date and time will appears in the
document.

20
Paragraph
MS Word includes many features designed to assist you in placing text on the page just
the way you want it. You can align text left to right using tabs or alignment options, or you can
adjust your text vertically using line spacing options. Following are some of the available
paragraph formatting choices.
Aligning Text:
Alignment arranges the text to line up at one or both margins, or in center between the
margins. Alignment applies to entire paragraphs. You can align text to the left, right, or center,
or you can justify your text, which means that the text becomes evenly spaced across the page
from the left margin to the right margin. Apply alignment options by selecting the text you
want to align, then choosing Home > Paragraph and clicking one of the following alignment
buttons:

• Align Text Left: The text aligns evenly at the left margin. This is the default choice.
• Center: The text centers evenly between the left and right margins.
• Align Text Right: The text aligns along the right document margin.
• Justify: The text fills with micro spaces so it aligns evenly on both the left and right
margins.
Following picture illustrates a document with text matching each alignment option.

21
Adding Paragraph Borders
Word includes borders that you can apply to any size block of text, which draw the
reader’s eye to specific areas for a “quick read.”
A border can cover the entire area or be any combination of lines around the text, such
as above and/or below the text. Select the text you want bordered and choose Home >
Paragraph.
Click the drop-down arrow next to the Borders button, which displays a list of options
like the one you see in following picture. Choose the border option you want.

Shading Text
Shading helps you distinguish headlines and important passages, such as sidebars, by
creating a screen, which is typically light gray shading against the standard black text.
Click anywhere in the paragraph you want shaded and choose Home > Paragraph >
Shading. Choose a color from the resulting Shading gallery, as shown in following picture.
Adding dark blue shading caused Word to change the font color to white.

22
If you want to add a shading pattern ranging from a light 5%
shade to patterns, such as diagonal stripes or polka dots, you can
choose Home > Paragraph, and then click the Borders drop-down
arrow. From the list, select Borders and Shading, which then displays
the Borders and
Shading dialog box.

Click the Shading


tab then click the Fill drop-down arrow to select a fill color. Choices
are available in themes or standard colors. You can then click the
Style drop-down list to select a pattern.

23
Indenting Text
Typically, text runs between the left and right margins, but you may want to indent
particular paragraphs. Click anywhere in the paragraph you want to indent, and then choose
Home > Paragraph > Increase Indent. Each click of the Increase Indent button indents the text
one-half inch from the left margin. Click the Decrease Indent button to move the text back one-
half inch.
If you want to indent from the right margin or you want to manually set how much
indentation Word applies, you can use the Format Paragraph dialog box. Click the Paragraph
Dialog Box Launcher, which displays the Paragraph dialog box shown in following picture.

Click the spinner arrows for the Left or the Right text boxes to specify the number of
inches to indent the left and right edge of the paragraph. The Preview box at the bottom
shows the effects of your settings. Optionally, click the Special dropdown list and select an
indenting option:
• First line: This option indents only the first line of the paragraph and leaves the rest of
the paragraph even with the left margin.
• Hanging: This option indents all lines except the first line of the paragraph.
Click OK after you finish making selections. Word applies the paragraph indentation settings
you selected.
Another way to control indention is by dragging the indentation icons on the ruler:
If you don’t see the ruler, choose View > Show > Ruler.
Left Indent Hanging Indent First Line Indent Right Indent

24
Mail Merge
Mail merge is a very important tool which allows you to create form letters, mailing
labels, and envelopes by linking a main document to a set of data or data source. The main
document is linked to the data source by common fields of data, called merge fields.
For example, in a form letter, your main document would be the letter informing the
parents to be called for a parent teacher meeting. The data source is where the fields of
information on each parent receiving the letter are located. The data source would contain
names, addresses, phone number etc.
If you were printing envelopes or address labels, the main document would be the
envelopes or the sheet with labels on it; the data source would be the addresses that are to be
placed on these envelopes or labels of sheets.
When you are performing a Mail Merge, you will need a Word document (you can start
with an existing one or create a new one) and a recipient list, which is typically an Excel
workbook.
Exploring Mail Merge practically:
1. Open an existing Word document, or create a new
one.
2. Click the Mailings tab.
3. Click the Start Mail Merge command.
4. Select Step by Step Mail Merge Wizard.
The Mail Merge task pane appears and will guide you through the six main steps to
complete a merge. The following is an example of how to create a form letter and merge the
letter with a recipient list.
Step 1:
1. Choose the type of document you want to create. In this
example, select Letters.
2. Click Next: Starting document to move to Step 2.
Step 2:
1. Select Use the current document.
2. Click Next: Select recipients to move to Step 3.

25
Step 3:
Now you'll need an address list so Word can automatically place each address into the
document. The list can be in an existing file, such as an Excel workbook, or you can type a new
address list from within the Mail Merge
Wizard.
1. From the Mail Merge task pane,
select Use an existing list, and then
click Browse.
2. Locate your file in the dialog box
(you may have to navigate to a
different folder), then click Open.
3. If the address list is in an Excel

workbook, select the worksheet that


contains the list, and then click OK.

4. In the Mail Merge Recipients dialog


box, you can check or uncheck each
recipient to control which ones are used in the merge. When you're done, click OK to
close the dialog box.

5. From the Mail Merge task pane, click Next: Write your letter to move to Step 4.
Step 4:
Now you are ready to write your letter. When it's printed, each copy of the letter will basically
be the same, except the recipient data like the name and address will be different on each one.

26
You'll need to add placeholders for the recipient data so Mail Merge knows exactly where to
add the data. If you're using Mail Merge with an existing letter, make sure the file is open.

To insert recipient data:


1. Place the insertion point in the document where you want
the information to appear.
2. Select Address block, Greeting line, Electronic postage, or
More items from the task pane.

3. Depending on your selection, a dialog box may appear with


various options. Select the desired options, then click OK.

4. A placeholder appears in your document (for example: «AddressBlock»).


5. Repeat these steps each time you need to enter information from your data record.
6. From the Mail Merge task pane, click Next: Preview your letters to move to Step 5.
For some letters, you'll only need to add an Address block and Greeting line. Sometimes,
however, you may want to place recipient data within the body of the letter to further
personalize it.
Step 5:
1. Preview the letters to make sure information from the recipient list appears correctly in
the letter. You can use the left and right scroll arrows to view each document.

27
2. Click Next: Complete the merge to move to Step 6.

Step 6:
1. Click Print to print the letters.
2. The Merge to Printer dialog box opens. Click All, then click OK.

3. The Print dialog box will appear. Adjust the print settings if
needed, then click OK.

28
Envelops and Labels

There are times when you may need to print several envelopes that have the same
delivery address, or you may need to keep an envelope on file for future use. The developers
at Word provided the capability to add an envelope to your current document, but not to
create a new document that contains just an envelope.
Let’s see how to create and use envelopes and labels
1. Open an existing document that contains
the address you want to use on your
envelope.
2. Highlight the address and copy it to the
Clipboard by pressing Ctrl+C.
3. Create a new document.
4. Display the Mailings tab of the ribbon.
5. Click Envelopes in the Create group.
Word displays the Envelopes and Labels
dialog box.
6. Make sure the Envelopes tab is selected.
7. Place the insertion point in the Delivery Address area.
8. Press Ctrl+V to paste the address you copied in step 2.
9. Using the Options button you can change the orientation and formatting.
10. Click on the Add to Document button. Your envelope is ready

Your envelope is ready and it can be saved & printed.

29
Labels
As I mentioned in the Envelopes section, the envelopes and labels feature can be found
in the same place: the Mailings tab.

This time, we are going to click Labels:


There are two types of labels you can print: pages of labels containing the same address, or
pages of labels where each label contains a different address.
Labels with the same address (return address labels)
1. Open Word and click Mailings on the menu line. Then click Labels on the ribbon.
2. In the "Print" section of the Labels window (not the Print button at the bottom), choose
"full page of the same labels."
3. Click the Options button at the bottom of the window. Select the product number from
the list, and click OK.
4. Still on the Labels window, type the address in the address box. To change font
properties, highlight the address, right-click, and click Font. Make your changes, and
click OK.
5. Still on the Labels window, click the New Document button at the bottom. A Word
document will appear containing the labels.

30
Your labels with same address are ready and it can be saved & printed.

Labels with different addresses (Mailing labels)


First we will create the list of different addresses so open a new blank document and click
mailings on the menu line .

1. Enter few addresses for address list.------


2. Press Ok and Save the list to Desktop.
3. Start Mail Merge from the ribbon, and
click Labels.

4. Click Select Recipients and choose "Use


Existing List…” and select the address file
which you have prepared in step 4, click
Open button.

31
Now, Type “To” in the Label and click on Mailing tab -> Insert Merge Fields->Title.
Repeat this step to insert other Fields, like
First_Name, Last_Name. Now copy these
Inserted fields to other label (after <<Next
Record>>)
Finally, your window should be as below

5. Now, Click on Preview Results button

Your labels with different addresses are ready, save this document.

32
Page Column

Columns are used in many types of documents, but they are most commonly used in
newspapers, magazines, academic journals, and newsletters. Columns are also used in your
NCRT Textbooks. In this lesson, you will learn how to insert columns into a document and
create column breaks.

Inserting Columns
Columns and column breaks can improve your document's organization and increase its
readability. They also allow you to utilize all of the available space on the page.
How to add columns?
1. Select the text you want to format.
2. Click the Page Layout menu tab.
3. Click the Columns command. A drop-down menu will appear (as shown below).

4. Select the number of columns


you want to insert. The text will then format into columns.

33
If you want to remove the columns, click the Columns command and
select One for the number of columns.

Hyperlink
A hyperlink is a word, phrase, or image that you can click on to
jump to a new document or a new section within the current
document. Hyperlinks are found in nearly all Web pages, allowing
users to click their way from page to page. Hypertext is text with
hyperlinks.
There are two ways that you can insert a hyperlink in Word 2010.
Using the first method, you type out the text for the link then select it and click the
Insert tab, then click the Hyperlink command in the Links group.
In the Insert Hyperlink window that opens, you can type in the website URL
into the address box if the link is to a website. (as shown below)

after pressing OK button you will see the text appers blue and underlined. Your
hyperlink is ready. Click on the link see the result.-----------
However, you could also link to the following:
• An existing file on your computer
• A location in the current document
• A new document
• An email address
Each of the above options can be used by clicking on its
corresponding button on the left of the Insert Hyperlink
window.

34
Drop Cap
A drop cap is a large capital letter at the beginning of a text block that has the depth of
two or more lines of regular text.

Let’s see how you can do it. Open a document Word document and select the letter
you want to insert as drop cap. Click on the "Insert"
tab, and in the "Text" group you can find "Drop Cap"
button. Click it, and hold the mouse pointer over your
choice to see a preview in your document.

The steps to decide the size and modify the drop cap are the same as the steps.

35
WORKSHEET

Formatting, labels, Mailings, header, Ribbon, Insert, Word processing

Answer the following questions.


1. …………is the act of creating, editing and producing a text document.
2. The ………….provides access to commands which are grouped together into tabs according
to the tasks you perform in Word.
3. The ……….tab contains the pages, Tables, Illustrations, Links, Header and Footer,
15. The ……….tab consists of the Create, Start Mail Merge, Write and Insert Fields, Preview
Results and Finish groups.
4………………..is the act of customizing a document to fit your needs by adjusting pieces of
the document, such as page layout and design.
5. A ……….is text which is printed at the top of each page of a document.
6 Microsoft Word allows you to easily create envelopes and ………..by using Create group on
the Mailings tab.

Lab Assignment / Project:


1. Design a Mark Sheet of your class friends by using Mail Merge.
Hint: Use MS Word for Mark Sheet Display and MS Excel for Data.(see following
pictures)

36
This way you can create a Marksheet with ease.

Solve the crosswords using the words from the lesson

D
I D E T
O C H
D
E V L P
A L M R E
P R
B N
I
L
K

37
Chapter 3

Spreadsheet (MS EXCEL)

Inside this chapter : Table creating in MS Excel and implementation various Charts, Cell reference in MS
Excel, Sorting of data in MS Excel, Filtering data in MS Excel, Conditional Formatting, Workbook and
worksheet, Protection of workbook and worksheet.

Microsoft Excel is a powerful spread sheet application that is perfect for maintaining
long lists of data, budgets, sales figures and other data. In this chapter you will learn some
important and interesting features of Excel like Table, Cell reference, inbuilt functions, sorting
of data etc. Let’s discuss these features one by one.
Creating a bar or column chart
To learn how to create a Column and Bar chart in Excel, let's use a simple example of
marks secured by some students in Science and Maths that we want to show in a chart format.
Note that a column chart is one that presents your data in vertical columns. A bar chart is very
similar in terms of the options you have, but presents your data in horizontal bars. The steps
below take you through creating a column chart but you can also follow them if you need to
create a bar chart.
Preparing chart data
The table below shows the data we want to chart. It is important that your data be
presented correctly in order to create a good looking chart.

Creating your column chart


Once your data has been prepared correctly, you are ready to create your chart. This is a
quick process, but it does involve a number of steps:
• First select your data, making sure that you include all of the data that is to be included
in the chart.

38
→ In our example above, that means selecting the range of cells from B5:D13.
→ It's important to remember to include the row headings if you want to use those
values as axis labels on your finished chart.
• Next, click Insert in the menu. The ribbon will change, and will include a number of
chart options(as shown below)

• In our case we are creating a Column chart and Bar


chart, so click the Column button first. The following
options will then be displayed. As you can see, there are
many options available. Select 3D Clustered Column
Chart. We can change it to one of the other chart types
later if we decide that this one doesn't suit our
requirements.
Once you select a chart type, Excel will automatically
create the chart and insert it onto your worksheet.

Now again select the data (cells from B5:D13) and this time select 3D Clustered Column
Chart in Bar chart option and your Bar chart will be ready.

39
• Note the following points about this chart:
→ Excel has automatically put labels on an angle to fit neatly into the space
available.
→ The legend to the right of the chart contains the column heading from our
spreadsheet. You can change them by editing the headings in our data table.
→ Excel has chosen these colours based on a default theme. You can change the
theme if you need to, and the colours will change automatically. You can also
override the colours manually if you need to.
→ There is no title on the chart by default. You can add one manually, or choose a
chart layout that includes one.

Absolute and Relative references in excel formula


You can use three types of cell references in Excel formulas: relative, absolute, and
mixed. Using the correct type of cell reference in formulas ensures that they work as expected
when you copy them to another location in the worksheet. Formulas and functions are at their
most useful when using references, so you need to understand them.
Relative reference: Excel is dynamic when it comes to cell addresses. If you have a cell with a
formula that references a different cell's address and you copy the formula from the first cell
to another cell, Excel updates the cell reference inside the formula. Try an example:
1. In cell B2, enter 100.
2. In cell C2, enter =B2*2.
3. Press Enter. And you will see that Cell C2 returns the value 200.
4. Now Select cell C2.
5. Press Ctrl+C or click the Copy button on the Home tab.
6. Click cell C3.

40
7. Press Ctrl+V or click the Paste button on the Home tab.
8. If you see a moving marquee around cell C2, press the Esc key.
Cell C3 should be the active cell, but if it is not, just click it once on C3. Look at the
Formula bar. The contents of cell C3 are =B3*2, and not the =B2*2 that you copied.

What happened? Excel assumed that if a formula in cell C2 references the cell B2 one
cell to the left then the same formula put into cell C3 is supposed to reference cell B3 also one
cell to the left. Relative references adjust when you copy a formula.
By default, Excel uses relative reference. Let’s see another example. See the formula in cell
D2 below. Cell D2 references (points to) cell B2 and cell C2. Both references are relative.

1. Select cell D2, click on the lower right corner of cell D2 and drag it down to cell D5.

Cell D3 references cell B3 and cell C3. Cell D4 references cell B4 and cell C4. Cell D5
references cell B5 and cell C5. In other words: each cell references its two neighbours on the
left.
Absolute cell reference: Sometimes you don't want relative addressing but rather absolute
addressing: making a cell reference fixed to an absolute cell address so that it doesn't change

41
when the formula is copied. In an absolute cell reference, a dollar sign ($) precedes both the
column letter and the row number. See the following example
1. To create an absolute reference to cell H3, place a $ symbol in front of the column letter
and row number of cell H3 ($H$3) in the formula of cell E3.

2. Now we can quickly drag this formula to the other cells.

The reference to cell H3 is fixed (when we drag the formula down and across). As a result, the
correct lengths and widths in inches are calculated.
Mixed reference: You can also have a mixed reference in which the column is absolute and
the row is relative or vice versa. To create a mixed reference, you use the dollar sign in front of
just the column letter or row number. Here are some examples:
Cell Reference Types
Reference Type Formula After copying the Formula
Relative =A1 Both the column letter A and the row number 1 can change.
Absolute =$A$1 The column letter A and the row number 1 does not change.
Mixed =$A1 The column letter A does not change. The row number 1 can change.
Mixed =A$1 The column letter A can change. The row number 1 does not change.

42
Built in functions
MS Excel has many built in functions which we can use in our formula. To see all the
functions by category choose Formulas Tab » Insert Function. Then Insert function Dialog
appears from which we can choose function.

Some important functions of excel by categories


• Text Functions
o LOWER : Converts all characters in a supplied text string to lower case
o UPPER : Converts all characters in a supplied text string to upper case
o CONCATENATE : Joins together two or more text strings
o LEFT : Returns a specified number of characters from the start of a supplied text
string
o RIGHT : Returns a specified number of characters from the end of a supplied
text string
• Date & Time
o TIME : Returns a time, from a user-supplied hour, minute and second
o NOW : Returns the current date & time
o TODAY : Returns today's date
• Statistical
o SUM : Returns the sum of a supplied list of numbers
o MAX : Returns the largest value from a list of supplied numbers
o MIN : Returns the smallest value from a list of supplied numbers
o COUNTIF : Returns the number of cells (of a supplied range), that satisfy a given
criteria
• Logical
o AND : Tests a number of user-defined conditions and returns TRUE if ALL of the
conditions evaluate to TRUE, or FALSE otherwise
o OR : Tests a number of user-defined conditions and returns TRUE if ANY of the
conditions evaluate to TRUE, or FALSE otherwise

43
o NOT : Returns a logical value that is the opposite of a user supplied logical value
or expression i.e. returns FALSE is the supplied argument is TRUE and returns
TRUE if the supplied argument is FALSE)
• Mathematical
o SQRT : Returns the positive square root of a given number
o POWER: Returns the power of a number raised to second number.
How to insert a function in excel
Every function has the same structure. For example, SUM(A1:A4). The name of this
function is SUM. The part between the brackets (arguments) means we give Excel the range
A1:A4 as input. This function adds the values in cells A1, A2, A3 and A4. It's not easy to
remember which function and which arguments to use for each task. Fortunately, the Insert
Function feature in Excel helps you with this.
To insert a function, execute the following steps.
1. Select a cell.
2. Click the Insert Function button.
The 'Insert Function' dialog box appears.
3. Search for a function or select a function from a
category. For example, choose COUNTIF from the
Statistical category.
4. Click OK.
The 'Function Arguments' dialog box appears.

5. Click in the Range box and select the range A1:C2.


6. Click in the Criteria box and type >5.
7. Click OK.
Result. Excel counts the number of cells that are higher
than 5.

44
Sorting in Excel
Sorting is a common task that allows you to change or customize the order of your
spreadsheet data. For example, you could organize your class student’s birthday list will
make you easier to find what you are looking for. Custom sorting takes it a step further, giving
you the ability to sort multiple levels—such as Name first, then birthdate etc.
To sort in alphabetical order:
1. Select a cell in the column you want to sort by. In this
example, we'll sort by Name.
2. Select the Data tab, then locate the Sort and Filter
group.
3. Click the ascending command to Sort A to Z or the
descending command to Sort Z to A.

4. The data in the spreadsheet will be organized alphabetically. (as shown below)

45
Sorting options can also be found on the Home tab, condensed into the
Sort & Filter command.
To sort in numerical order:
1. Select a cell in the column you want to sort by.(In our example C6)

2. From the Data tab, click the ascending command to Sort Smallest to Largest or the
descending command to Sort Largest to Smallest.
3. The data in the spreadsheet will be organized numerically.

Filters in Excel
If your worksheet contains a lot of content, it can be difficult to find information
quickly. Filters can be used to narrow down the data in your worksheet, allowing you to view
only the information you need.
Filtering data: In the following example, I am applying a filter to an equipment log worksheet
to display only the laptops and projectors that are available for checkout.
1. In order for filtering to work correctly, your worksheet should include a header row,
which is used to identify the name of each column. In our example, our worksheet is
organized into different columns identified by the header cells in row 1: ID#, Type,
Equipment Detail, and so on.

46
2. Select the Data tab, and then click the Filter command.

3. A drop-down arrow will appear in the header cell for each column.
4. Click the drop-down arrow for the column you want to filter. In our example, we will
filter column B to view only certain types of equipment.

5. The Filter menu will appear.


6. Uncheck the box next to Select All to quickly
deselect all data.
7. Check the boxes next to the data you want to
filter, and then click OK. In this example, we
will check Laptop and Tablet to view only
those types of equipment.

47
8. The data will be filtered, temporarily hiding any content that doesn't match the criteria.
In our example, only laptops and tablets are visible.

Filtering options can also be accessed from the Sort & Filter
command on the Home tab.

Applying multiple filters:


Filters are cumulative, which means you can apply multiple filters to help narrow down
your results. In this example, we've already filtered our worksheet to show laptops and
projectors, and we'd like to narrow it down further to only show laptops and projectors that
were checked out in August.
1. Click the drop-down arrow for the column you want to filter. In this example, we will
add a filter to column D to view information by date.

2. The Filter menu will appear.


3. Check or uncheck the boxes depending on the data you want to filter, and then click
OK. In our example, we'll uncheck everything except for August.

48
4. The new filter will be applied. In our example, the worksheet is now filtered to show
only laptops and tablets that were checked out in August.

How to clear a filter:


After applying a filter, you may want to remove or clear it from your worksheet so you'll be
able to filter content in different ways.
1. Click the drop-down arrow for the filter you want to clear. In our example, we'll clear
the filter in column D.

2. The Filter menu will appear.


3. Choose Clear Filter from [COLUMN NAME] from the Filter
menu. In our example, we'll select Clear Filter from "Checked
Out".
4. The filter will be cleared from the column. The previously
hidden data will be displayed.

49
Conditional formatting in Excel
Excel conditional formatting is a really powerful feature which helps you highlight the
most important information in your spreadsheets and identify variances of cells' values with a
quick glance. Conditional formatting in Excel is very straightforward and easy to use. So now
let’s discuss it with an example.
For a start, let's see where you can find the conditional formatting feature in MS Excel
2010. See Home tab -> Styles group.
Conditional formatting in Excel

1. In your Excel spreadsheet, select the cells you want to


format.
For this example, I've created a small table listing the Marks
obtained by the students out of 40. What we want is to
highlight the cells (C5:C22) which have less than 13 marks.
2. Select the cells C5:C22
3. Now, Go to the Home tab > Styles group and click
Conditional Formatting. You will see a number of different
formatting rules, including data bars, color scales and icon
sets.
4. Since we need to apply conditional formatting only to the
numbers less than 13, we choose Highlight Cells Rules > Less
Than...
You can go ahead with any other rule type such as:
• Format values greater than, less than or equal
to.
• Highlight text containing specified words or
characters.
• Highlight duplicates.
• Format specific dates.

50
5. Enter the value in box in the right-hand part of the window under "Format cells that are
LESS THAN", in our case we type 13.

As soon as you have entered the value, Microsoft Excel will highlight the cells in the
selected range that meet your condition.
Worksheet
A worksheet is a collection of cells where you keep and manipulate the data. By default,
each Excel workbook contains three worksheets. An Excel worksheet is a single spreadsheet
that contains cells organized by rows and columns. A worksheet begins with row number 1
and column A. In Excel 2010, the maximum size of a worksheet is 1,048,576 rows by 16,384
columns.
Select a Worksheet
When you open Excel, Excel automatically selects Sheet1 for you. The name of the
worksheet appears on its sheet tab at the bottom of the document window.

To select one of the other two worksheets, simply click on the sheet tab of Sheet2 or Sheet3.
Rename a Worksheet
By default, the worksheets are named Sheet1, Sheet2 and Sheet3. To give a worksheet a more
specific name, execute the following steps.
1. Right click on the sheet tab of Sheet1.
2. Choose Rename.
3. For example, type Class VI.

51

Insert a Worksheet
You can insert as many worksheets as you want. To quickly insert a new worksheet, click the
Insert Worksheet tab at the bottom of the document window.

Move a Worksheet
To move a worksheet, click on the sheet tab of
the worksheet you want to move and drag it
into the new position.
1. For example, click on the sheet tab of Sheet4
and drag it before Sheet2.

Delete a Worksheet
To delete a worksheet, right click on a sheet tab and choose Delete.
For example, delete Sheet4.

52
Copy a Worksheet
Imagine, you have Class VI ready and want to create the exact same sheet for Class VI
Games, but with different data. You can recreate the worksheet, but this is time-consuming. It's
a lot easier to copy the entire worksheet and only change the numbers.
1. Right click on the sheet tab of Class VI.
2. Choose Move or Copy...
The 'Move or Copy' dialog box appears.

3. Select (move to end) and check Create a copy.

4. Click OK.

Now Rename this sheet as Class VI Games

53
Workbook
Excel 2010 includes a Protect Workbook command that prevents others from making
changes to the layout of the worksheets in a workbook. You can assign a password when you
protect an Excel workbook so that only those who know the password can unprotect the
workbook and change the structure or layout of the worksheets.
Now, let’s see protections one by one with example.
How to protect an excel workbook
This example teaches you how to protect the workbook structure and windows in Excel.
Protecting Structure
If you protect the workbook structure, users cannot insert, delete, rename, move, copy, hide or
unhide worksheets anymore.
1. Open a workbook.
2. On the Review tab, click Protect Workbook.

3. Check Structure, enter a password and click OK.


4. Re-enter the password and click on OK.
Users cannot insert, delete, rename, move, copy, hide or unhide
worksheets anymore.

54
Protecting windows
If you protect the workbook windows, users cannot move, change the size and close windows
anymore.
1. Open a workbook.
2. On the Review tab, click Protect Workbook.

3. Check Windows enter a password and click OK.

4. Re-enter the password and click on OK.

You cannot move, change the size and close windows anymore.

To unprotect the workbook, click Protect Workbook and enter the password.

55
Protect Sheet
Sometimes you may want to protect a worksheet to help prevent it from being changed.
Follow these steps to protect the worksheet.
1. Right click a worksheet tab.
2. Click Protect Sheet.

3. Enter a password.
4. Check the actions you allow the users of your
worksheet to perform.
5. Click OK.
6. Confirm the password and click OK.

Your worksheet is protected now. To unprotect a


worksheet, right click on the worksheet tab and
click Unprotect Sheet.

56
WORKSHEET

Fill in the blank with correct option

Bar chart, Worksheet, $, Autosum, formula bar, Sorting, =, Logical operator, now, three

1. …………………Tests a number of user-defined conditions.


2. Workbook is a collection of ………………
3. You can sum a large range of data by simply selecting a tool button called …………………
4 .……………………… is method of arranging the data in ascending or descending order.
5.………………………… can be created in Excel easily.
6. …………………………… function displays current date and time in MS Excel.
7. In the formula, ……………………………….symbol specifies the fixed columns or rows.
8. Excel displays the current cell address in the ………………………
9. By default, a workbook have ………………….. worksheets
10.Formulas in Excel start with……………………

Lab Assignment / Project


1. In Microsoft Excel , Mr. Shubham putting the sum of 3 cells in a 4th cell. If the sum is
greater than 10, he would like the sum to be the color red. If the sum is less than 10, I
would like the sum to be the color blue. Is this possible? If yes, How to achieve it?

2. You have an Excel spreadsheet and you would like to filter more than types of criteria
from a single column. How can filter a single column based on one or more criteria?

3. You are trying to put some data in alphabetical order. There are 4 columns and over
2,000+ rows of information. I need to sort the data by column B in alphabetical order.
How do you do this?

57
Solve the crosswords using the words from the lesson

A S R T

S S R M X
T
F R M L

L G T A Y

E T C L
R
F
O W R
T

58
Chapter 4

Advance features of MS PowerPoint

Inside this chapter : Inserting different objects (i.e. images, Word Arts, audio & video etc.), Transitions in
slide, Custom Animation with text.

PowerPoint is a presentation software program of the Microsoft Office package.


PowerPoint uses a graphical approach to presentations in the form of slide shows that
accompany the oral delivery of the topic. This program is widely used in business and
classrooms and is an effective tool when used for training purposes. It provides “Power to
your Point. PowerPoint is one of the simplest computer programs to learn.
PowerPoint presentations can be made into photo albums, complete with music or
narrations, to distribute on CDs or DVDs. All in all, PowerPoint is a "one-stop-shop" to create
successful presentations for the business world, the classroom or just for your own personal
use.
In this chapter we will discuss some advance features of PowerPoint.

Inserting different objects in PowerPoint slide


1. Inserting a picture
There are two ways to insert a picture on your slide in PowerPoint:
Using Content placeholder
1. Launch PowerPoint. Most of the time,
PowerPoint already has a new slide, change
the layout of this slide to Title and Content
by selecting the Home tab | Layout | Title
and Content option. These results in the
slide layout you see in the Picture.
Click on the Insert Picture from File button
in the Content placeholder, as highlighted
in red.

59
Using Insert picture tool
If you want to add a picture on an existing slide that has no Content placeholder, you can
select the Insert tab of the Ribbon, and click the Picture button.

Either way, you will open the Insert Picture dialog box. Navigate to the folder where your
pictures are located, you will see the icons or thumbnails of the pictures as shown in following
picture. Select the picture you need, and click on the Insert button highlighted in red.

As soon as you click the Insert button, you will see the selected picture placed on the
PowerPoint slide.

Now, the picture can be edited by resizing, moving, rotating, etc.

60
2. Inserting Word Art
WordArt offers additional effects like outline text, fill, gradient, 3D effects and shadows etc.
If you want to, you can add WordArt using the WordArt command on the Insert tab in the
Text group.
1. On the Insert tab, in the Text group, click WordArt. The WordArt Styles gallery opens.

2. Click on the style you want to insert, and a text box appears with the text “Your text
here”, with the WordArt style you selected applied to it.

3. Edit the text to whatever you want it to be.


At this point, you’ll see a Drawing Tools Format context tab. Here you’ll find the WordArt
Styles group.

61
This contains the Preset styles gallery, and drop downs for controlling the Text Fill, Text
Outline, and (most fun) Text Effects.

As you can see, there are a lot of possibilities to explore.

Adding Slide Transitions


Transitions between slides cover much more than some movement between one slide and the
next. Slide transitions in PowerPoint many option including timings and sounds.
In either the Slide Sorter or Normal view, select the slide or slides which you want to apply the
transition to. Now, lets do it practically.
1. From the menu ribbon, select the Transitions tab.

62
2. The most commonly used animations will appear in the center. To preview more
transition options, click the down arrow.

3. Select a transition from the list. Clicking it will apply the transition to the slide. You
can also select Apply to All to apply the same transition to all your slides.
4. In the Duration option, enter the speed at which you want the transition to play.

5. In the Sound field, use the drop-down menu to select a sound to play during a slide
transition, if desired.

6. Indicate how you want the slide transition to occur by selecting an option under the
Advance Slide heading. Select On mouse Click if you want the transition to take place
when you click the left mouse button.
Select Automatically After if you want the transition to occur after a specified time. Use
the up and down arrow keys in the blank box to specify the number of seconds which
should pass before the transition takes place.

Animation with Text


In PowerPoint you can animate text and objects such as clip art, shapes, and pictures.
Animation or movement on the slide can be used to draw the audience's attention to specific
content or to make the slide easier to read.

63
Types of animations
There are many different animation effects you can choose from, and they are organized into
four types:
• Entrance: These control how the object enters the slide. For example, with the Bounce
animation, the object will drop onto the slide and then bounce several times.

• Emphasis: These animations occur while the object is on the slide and are often
triggered by a mouse click. For example, you can set an object to Spin when you click
the mouse.

• Exit: These control how the object exits the slide. For example, with the Fade animation,
the object will simply fade away.

• Motion Paths: These are similar to Emphasis effects, except the object moves within
the slide along a predetermined path, like a circle.

How to apply animation to Text


1. Select the text.
2. Click the Animations tab.
3. In the Animation group, click the More drop-down arrow to view the available
animations.

64
4. Select the desired animation effect.

5. The text will now have a small number next to it to show that it has an animation. Also,
in the Slide pane, the slide will now have a star symbol next to it.

Some effects will have options you can change. For example, with the Fly In effect, you can
control which direction the object comes from. These options can be accessed from the Effect
Options command in the Animation group.

You can apply more than one animation effects for a text

65
Animation Painter:
Sometimes you may want to apply the same effects to more than one object. You can do this
by copying the effects from one object to another using the Animation Painter.
1. Click the object that has the effects you want to copy.
2. From the Animations tab, click the Animation Painter command.

3. Click the object you want to copy the effects to. The effects will be applied to the object.

Animation pane
The Animation pane allows you to view and manage all of the effects that are on the current
slide. You can modify and reorder effects directly from the Animation pane, which is especially
useful when you have several effects.
To open the Animation pane:
1. From the Animations tab, click the Animation Pane command.

2. The Animation pane will open on the right side of the window. It will show all of the
effects for the current slide in the order they will appear.

66
To reorder effects from the Animation pane:
1. On the Animation pane, click and drag an effect up or down.

2. The effects will reorder.


To preview effects from the Animation pane:
1. From the Animation pane, click the Play button.

2. The effects for the current slide will play. On the right side of the Animation pane, you
will be able to see a timeline that shows the progress through each effect.

The Effect options dialog box


From the Animation pane, you can access the Effect Options dialog box, which contains more
advanced options you can use to fine tune your animations.

67
To open the Effect Options dialog box:
1. From the Animation pane, select an effect. A drop-down arrow will appear next to the
effect.
2. Click the drop-down arrow, and select Effect Options. The Effect Options dialog box will
appear.
3. From here, you can add various enhancements to the effect:
o Sound: This adds a sound effect to the animation.
o After animation: This changes the color after the animation is over.
o Animate text: If you are animating text, you can choose to animate it all at once,
one word at a time, or one letter at a time.

To change the effect timing:


1. From the Effect Options dialog box, select the Timing tab.
2. From here, you can add a delay before the effect starts, change the duration of the
effect, and control whether the effect repeats.

68
WORKSHEET

Fill in the blanks with correct option

Animation Painter, Auto clipart, Slide transition, drag, F5

1…………….is the term used when you press and hold the left mouse key and move the

mouse around the slide.

2. The entry effect as one slide replaces another in a show is called……………

3. ………………is a feature that automatically places clipart in your presentation.

4. ………………key can be used to view Slide show.

5. We can copy the effects from one object to another using……………………

Lab Assignment / Project

1. Create a PowerPoint presentation on Input and Output devices of Computer System.


2. Create a PowerPoint presentation with animation on Types of Printers.

Solve the crosswords using the words from the lesson

I A G

P W P I T

T R N S T O
U
O O N
W

69
Chapter 6

HTML

Inside this chapter : Introduction to HTML, Uses of HTML, HTML Tags, HEAD, TITLE, BODY, Empty and
Container Tags.

What is HTML?
HTML is a computer language invented to allow website creation. The websites can then be
viewed by anyone else connected to the Internet. It is relatively easy to learn, with the basics
being accessible to most people in one sitting and quite powerful in what it allows you to
create. HTML is used to build the websites or web based applications.
HTML stands for Hyper Text Markup Language.
• HyperText is the method by which you move around on the web by clicking on special
text called hyperlinks which bring you to the next page.
• Markup is what HTML tags do to the text inside them. They mark it as a certain type of
text for example italicized text.
How does it work?
HTML consists of a series of short codes typed into a text-file called as tags. The text is then
saved as html file, and viewed through a browser like Internet Explorer. This browser reads
the file and translates the text into a visible form, hopefully rendering the page as the author
had intended.
Some of the most popular HTML editors, such as FrontPage or Dreamweaver will let you
create pages more or less as you write documents in Word or whatever text editor you are
using.
Essential HTML Tags
There are four sets of HTML tags that form the basic structure needed for every HTML file:
• <html></html>
• <head></head>
• <title></title>
• <body></body>

77
<html> </html>
This basically defines the document as web page. It also identifies the beginning and
end of the HTML document. All other tags must fall between the html tags.
<head> </head>
The header contains information about the document that will not appear on the actual
page, such as the title of the document, the author etc.
<title> </title>
The title tag defines the title that will appear in the title bar of your web browser. The
title must appear between the head tags.
<body> </body>
The body tags contain all the information and other visible content on the page. All
your images, links and plain text must go between the <body> and </body> tags.
You may also be interested in the basic tags for adding content and headings.
Example:
Below is a basic html document. Notice that everything falls between the html tags, the title
appears within the head of the document, and that the body comes after the head.
1. Open Notepad.
2. Type the HTML program as given below.
3. Click file->Save as

4. Select Desktop, type the file name as myfile.html


and select All files in Save as type box and Click on
save.
Your HTML file will be save to desktop
5. Double click on the file(as shown below) and
your webpage is ready for display.

78
Empty tag and Container tag
A container tag has two ends (an opening and a closing) whereas an empty tag doesn't.
The paragraph tag is an example of a container tag:
<p>Our paragraph text here.</p>
The image tag is a good example of an empty tag.
<img src="kvslogo.png" >
See how the initial paragraph tag (<p>) has a corresponding end tag? The text in between is
"contained" by the tag.
The majority of tags are "container" tags. They have an opening and a closing tag.
However, a few tags are "self-contained" or "empty" tags in that they have an opening tags but
not a closing one.
They common ones are:
• <br> = break
• <img> = image
• <meta> = metadata within an HTML document.

79
WORKSHEET

Fill in the blanks with correct option

<BR>, <HTML>, header, .html, container, tag, title, body, empty , web programming

1. Extension of a HTML file is……………………


2. Predefined command in HTML is knows as…………………
3. HTML is a ………………………language.
4. All HTML programs must have………………tag the begging of program.
5. The ………………contains information about the document that will not appear on
the actual page.
6. The ………… tag must appear between the head tags.
7. The ……………tags contain all the information and other visible content on the page.
8. A ……….……………tag has an opening and a closing end.
9. A…………………tag doesn't have a closing end.
10....................is an example empty tag.

Lab Assignment / Project

1. Create a HTML page that contains your name, class, father’s name, mother’s
name etc. Save this HTML file to Desktop and test the result.

Solve the crosswords using the words from the lesson

H L

H
W E P G

D A R U

H E L K

80
Chapter 7

Internet & Networks

Inside this chapter : Overview of Internet, Intranet, Different types of websites, Web Browsers, Opening of
web pages and Web sites, Use of search engine, Creation of an Email and using it, Advantages and
Disadvantages of Social Media sites, Networking and Networks.

Internet is a collection of computers connected by network


cables or through satellite links. Internet is a network of networks. It
is also knows as Super Network. There are millions of computing
devices that are connected to this network either permanently or for a
short duration. These devices run network applications that
communicate through copper or fiber optic cables, radio or satellite
transmission.
The Internet connectivity is provided by Internet Service Providers (ISP) like BSNL,
Airtel, Reliance, Aircel Vodafone etc.

Advantages
Internet covers almost every aspect of life. Here, we will discuss some of the advantages of
Internet.

81
Internet allows you to communicate with the people sitting at remote locations using
we site and applications like Facebook,Twitter,Yahoo,Google+,Flickr,Orkut etc.
You can find any kind of information on any topic over the internet such as Technology,
Health & Science, Social Studies, Geographical Information, Information Technology,
Products etc.
It also provides entertainment through various modes like online television, online
games, songs, videos, social networking apps.
Internet also allows us to use many services like Internet banking, matrimonial services,
online shopping, online ticket booking, online bill payment, data sharing, e-mail etc.
Disadvantages
However, Internet has proved to be a powerful source of information in almost every field, yet
there exists many disadvantages discussed below:

82
There are always chances to loose personal information such as name, address, credit
card number. Therefore, one should be very careful while sharing such information.
Spamming corresponds to the unwanted e-mails in bulk. These e-mails serve no
purpose and lead to block of entire system.
Virus can easily be spread to the computers connected to internet.
There are many pornographic sites that can be found, which indirectly affects your
healthy and mental life.

Intranet: An intranet is a private network


accessible only to an organization's staff.
Intranet is system in which multiple PCs are
connected to each other. PCs in intranet are
not available to the world outside the
intranet. Usually each company or
organization has their own Intranet network
and members of that company can access the
computers in their intranet.
Similarities in Internet and Intranet
Intranet uses the internet protocols such as TCP/IP and FTP.
Intranet sites are accessible via web browser in similar way as websites in
internet. But only members of Intranet network can access intranet hosted sites.
In Intranet, own instant messengers can be used as similar to yahoo messenger/
Gtalk over the internet.
Differences in Internet and Intranet
Internet is general to PCs all over the world whereas Intranet is specific to
few PCs.
Internet has wider access and provides a better access to websites to large
population whereas Intranet is restricted.
Internet is not as safe as Intranet as Intranet can be safely privatized as per
the need.

83
Types of websites: There are various types of website available in Internet. Here we will
discuss some basic types.
Website Type Definition Example
Personal Used for sharing personal
http://www.sachintendulkar.in
Websites information.
Photo Sharing
Used for sharing photographs. https://www.flickr.com
Websites
A Website for sharing information,
Blogs http://www.narendramodi.in
ideas and views.
Informational Provides information on various
https://www.wikipedia.org
Websites topics.
Directory A Source to access all Websites at
https://goidirectory.nic.in
Websites all levels and from all sectors.
E-commerce
Business Websites https://www.irctc.co.in
Websites

Web browser: A browser is a software application used to locate, retrieve and display content
of Web pages, images, video and other files. The browser contacts the Web server and
requests information and Web server sends the
information back to the Web browser which displays the
results on the computer. Example of Web browser are
Mozilla firefox, Internet explorer, Google chrome ,epic etc.

Opening of Webpages and websites: Opening a website is very easy process. First of all you
must have a working internet connection on your computer.

Search a browser which installed in your computer like Mozilla firefox, Internet
explorer, Google chrome ,Epic, opera etc. double click on the icon of browser and type

84
the name of website in address bar which you want to open. E.g
www.kvsangathan.nic.in (See below).

Use of Search Engine: Search engines are websites that sea rch the internet for you
and give you a list of search results. Search engines can
search for more than just written information. Depending
on the search engine you’re using, you might also be able
to search for other online content like images, video
content, books and news, as well as products and services.
You do not always have to know a website’s address in
order to use the Internet. It is important to know how to
search for information. One of the best methods to search is to use a search engine. You
can use a search engine to help you find what you're looking for. You can also search
for online maps and directions to help plan your travel from one place to another.
Example: Google, Infoseek, Excite, Lycos, AltaVista etc.

85
Email (Electronic Mail): Email is like sending a letter,, you can send the email and it
get to the other person's email account within seconds. If you have an email address,
you can email anyone else who has an email address, including government agencies
and lots of different kinds of businesses.
You can create one or more email addresses. When you create a new email account,
you'll have to pick email addresses that haven't already been chosen by someone else.
Let’s see how you can create an Email account.
In the following example I am creating a new email account in rediff.com but you can
your create email account through any website
which offers free email creation like Google,
yahoo, Hotmail etc.

1. Open website www.rediffmail.com and


click on
2. Now, click on Create a new account
3. Type username ,check the availability of
this Email ID and type password and other
mandatory information for your email
account(See below)
4. Finally, click on Create my account.
5. Your email account creation is over.

86
Now, you can send or receive emails with this ID. For writing new email, use Write Mail
or Compose option and to check the Incoming Email list, see the option Inbox.

Social media sites: A social media site is a platform to build social networks and social
relations among people who share similar interests, activities, backgrounds or real-life
connections. Social media sites are web-based services that allow individuals to create a
public profile, create a list of users with whom to share
connections, and view and cross the connections within
the system. Social media sites incorporate mobile
connectivity, photo & video sharing and blogging. Some
popular social media sites are Facebook, twitter,
LinkedIn, Google Plus+, Instagram and Flickr.
Advantages of Social Media sites:
1. Social networking provides medium for self-expression.
2. Social media sites helps people stay in touch that might not do it otherwise.
3. Social media sites are used to help advertise goods and services.
4. Social media sites provide platform for job searches.

87
Disadvantages of Social Media sites:
1. Social media sites takes time away from other activities and can take over from real
time interaction.
2. Social media sites extend the gap between people who have access to computer
technology and those that don't.
3. Social media sites can be used to promote organized crime.
4. When social media sites are used excessively or in the wrong way, it could have
serious detrimental outcomes on both mental and even physical health of individuals.

Networking and Networks:


Computer Network: A computer network allows computers to
exchange data, Information and share resources. The connections
between computers (nodes) are established using either cable
media or wireless media.
Types of Network
There are many types of computer networks, including the following:
Local-Area Network (LAN): The computers are connected in a building or office.
Wide-Area Network (WAN): The computers are connected by telephone lines or
radio waves across country or continent.
Metropolitan-Area Network MAN): A network designed for a town or city.
Personal Area Network (PAN): A network contained within a user's home that
connects a person's digital devices.

88
Lesson-1
Computer Security
Threats to computer Security
What do they mean by a threat?
A threat, in the context of computer security, You will learn

refers to anything that has the potential to  Threats to computer


 Virus and its types
cause serious harm to a computer system.  Anti Virus software
A threat is something that may or may not and examples
 Firewall and its use
happen, but has the potential to cause serious  Cyber Crime and
damage. Threats can lead to attacks on computer Computer Ethics
 Hackers and crackers
systems, networks and more. A threat can be  Cyber law and
important
either "intentional"(i.e., intelligent; e.g., an individual
 Backup and Restore
cracker ora criminal organization) or "accidental"
(e.g., the possibility of a computer malfunctioning,
or the possibility of a natural disaster such as an
earthquake, a fire, or a tornado) or otherwise a
circumstance, capability, action, or event.
Virus
Computer Virus are nothing but computer program that do unwanted things with your computer
resources e.g. you are working on PC and you are repeatedly receiving annoying message

• Viruses: A virus is a small piece of software that piggybacks on real programs. For example, a virus
might attach itself to a program such as a spreadsheet program. Each time the spreadsheet program
runs, the virus runs, too, and it has the chance to reproduce (by attaching to other programs) or
wreak havoc.

• E-mail viruses: An e-mail virus travels as an attachment to e-mail messages, and usually replicates
itself by automatically mailing itself to dozens of people in the victim's e-mail address book. Some e-
mail viruses don't even require a double-click -- they launch when you view the infected message in
the preview pane of your e-mail software.

Page |1
• Trojan horses: A Trojan horse is simply a computer program. The program claims to do one thing (it
may claim to be a game) but instead does damage when you run it (it may erase your hard disk).
Trojan horses have no way to replicate automatically.

• Worms: A worm is a small piece of software that uses computer networks and security holes to
replicate itself. A copy of the worm scans the network for another machine that has a specific security
hole. It copies itself to the new machine using the security hole, and then starts replicating from there,
as well.

• Virus Origins (http://computer.howstuffworks.com/virus1.htm)


Why they are called Virus?
Computer viruses are called viruses because they share some of the traits of biological viruses. A
computer virus passes from computer to computer like a biological virus passes from person to
person.
Similar to the way a biological virus must hitch a ride on a cell, a computer virus must piggyback on
top of some other program or document in order to launch. Once a computer virus is running, it can
infect other programs or documents.

What /who make virus?


who: People write computer viruses. A person has to write the code, test it to make sure it spreads
properly and then release it. A person also designs the virus's attack phase, whether it's a silly
message or the destruction of a hard disk.
Why:
1. The first is the same psychology that drives vandals and arsonists. For some people, that seems to
be a thrill. If that sort of person knows computer programming, then he or she may funnel energy into
the creation of destructive viruses.
2. The second reason has to do with the thrill of watching things blow up. Some people have a
fascination with things like explosions and car wrecks. Creating a virus is a little like that -- it creates a
virtual bomb inside a computer, and the more computers that get infected, the more "fun" the
explosion.
3. The third reason involves bragging rights. Sort of like Mount Everest -- the mountain is there, so
someone is compelled to climb it. If you are a certain type of programmer who sees a security hole
that could be exploited, you might simply be compelled to exploit the hole yourself before someone
else beats you to it.
Page |2
4. And then there's cold, hard cash. Viruses can trick you into buying fake software, steal your
personal information and use it to get to your money, or be sold on the digital equivalent of the black
market. Powerful viruses are valuable -- and potentially lucrative -- tools.

Virus History
Traditional computer viruses were first widely seen in the late 1980s,
Some Virus the Melissa virus in March 1999 was spectacular in its attack. Melissa spread in Microsoft
Word documents sent via e-mail.
The ILOVEYOU virus, which appeared on May 4, 2000, was even simpler. It contained a piece of
code as an attachment. People who double-clicked on the attachment launched the code. It then sent
copies of itself to everyone in the victim's address book and started corrupting files on the victim's
machine.

Worms: A worm is similar to a virus by design and is considered to be a sub-class of a virus. Worms
spread from computer to computer, but unlike a virus, it has the capability to travel without any human
action. A worm takes advantage of file or information transport features on your system, which is what
allows it to travel unaided.

Worms use up computer processing time and network bandwidth when they replicate,
and often carry payloads that do considerable damage.
Some example of worms: A worm called Code Red made huge headlines in 2001.
The Slammer worm (which caused mayhem in January 2003) exploited a hole in Microsoft's SQL
server.
A worm called Storm, which showed up in 2007, immediately started making a name for itself. Storm
used social engineering techniques to trick users into loading the worm on their computers.

Trojan Horse: A Trojan Horse is full of as much trickery as the mythological Trojan Horse it was
named after. The Trojan Horse, at first glance will appear to be useful software but will actually do
damage once installed or run on your computer. Some Trojan are designed to be more annoying than
malicious (like changing your desktop, adding silly active desktop icons) or they can cause serious
damage by deleting files and destroying information on your system. Trojans are also known to create

Page |3
a backdoor on your computer that gives malicious users access to your system, possibly allowing
confidential or personal information to be compromised. Unlike viruses and worms, Trojans do not
reproduce by infecting other files nor do they self-replicate.

How to protect your system

• Keep The Operating System Updated


• Use a Firewall
• Anti-virus software is crucial to preventing virus attacks, but this strategy only works if users
update their software.
• Know that the only way a virus spreads is either by launching an infected file or by booting an
infected disk. You cannot get a virus by simply being online or by reading e-mail.
• Anti-Virus Software: vast, Avira, McAfee, Nortan and many more

Firewall

A firewall is a system designed to prevent unauthorized access to or from a private network. Firewalls
can be implemented in both hardware and software, or a combination of both. All messages entering
or leaving the intranet pass through the firewall, which examines each message and blocks those that
do not meet the specified security criteria.

Hardware and Software Firewalls:


Firewalls can be either hardware or software but the ideal firewall configuration will consist of both.
Hardware firewalls can be purchased as a stand-alone product but are also typically found in
broadband routers, and should be considered an important part of your system and network set-up.
Most hardware firewalls will have a minimum of four network ports to connect other computers, but for
larger networks, business networking firewall solutions are available.

Page |4
Common Firewall Techniques:
There are several types of firewall techniques that will prevent potentially harmful information from
getting through:

1. Packet Filter
Looks at each packet entering or leaving the network and accepts or rejects it based on user-defined
rules. Packet filtering is fairly effective and transparent to users, but it is difficult to configure. In
addition, it is susceptible to IP spoofing.

2. Application Gateway
Applies security mechanisms to specific applications, such as FTP and Telnet servers. This is very
effective, but can impose a performance degradation.

3. Circuit-level Gateway
Applies security mechanisms when a TCP or UDP connection is established. Once the connection
has been made, packets can flow between the hosts without further checking.

4. Proxy Server
Intercepts all messages entering and leaving the network. The server effectively hides the true
network addresses.
In practice, many firewalls use two or more of these techniques in concert. A firewall is
considered a first line of defense in protecting private information.

Cyber Crime

Cybercrime encompasses any criminal act dealing with computers and networks (called hacking).
Additionally, cybercrime also includes traditional crimes conducted through the Internet. For example;
hate crimes, telemarketing and Internet fraud, identity theft, and credit card account thefts are
considered to be cybercrimes when the illegal activities are committed through the use of a computer
and the Internet.

Page |5
Computer as a target
These crimes are committed by a selected group of criminals. Unlike crimes using the computer as a
tool, these crimes require the technical knowledge of the perpetrators. There are numerous crimes of
this nature committed daily on the internet:
Crimes that primarily target computer networks or devices include:
• Computer viruses
• Denial-of-service attacks
• Malware (malicious code)

Computer Ethics

Computer Ethics is set of moral principles that regulate the use of computers. Some common issues
of computer ethics include intellectual property rights (such as copyrighted electronic content), privacy
concerns, and how computers affect society.

1. You shall not use a computer to harm other people.


2. You shall not interfere with other people's computer work.
3. You shall not snoop around in other people's computer files.
4. You shall not use a computer to steal.
5. You shall not use a computer to bear false witness
6. You shall not copy or use proprietary software for which you have not paid.
7. You shall not use other people's computer resources without authorization or proper
compensation.
8. You shall not appropriate other people's intellectual output.
9. You shall think about the social consequences of the program you are writing or the system
you are designing.
10. You shall always use a computer in ways that ensure consideration and respect for your fellow
humans.

Page |6
Hackers and Crackers

A hacker is a person intensely interested in the arcane and recondite workings of any computer
operating system. Hackers are most often programmers. As such, hackers obtain advanced
knowledge of operating systems and programming languages. They might discover holes within
systems and the reasons for such holes. Hackers constantly seek further knowledge, freely share
what they have discovered, and never intentionally damage data.

A cracker is one who breaks into or otherwise violates the system integrity of remote machines with
malicious intent. Having gained unauthorized access, crackers destroy vital data, deny legitimate
users service, or cause problems for their targets. Crackers can easily be identified because their
actions are malicious.

1. A white hat hacker breaks security for non-malicious reasons, perhaps to test their own
security system

2. A "black hat" hacker is a hacker who "violates computer security for little reason beyond
maliciousness or for personal gain"

3. A grey hat hacker lies between a black hat and a white hat hacker. A grey hat hacker may surf
the Internet and hack into a computer system for the sole purpose of notifying the administrator
that their system has a security defect,

4. A social status among hackers, elite is used to describe the most skilled.
5. A blue hat hacker is someone outside computer security consulting firms who is used to bug-
test a system prior to its launch, looking for exploits so they can be closed

CyberLaw

Cyber means the use of Internet technologies and computers it includes computers, networks,
software, data storage devices, Internet, websites, emails, ATM machines etc. To protect the
cybercrime over Internet, this law is Passed to protect the Internet cybercrime. This law is approved
by the government.

Page |7
Cyber law Includes:

1. Cybercrimes
2. Electronic and Digital Signatures
3. Intellectual Property
4. Data protection and privacy

Importance of Cyber Law: Companies now be able to carry out electronic commerce using the legal
infrastructure provided by the Act allows Government to issue notification on the web thus heralding
e-governance Protect Computer fraud and Unauthorized access. Consumers are now increasingly
using credit cards for shopping. Most people are using email, cell phones and SMS messages for
communication as well as Deal with Internet Banking Transactions.

Backup and Restore


Backup and Restore (formerly Windows Backup and Restore Center) is a component of Microsoft
Windows introduced in Windows Vista and included in later versions that allows users to create
backups and restore from backups.

There are two different types of backup supported: File backup and system image.

1. File backups are saved to ZIP files. Two methods of file backup are supported: The first,
normal backup, stores everything selected for backup. The second, incremental backup stores
only files that are changed after a previous backup.
2. System image: The image-based full system backup option, called Complete PC Backup in
Windows Vista or system image in Windows 7, allows for the imaging of the entire system
including operating system and data volumes. The backed up image can later be restored
through the Windows Recovery Environment either to the same computer or to a new
computer of different brand and type.

Page |8
To back up your files

1. Open Backup and Restore by clicking the Start button , clicking Control Panel,
clicking System and Maintenance, and then clicking Backup and Restore.

2. Do one of the following:

• If you've never used Windows Backup before, click Set up backup, and then follow the
steps in the wizard.
• If you've created a backup before, you can wait for your regularly scheduled backup to
occur, or you can manually create a new backup by clicking Back up now.

Restore files from a backup

1. Open Backup and Restore by clicking the Start button , clicking Control Panel,
clicking System and Maintenance, and then clicking Backup and Restore.

2. Do one of the following:

• To restore your files, click Restore my files.


• To restore the files of all users, click Restore all users' files. If you're prompted for an
administrator password or confirmation, type the password or provide confirmation.

SUMMARY

1. A threat, in the context of computer security, refers to anything that has the potential to cause
serious harm to a computer system.

2. Computer Virus are nothing but computer program that do unwanted things with your computer
resources e.g. you are working on PC and you are repeatedly receiving annoying message.
3. Viruses are of many types like Email viruses, Trojan Horse, Worm, ILOVEYOU.
4. We can protect our system by Keeping The Operating System Updated, Use a Firewall,
Anti-virus software is crucial to preventing virus attacks, but this strategy only works if users
update their software.
5. A firewall is a system designed to prevent unauthorized access to or from a private network.
Firewalls can be implemented in both hardware and software, or a combination of both.
6. Common Firewall techniques are Packet Filter, Application Gateway, Circuit-level Gateway,
Circuit-level Gateway, and Proxy Server.

Page |9
7. Any criminal act dealing with computers and networks (called hacking). Additionally, cybercrime also
includes traditional crimes conducted through the Internet referred to as Cyber Crime.
8. Computer Ethics is set of moral principles that regulate the use of computers.
9. A hacker is a person intensely interested in the arcane and recondite workings of any
computer operating system. Hackers are most often programmers.
10. A cracker is one who breaks into or otherwise violates the system integrity of remote
machines with malicious intent.
11. Cyber means the use of Internet technologies and computers it includes computers, networks,
software, data storage devices, Internet, websites, emails, ATM machines etc.
12. Backup and Restore (formerly Windows Backup and Restore Center) is a component of
Microsoft Windows introduced in Windows Vista and included in later versions that allows
users to create backups and restore from backups.
13. Two different types of backup supported: File backup and system image.

EXERCISES

A. Fill in the blanks:

i. ____________ has the potential to cause serious harm to a computer system.


ii. A threat can be ____________ and ___________.
iii. ____________Uses computer networks and security holes to replicate itself.
iv. ____________program can erase your hard disk.
v. Computer viruses were first widely seen in the late___________.
vi. Crime conducted with internet called ____________.
vii. ____________ is one who breaks into or otherwise violates the system integrity of
remote machines with malicious intent.
viii. File backup and System image are two ___________________methods.

P a g e | 10
B. Find true or false:
i. Computer viruses are nothing but computer program that do unwanted things.
ii. A hacker is hacking software which access in sensitive information from your
computer.
iii. Backup and Restore is a component of Microsoft Windows.
iv. Cyber means the use of internet technologies and computers.
v. We shall use a computer to harm other people is one of the ethics of computer.

C. Short answer questions:


i. What is threat in computer?
ii. Give one difference between Trojan Horse and worms?
iii. What is Firewall in windows?
iv. List two ethics of computer?
v. Give one difference between Hackers and Crackers?
vi. Why we need Backup?
vii. What are the types of Backup? Write name of each.
viii. What do you mean by Restore? How it is helpful for you?

P a g e | 11
Lesson-2
Hyper Text Markup Language (HTML)
HTML:
You will learn
HTML is the building block for web pages.
Prerequisites: You will need a text editor,
such as Notepad and an Internet browser,  Heading (H1 to H6)
 <Br>, <hr>
such as Internet Explorer or Netscape. ,<comment>
 Background Color
,font tag(size, face,
What is an html File? color)
i. HTML is a format that tells a computer  Text alignment
(center, left , right)
how to display a web page.
ii. An HTML file is a text file containing
small markup tags
iii. The markup tags tell the Web browser
how to display the page
iv. An HTML file must have an htm or html
file extension

What are HTML tags?


i. HTML tags are used to mark-up HTML elements.
ii. HTML tags are surrounded by the two characters < and >.
iii. HTML tags normally come in pairs like <b> and </b>.
iv. The first tag in a pair is the start tag, the second tag is the end tag.
v. HTML tags are not case sensitive, <b> means the same as <B>.

P a g e | 12
Tag Description

<html> This tag marks the start of an html document

<head>...</head>This tag represents the document's header which can keep other HTML tags like
<title>, <link> etc.

<title> The <title>tag is used inside the <head> tag to mention the document title.

<body> This tag represents the document's body which keeps all the contents of a web page- text,
images, sound etc.

<Hn> This tag represents the heading tags of different sizes.


Where n is the number start from 1…6
Like <H1>,<H2>……..<H6>

<center> This tag is used to write a line or text in center

<p> This tag represents a paragraph.


<p align=left/right/center>This tag is used to write paragraph alignment in html.

<br> This tag is used to insert new line or insert enter in html

Bold, Italics, Underline :<b> tag is used to make a text bold in html.

<i>tag is used to make a text italics in html.

<u>tag is used to make a text underlined in html.

P a g e | 13
Background color and text color: <body bgcolor ="yellow" > tag is used to change the
background color of an html page and <body text=”red”> changes text color.

How to create webpages?

1.click Start-> All Programs->Accessories. Open notepad and type the code given below

<html>

<head>

<title>My First Webpage

</title>

</head>

<body>

<center><h1> Webpage </h1></center>

This is my first homepage.

<b>This text is bold</b>

<i> This line is in italics text. </i>

<u> This line is in underline text. </u>

<br>This is the 1st line.

<br>This is the 2nd line.

</body>

</html>

2. Click File, Click Save as


3.Type a Name of your webpage dot html.e.g.: -mypage.html
P a g e | 14
4. Open the Place where you saved your file. Double click on the file.

Assignment Question

Q. Write the code to create the following Webpage with background color ‘green’ and text color ‘red’

My School
Im a student of K.V,NFR Maligaon. I read in class 7.

<html>

<head>

<title>My Webpage

</title>

</head>

<body bgcolor ="yellow" text=”red”>

<center><h1> My School </h1></center>

<p align=left>Im a student of K.V,NFR Maligaon. I read in class 7. </p>

</body>

</html>

Q. Write an html code to show the working of various Paragraph alignment tags

P a g e | 15
<html>

<head>

<title>

Paragraph in html

</title>

</head>

<body>

This is an html document.

<p align=left>This is a left paragraph in html </p>

<p align=right>This is a right paragraph in html </p>

<p align=center>This is a center paragraph in html </p>

</body>

</html>

Inserting Images in Webpage:


We can insert images to our Html pages to make it look more beautiful. <img> tag is used to insert
images in webpage. There are two ways to insert images in a webpage:

1. Internal:

Steps: 1. Open My Pictures or Sample Pictures or any folder containing pictures Copy the
picture you want

2. Create a folder on the Desktop or in My Documents

3.Open the Folder, and paste the Picture.

4.Right click, and click new and click text document.

P a g e | 16
5.Open the text document and type the code given below.

<html>

<head>

<title>

Webpage with Pictures

</title>

</head>

<body bgcolor="yellow">

<img src=Name of image.jpg>

</body></html>

4.Save the file giving a name with dot html(mypage.html).

5.Open the webpage using browser

2. External: Here we type the location or address of the picture where it is, instead of simply
writing the name of the picture.

Steps:

1.Open a text document and type the code given below.

<html>

<head>

P a g e | 17
<title>

Webpage with Pictures

</title>

</head>

<body bgcolor="yellow">

<img src=c:\Windows\Web\Wallpaper\Name of image.jpg>

</body>

</html>

2.Save the file giving a name with dot html(mypage.html).

3.Open the webpage using browser

To insert images with adjusted height and width: We can change the width and height of the
inserted image in our webpage by simply writing the ‘width’ and ‘height’ options inside the <img> tag

<img src=Name of image.jpg width=50 height=50>

SUMMARY

1. HTML is a format that tells a computer how to display a web page; it is the building block for
web pages.
2. HTML tags normally come in pairs like <b> and </b>.
3. <html> This tag marks the start of an html document
4. <head>...</head>This tag represents the document's header which can keep other HTML tags
like <title>, <link> etc.
5. <title> The <title>tag is used inside the <head> tag to mention the document title.
6. <body> This tag represents the document's body which keeps all the contents of a web page-
text, images, sound etc.
7. <h1> ,<h2>,……<h6>This tag represents the heading tags of different sizes.

P a g e | 18
8. <center> This tag is used to write a line or text in center
9. <p> This tag represents a paragraph.
10. <img> tag is used to insert images in webpage

EXERCISES

A. Fill in the blanks


i. _____________ is the building block of HTML
ii. HTML document must have .html or ___________ extensions.
iii. _____________tag is used to write line or text in center.
iv. _____________tag is used to set paragraph.
v. To insert image ___________tag is used.

B. Find true or false


i. HTML tags are case sensitive.
ii. <h1><h2>……..<h6> tags represent heading tags of different size.
iii. <p> tag is used to insert new line or insert enter in HTML.
iv. <img> tag is used to insert images in webpage.
v. <B> tag is used to make text italics.

C. Short answer question

i. What is HTML?
ii. Name any two attributes used with the BODY tag.?
iii. Write the HTML code to set the background color to yellow.?
iv. How would you insert image in an Html document?
v. What does the ‘n’ in the <Hn> tag indicate?

P a g e | 19
In the lab

1. Ankita has made the HTML document shown below, which displays headings in different
Sizes. Write the HTML code for creating a similar document.

2. Anita wants to create simple Web page on Input devices. Help her by listing the steps required
for creating the web page.

P a g e | 20
Lesson-3
You will learn
HTML LISTS
Lists in HTML  Paragraph formatting
Tags
1. Unordered Lists - An unordered list has no  List Tags
specific numbering or ordering. It starts with  Order (start and type
attribute) and Un order
the <ul> tag. Each list item starts with the <li>
List
tag.Example: Create the following List in HTML  Background Image and
other Image Insertion in
<html> Web Page with alignment
 Creation of table
<head>
 Anchor Tag
 Hyper Link
<title>

Unordered list

</title>

<head>

<body>

<h2><b>Unordered List with Bullets</b></h2>

<ul>
Unordered List with Bullets
<li>Coffee</li>
I like to drink the following:
<li>Tea</li>
• Coffee
<li>Milk</li> • Tea
</ul> • Milk

</body>

</html>

Unordered list styling- <ul style="list-style-type:circle"> OR <ul style="list-style-type:square">

P a g e | 21
11. Ordered Lists - An ordered list can be numerical or alphabetical in a specific order.

Example: Create the following List in HTML

<html>
Ordered List with Numbers
<head>
I like to drink the following:
<title>
1. Coffee
Ordered list 2. Tea
3. Milk
</title>

</head>

<body>

<h2><b>Ordered List with Numbers</b></h2>

<ol>

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ol>

</body>

</html>

Ordered list styling- To change the starting number from default 1 to any number we use the ‘start’
option.

To Change from numbers to alphabet or to roman numbers we use the ‘type’ option.

Example: <ol start="10” type=i >


x. Coffee
<li>Coffee</li> xi. Tea
xii. Milk
<li>Milk</li>

P a g e | 22
</ol>

TABLES IN HTML:
HTML tables allow web authors to arrange data like text, images, links, other tables, etc. into rows
and columns of cells. The HTML tables are created using the <table> tag in which
the <tr> tag is used to create table rows and <td> tag is used to create data cells.

Example: Create the following List in HTML

Month Saving
January $100
February $75

<html>
<head>
<title>
Table in html
</title>
</head>
<body>
<table>
<tr>
<td>Month</td>
<td>Savings</td>
</tr>
<tr>
<td>January</td>

P a g e | 23
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$75</td>
</tr>
</table>
</body>
</html>

1. Table Border:We add border option in <table> tag i.e.<table border=”1”>

2. Bordercolor: It specifies the color of the table’s border.


Syntax: <table border=3 bordercolor=red>

3. Cellspacing: It is the space between cells.

4. Cellpadding: It is the distance between cell border and the cell


contents.

Syntax: <table border=3 bordercolor=red cellspacing=10 cellpadding=10>

5. Background: It is used to give image in the background. This attribute takes URL of the file as its
value.

Syntax: <table background=”path”

6. Bgcolor: It is used to give colour in the background of the table.

Syntax: <table bgcolor=”red”>

7. Height and Width: These attributes are used to specify the height and width of the table in pixel

Syntax: <table height=200 width=300 >

ROWSPAN AND COLSPAN ATTRIBUTES OF TABLE TAG

P a g e | 24
Stretching a cell over multiple rows or columns is refered to as spanning. Two or more adjacent rows
can be combined together to form a single row using the rowspan attribute. Two or more adjacent
columns can be combined together to form a single columns using the colspan attribute.

<html>

<Table border=1>

<caption> PRICE LIST</caption>

<tr><th colspan=2>Activity Name</th><th>Monthly Charges</th></tr>

<tr><td rowspan=2>INDOOR Activities</td><td>Indian Dance</td><td>Rs.


250</td></tr>

<tr><td>Dramatics</td><td>Rs. 350</td></tr>

<tr><td rowspan=2>OUTDOOR Activities</td><td>Skating</td><td>Rs.


150</td></tr>

<tr><td>Horse Riding</td><td>Rs. 400</td></tr>

</Table>

</html>

Output :-

P a g e | 25
Anchor Tag:
The ‘a’ or anchor tag. Hyperlinks, or links, are how you move around the web. An <a> or anchor tag is
how you make hyperlinks in HTML. The ‘a’ or anchor tag is an elegantly simple and powerful tool.
There are two ways two insert hyperlinks in html:
1. Internal link –
Steps: 1. Open My Pictures or Sample Pictures or any folder containing pictures or songs or any
file, Copy the file you want

2. Create a folder on the Desktop or in My Documents

3.Open the Folder, and paste the file.

4.Right click, and click new and click text document.

5.Open the text document and type the code given below.

<html>

<head>

<title>

Links in HTML

</title>

</head>

<body>

<p><a href=Name of the file. extension>Click here to download</a></p>


P a g e | 26
</body>

</html>

4.Save the file giving a name with dot html(mypage.html).

5.Open the webpage using browser.

2. External: Here we type the location or address of the picture or file where it is, instead of
simply writing the name of the picture.

Steps:

1.Open a text document and type the code given below.

<html>

<head>

<title>

Webpage with Pictures

</title>

</head>

<body >

<p><a href=c:\User\Name of the file. extension>Click here to download</a></p>

P a g e | 27
</body>

</html>

4.Save the file giving a name with dot html(mypage.html).

5.Open the webpage using browser

To open webpages using hyperlinks: We can open different webpages by simply clicking on a
hyperlink by providing the address of the webpage using <a> tag

<a href="http://www.yahoo.com">Visit Yahoo</a>

To change HTML Link Color: We can change the color of the hyperlinks by using the following
options in the <body> tag.

link="color" For the a page that hasn't been to visited yet


vlink="color" For the visited link color
alink="color" For the active link color

<body link="blue" alink="blue" vlink="red">

SUMMARY

1. Each list item starts with the <li> tag.


2. In HTML List are of three types Ordered list, Unordered list, Definition list.
3. An ordered list can be numerical or alphabetical in a specific order.
4. An unordered list has no specific numbering or ordering. It starts with the <ul> tag.
5. HTML tables allow web authors to arrange data like text, images, links, other tables, etc. into
rows and columns of cells.
6. HTML tables are created using the <table> tag.
7. In HTML <tr> tag is used to create table rows and <td> tag is used to create data cells.
8. Cellspacing is the space between the cells.
9. Cellpadding is the distance between cell border and the cell contents.
10. Stretching a cell over multiple rows or columns is refered to as spanning.

P a g e | 28
11. Two or more adjacent rows can be combined together to form a single row using the rowspan
attribute.
12. Two or more adjacent columns can be combined together to form a single columns using the
colspan attribute.
13. An <a> or anchor tag is how you make hyperlinks in HTML.
14. There are two ways two insert hyperlinks in html : Internal Link, External Link.

EXERCISES

A. Fill in the blanks


i. __________list can be numerical or alphabetical in a specific order.
ii. Each list item should start with_____________tag.
iii. We can create table in HTML by using___________tag.
iv. __________tag is used to create table row whereas ___________tag is used to create
Data cells.
v. Space between the cells is_____________.
vi. ___________is the distance between the cell border and the cell content.

B. Find true or false


i. We use Table border to change the color of border.
ii. Background is to give image in the background.
iii. <A HREF=”Lotus.html”> here ‘A’ stands for anchor tag.
iv. HREF attribute is used to set URL of the page.
v. <TD> tag is used to create table row.

C. Short Answer Questions


i. What is List in HTML?
ii. What are the types of List in HTML?
iii. Give one difference between Ordered list with Unordered list.?
iv. What is cellpadding?
P a g e | 29
v. Give one difference between rowspan with colspan.?
vi. What is cellspacing?
vii. What is the use of <A> tag in HTML? Give syntax.
viii. List four attributes of <A> tag.
ix. What are the types of Hyperlink?
x. Identify the error in code given below:
<img src=”mypage.html”

In the lab

1. The student of Lotus Public School wants to create the following web page related to the
outdoor activities help them to create the code in HTML.

2. Create your class time table with class teacher name using <TABLE> in HTML , You are free to
use colors of your own choice.

3. Anita is trying to create two web pages computer.html and definition.html where computer.html
is the name and are linked to definition.html. She wants that a click on name and it should

P a g e | 30
Lesson-1
Algorithm You will learn

 Use of algorithm in
Use of algorithm in programming programming

 Developing algorithm
to solve a particular
Developing algorithm to solve particular problem problem

In mathematics and computer science, an algorithm is


a step-by-step procedure for calculations. Algorithms
are used for calculation, data processing, and automated
reasoning.Algorithms resemble recipes. Recipes tell you
how to accomplish a task by performing a number of steps.
For example, to bake a cake the steps are: preheat the
oven; mix flour, sugar, and eggs thoroughly; pour into a baking pan; and so forth.

Goals of Algorithm Study


• To develop framework for instructing computer to perform tasks
• To introduce notion of algorithm as means of specifying how to solve a problem
• To introduce and appreciate approaches for defining and solving very complex tasks in
terms of simpler tasks;

Simple Questions based on Algorithm

Algorithm: Calling a friend on the telephone

Input: The telephone number of your friend.


Output: None

1|Page
Steps:
1. Pick up the phone and listen for a dial tone
2. Press each digit of the phone number on the phone
3. If busy, hang up phone, wait 5 minutes, jump to step 2
4. If no one answers, leave a message then hang up
5. If no answering machine, hang up and wait 2 hours, then jump to step 2
6. Talk to friend
7. Hang up phone

Algorithm to create Maggie noddle:


Step 1: Start
Step 2: Take pan with water
Step 3: Put pan on the burner
Step 4: Switch on the gas/burner
Step 5: Put magi and masala
Step 6: Give two minutes to boil
Step 7: Take off the pan
Step 8: Take out the magi with the help of fork/spoon
Step 9: Put the Maggi on the plate and serve it
Step 10: Stop.

Algorithm: To find (a + b)2=(a + b)* (a + b)

Input: Two numbers a and b.


Output: Result of (a + b)2

Steps:
1. Take numbers a, b, c.
2. Input the values of a and b

2|Page
3. C=a+b
4. Print c*c

Algorithm: To find Perimeter of rectangle

Input: Two numbers l and b.


Output: Result l*b

Steps:
1. Take numbers l, b, c, d.
2. Input the values of l and b
3. c=l*b
4. d=2*c
5. Print d

Conditions in Algorithm

Algorithm: To check whether a person can vote or not

Input: A number age.


Output: Yes or No

Steps:
1. Take a number age.
2. Input the age of the person
3. If(age>=18) goto step 4

3|Page
Else
Goto step 5
4. Print “You can vote”
5. Print “You can’t vote”

Algorithm: To give a bonus of Rs 1000 to those employees whose salary is more than Rs
5000

Input: Salary.
Output: New Salary

Steps:
1. Take numbers salary and total.
2. Input the salary of the person
3. If(salary>=5000) goto step 4
Else
Goto step 5
4. total=salary+1000
5. total=salary+0
6. Print total

4|Page
SUMMARY

1. An algorithm is a step-by-step procedure for calculations.


2. To develop framework for instructing computer to perform tasks os one of the goal of
Algorithm.

EXERCISES

A. Short Answer Question


1. What is an algorithm?
2. Write few goals of an algorithm.?
3. Write an algorithm to find Area of square?

5|Page
Lesson-2
Flow Char You will learn
 About flow chart
 Various types of box
About flow chart used in flow
chart and their
A flowchart is a type of diagram that represents an algorithm or use(terminal box,
input/output box,
process, showing the steps as boxes of various kinds, and their processing box
order by connecting them with arrows. This diagrammatic , decision box)
 Question based on
representation illustrates a solution to a given problem. sequence , selection
and iteration

6|Page
Various types of box used in flow chart:

7|Page
Question based on sequence, selection and iteration
Q 1. Draw a flowchart to find the sum of two numbers

Q 2. Draw a flowchart to find the simple interest.

8|Page
Q 2. Draw a flowchart to find bigger number among two numbers (selective)

Q3. Draw a flow chart to find factorial of any number. (iteration)

9|Page
SUMMARY
1. A flowchart is a type of diagram that represents an algorithm or process, showing the

steps as boxes of various kinds, and their order by connecting them with arrows.

2. Flowline symbol used to connect the symbols and indicate the flow of logic.

3. Terminal symbol is used to represent the beginning (Start) or end (End) of task.

4. Input/Output symbol used to represent reading or writing operations.

5. Processing symbol used for arithmetic and data manipulation operations.

6. Decision making symbol used to represent any logic and comparisons operations.

EXERCISES

1. What is flowchart?

2. What is the use of flowchart?

3. Draw the flowchart for

a) Find the addition of two number.

b) Find whether a people eligible to give vote or not.

c) Find given number even or odd.

d) Find whether a people drive car or not.

10 | P a g e
Lesson-8
E-Commerce
You will learn
EDI(Electronic Data Interchange)
 EDI(Electronic Data
Interchange)
Electronic data interchange (EDI) is an electronic communication  What is E-Commerce and E-
Greetings ?
method that provides standards for exchanging data via any  Influence on user
 What factor one should
electronic means. Two different companies or organizations, keep in mind while doing e-
commerce, Websites
even in two different countries, can electronically exchange Example
documents (such as purchase orders, invoices, shipping notices,

and many others). EDI implies a sequence of messages between

two parties, either of whom may serve as originator or recipient.

The formatted data is transmitted via telecommunications or

physically transported on electronic storage media using wires

What is E-Commerce and E-Greetings?

E-Commerce It refers to any form of transaction (exchange) that uses an electronic


medium to facilitate the transaction.

Social impacts of E- Business:

• Reductions in transactions and other costs.


• Increase in the internet users.
• Un-shortened supply chain.

71 | P a g e
• Improved customer service.
• Increased productivity/efficiency.
• Access to international markets.

Some E-Business websites are:

Name of Website Purpose


www.irctc.co.in It provides online railway ticket reservation in
India.
www.licindia.com Insurance company of India.
www.ebay.in India’s most popular online shopping mall
providing freeonline auctions
www.amazon.com Online store for Books, CD’s, DVD’s, MP3’s etc.
www.yatra.com Online flight ticket booking service.

An E-card is similar to a postcard or greeting card, with the primary difference being that it is created

using digital media instead of paper or other traditional materials. E-cards are made available by

publishers usually on various Internet sites, where they can be sent to a recipient, usually via e-mail.

It also considered more environmentally friendly compared to traditional paper cards. E-card

businesses are considered environmentally friendly because their carbon footprint is generally much

lower compared to paper card companies and because paper is not used in the end product.

E-cards can be easily sent to many people at once or extensively personalized by the sender

Typically, an E-card sender chooses from an on-line catalog of E-cards made available on a

publisher's web site. After selecting a card, the sender can personalize it to various degrees by

adding a message, photo, or video. Finally, the sender specifies the recipient's e-mail address and

the web site delivers an e-mail message to the recipient on behalf of the sender.

72 | P a g e
Types of E-card:

• Flash animation
 This type of E-card is based on two-dimensional vector animation controlled with
a scripting language. Flash animated greeting cards can include interactivity, for
example, asking the viewer to choose a picture to animate;
• Video E-cards
 "Video E-cards" use a combination of personalized text and video to convey the
message to the recipient.
• Mobile E-cards
 With the advance in mobile technologies, Multimedia Messaging Service (MMS)
which is basically picture SMS, became more and more popular.
• Web based multi-media E-cards
 The web-based card creation has been evolving becoming more creative. The
user can create greeting cards online choosing backgrounds, drag and drop
images, animations, smiles and write text that look like handwriting.
• E-cards games
 Some E-cards include interactive games.

Influence on user

ADVANTAGES OF ECOMMERCE
• Faster buying/selling procedure, as well as easy to find products.
• Buying/selling 24/7.
• More reach to customers, there is no theoretical geographic limitations.
• Low operational costs and better quality of services.
• No need of physical company set-ups.
• Easy to start and manage a business.
• Customers can easily select products from different providers without moving around physically.

73 | P a g e
DISADVANTAGES OF ECOMMERCE
• Any one, good or bad, can easily start a business. And there are many bad sites which eat up
customers’ money.
• There is no guarantee of product quality.
• Mechanical failures can cause unpredictable effects on the total processes.
• As there is minimum chance of direct customer to company interactions, customer loyalty is
always on a check.
• There are many hackers who look for opportunities, and thus an ecommerce site, service,
payment gateways, all are always prone to attack.

What factor one should keep in mind while doing e-


commerce?
1 Privacy
It is easy to collect a lot of personal information from a
consumer using an e-commerce website,

2 Security

Online transactions are inherently more insecure than those conducted in person because
there's no way to guarantee that the person making the payment is the actual owner of the
credit card used.

3 Price Wars
Merchants used to selling at their shop may often find selling online an extremely competitive
marketplace. or products are purchased from illegitimate retailers because they had the best
price.

74 | P a g e
4 Returns And Complaints
Selling online means usually a higher return rate on products than when the purchase was
conducted in person.

SUMMARY

1. Electronic data interchange (EDI) is an electronic communication method that provides


standards for exchanging data via any electronic means.
2. EDI implies a sequence of messages between two parties, either of whom may serve as
originator or recipient.
3. E-Commerce It refers to any form of transaction (exchange) that uses an
electronic medium to facilitate the transaction.
4. An E-card is similar to a postcard or greeting card, with the primary difference being that it is
created using digital media instead of paper or other traditional materials.
5. E-card businesses are considered environmentally friendly because their carbon footprint is
generally much lower compared to paper card companies and because paper is not used in
the end product.
6. Flash animation : This type of E-card is based on two-dimensional vector animation controlled
with a scripting language.
7. Video E-cards : use a combination of personalized text and video to convey the message to
the recipient.
8. Mobile E-cards : With the advance in mobile technologies, Multimedia Messaging Service
(MMS) which is basically picture SMS, became more and more popular.
9. Web based multi-media E-cards : The web-based card creation has been evolving becoming
more creative. The user can create greeting cards online choosing backgrounds, drag and
drop images, animations, smiles and write text that look like handwriting.
10. E-cards games : Some E-cards include interactive games.

EXERCISES
75 | P a g e
Lesson-10
Downloading/Uploading
You will learn

Downloading/Uploading Speed  Downloading/Uploadi


ng Speed
 Difference
 Example
 Concept of
Bandwidth and
protocol

Download When you connect to the internet, the download speed is the pace at which data
(websites, programmers, music etc.) is transferred from another computer to your own. Currently,
when it comes to home broadband, download speeds range from 8 Mbps to 100 Mbps

Upload speed on the other hand is the speed at which data (such as your pictures and videos) is
uploaded to the internet – perhaps to put onto a social networking site such as Facebook, or file-
sharing site such as Flickr; Essentially, the upload is going in the opposite direction to the download –
from your computer to someone else’s.

Broadband upload speeds are generally much slower than download speeds. The reason for this is
that people generally do far more downloading than uploading, and as such downloading is given
priority by internet service providers (ISPs).

81 | P a g e
Lesson-3
ADDING STYLES TO WEB PAGES
USNIG CSS
You will learn

Review of HTML
Review of HTML
World Wide Web(WWW) • World Wide Web(WWW)
• Headers
WORLD WIDE WEB –The World Wide Web is a worldwide • Body and Titles
information service on the Internet. The World Wide Web • Headings
• Paragraphs
or the Web, as it is popularly known uses special software • Tables
called a Browser (client) and TCP/IP, HTTP and a Web server • Lists
Adding Style Sheets
to function. • Setting the default style sheet
language
Headers
• Inline style information
Information placed in this section is essential to the inner • Header style information: the
“STYLE” element.
working of the document and has nothing to do with the
• Media types
content of the document. All the information placed with External Style Sheets
in the <HEAD></HEAD> tags is not displayed in the browser. • Preferred and alternate style
sheets
• Specifying
26 | Pexternal
a g e style sheets
CSS Properties-Border, box, font,
margin
CSS Classes
The HTML tags used to indicate the start and end of the head
section are:
<HEAD>
<TITLE>…. </TITLE>.
</HEAD>

Body and Titles

The tags used to indicate the start and end of the main body of textual information are :

<BODY>
……..
……..
</BODY>

A web page would have a title that describe what the page is about without being too wordy. This can
be achieved by using the TITLE tag.

<TITLE>…………………………………..</TITLE>

Headings
Paragraphs

HTML documents are divided into paragraphs. Paragraphs are defined with the <p> tag.

<p>This is a paragraph</p>
<p>This is another paragraph</p>

Tables

Tables are defined with the <table> tag.

• A table is divided into rows with the <tr> tag. (tr stands for table row)
• A row is divided into data cells with the <td> tag. (td stands for table data)
• A row can also be divided into headings with the <th> tag. (th stands for table
heading)
• The <td> elements are the data containers in the table.
• The <td> elements can contain all sorts of HTML elements like text, images, lists,
other tables, etc.

The width of a table can be defined using CSS.


27 | P a g e
<table style="width:300px">
<tr>
<th>First</th>
<th>Last</th>
<th>Points</th>
</tr>
<tr>
<td>Vikram</td>
<td>Vats</td>
<td>98</td>
</tr>

<tr>
<td>Rajesh</td>

<td>Singh</td>
<td>60</td>

</tr>

</table>

First Name Last Name Points

Vikram Vats 98

Rajesh Singh 60

Lists
The most common HTML lists are ordered and unordered lists:

An ordered list: An unordered list:

1. The first list item • List item


2. The second list item • List item
3. The third list item • List item

HTML Ordered Lists

28 | P a g e
An ordered list starts with the <OL> tag. Each list item starts with the <LI> tag. The list items are
marked with numbers.

<OL>
<LI>Coffee</LI>
<LI>Milk</LI>
</OL>

How the HTML code above looks in a browser:

1. Coffee
2. Milk

HTML Unordered Lists

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items are
marked with bullets (typically small black circles).

<UL>
<LI>Coffee</LI>
<LI>Milk</LI>
</UL>

How the HTML code above looks in a browser:

• Coffee
• Milk

HTML Description Lists


A description list is a list of terms/names, with a description of each term/name.
The <dl> tag defines a description list.
The <dl> tag is used in conjunction with <dt> (defines terms/names) and <dd> (describes each
term/name):
<DL>
< DT>COFFEE</DT>
<DD>- BLACK HOT DRINK</DD>
<DT>MILK</DT>
<DD>- WHITE COLD DRINK</DD>
</DL>

How the HTML code above looks in a browser:

Coffee

- black hot drink


29 | P a g e
Milk

- white cold drink

Adding Style Sheets

CSS is a style sheet language used to determine the formatting of an HTML document.
Using separate style sheets for an entire site, leveraging semantic markup and identifiers like ids (for
unique page elements) and classes (for multiple, like elements) a developer can apply styles across a
whole site while updating a single (cacheable) file.

Setting the default style sheet language


We must specify the style sheet language of style information associated with an HTML document.

We should use the META element to set the default style sheet language for a document. For
example, to set the default to CSS, We should put the following declaration in the HEAD of their
documents:

<META http-equiv="Content-Style-Type" content="text/css">

The default style sheet language may also be set with HTTP headers. The above META declaration
is equivalent to the HTTP header:

Content-Style-Type: text/css

User agents should determine the default style sheet language for a document according to the following steps
(highest to lowest priority):

1. If any META declarations specify the "Content-Style-Type", the last one in the character stream
determines the default style sheet language.
2. Otherwise, if any HTTP headers specify the "Content-Style-Type", the last one in the character stream
determines the default style sheet language.
3. Otherwise, the default style sheet language is "text/css".

Documents that include elements that set the style attribute but which don't define a default style sheet
language are incorrect. Weing tools should generate default style sheet language information (typically
a META declaration) so that user agents do not have to rely on a default of "text/css".

Inline style information

Attribute definitions
style = style [CN]
This attribute specifies style information for the current element.
30 | P a g e
The syntax of the value of the style attribute is determined by the default style sheet language

This CSS example sets color and font size information for the text in a specific paragraph.

<P style="font-size: 12pt; color: fuchsia">Aren't style sheets wonderful?

In CSS, property declarations have the form "name: value" and are separated by a semi-colon.
To specify style information for more than one element, we should use the STYLE element

<body>
<h1 >My First CSS Example</h1>
<p>This is a paragraph.</p>
</body>
</html>

Header style information: the “STYLE” element.

Using a <style> element in the HTML <head> section

31 | P a g e
<HEAD>

<STYLE type="text/css" media="projection">


H1 { color: blue}
</STYLE>

<STYLE type="text/css" media="print">


H1 { text-align: center }
</STYLE>

32 | P a g e
Example of Inline CSS
<html>
<head>
<style>
body { background-color: #d0e4fe;}
h1 {
color: orange;
text-align: center;
font-size: 80px;
}
p{
font-family: "Times New Roman";
font-size: 20px;
border: thick dashed blue;
}
</style>
</head>

Example of Inline CSS

<html>
<body>
<h1 style="color:Blue” >This is a Blue Heading</h1>
<p style="background:#ccc; color:#fff; border: solid black 1px;">This is a Paragraph</p>
<p style="font-size:large;line-height:1.2em;color:#ff9900">This text has been styled using inline style
sheets.</p>
<h1 ALIGN="center" STYLE="background: #000080; font: 36pt/40pt courier; font-variant: small-caps;
border: thick dashed blue">Welcome to my home page!</h1>
</body>
</html>

33 | P a g e
Media types
HTML allows We to design documents that take advantage of the characteristics of the media where
the document is to be rendered (e.g., graphical displays, television screens, handheld devices,
speech-based browsers, braille-based tactile devices, etc.). By specifying the media attribute, We
allow user agents to load and apply style sheets selectively. Please consult the list of recognized
media.

The following sample declarations apply to H1 elements. When projected in a business meeting, all
instances will be blue. When printed, all instances will be centered.

External Style Sheets

We may separate style sheets from HTML documents. This offers several benefits:

• We and Web site managers may share style sheets across a number of documents (and sites).
• We may change the style sheet without requiring modifications to the document.
• User agents may load style sheets selectively (based on media descriptions).

Preferred and alternate style sheets

HTML allows We to associate any number of external style sheets with a document. The style sheet
language defines how multiple external style sheets interact (for example, the CSS "cascade" rules).

• We may specify a number of mutually exclusive style sheets called alternate style
sheets. Users may select their favorite among these depending on their preferences. For
instance, user may specify one style sheet designed for small screens and another for users
with weak vision (e.g., large fonts). User agents should allow users to select from alternate
style sheets.
• We may group several alternate style sheets (including the user's preferred style sheets) under
a single style name. When a user selects a named style, the user agent must apply all style
sheets with that name.
• We may also specify persistent style sheets that user agents must apply in addition to any
alternate style sheet.
• User agents must respect media descriptors when applying any style sheet.
• User agents should also allow users to disable the user’s style sheets entirely, in which case
the user agent must not apply any persistent or alternate style sheets.

34 | P a g e
Specifying external style sheets

We specify external style sheets with the following attributes of the LINK element:
• Set the value of href to the location of the style sheet file. The value of href is a URI.
• Set the value of the type attribute to indicate the language of the linked (style sheet) resource.
• Specify that the style sheet is persistent, preferred, or alternate:
o To make a style sheet persistent, set the rel attribute to "stylesheet" and don't set the title attribute.
o To make a style sheet preferred, set the rel attribute to "stylesheet" and name the style sheet with
the title attribute.
o To specify an alternate style sheet, set the rel attribute to "alternate stylesheet" and name the style

Example of External CSS


1: Create a folder
2: Create a text document and type the CSS code and save it as mystyle.css
body { background-color: #d0e4fe;}
h1 {
color: orange;
text-align: center;
font-size: 80px;
}
p{
font-family: "Times New Roman";
font-size: 20px;
border: thick dashed blue;
}

sheet with the title attribute.

35 | P a g e
Example of External CSS

3: Create another text document and type the html code below and save it as webpage.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>The style of this document is a combination of an external stylesheet, and internal style</p>
</body>
</html>

In this example, we first specify a persistent style sheet located in the file mystyle.css:

<LINK href="mystyle.css" rel="stylesheet" type="text/css">

Setting the title attribute makes this the user's preferred style sheet:

<LINK href="mystyle.css" title="compact" rel="stylesheet" type="text/css">

Adding the keyword "alternate" to the rel attribute makes it an alternate style sheet:

<LINK href="mystyle.css" title="Medium" rel="alternate stylesheet" type="text/css">

If the CSS file is not in the same directory, you can also specify its absolute path:

<LINK href=”D:\New folder\mystyle.css" rel="stylesheet" type="text/css">

Properties-Border, box, font, margin

Cascading style sheet languages such as CSS allow style information from several sources to be
blended together. However, not all style sheet languages support cascading. To define a cascade,
authors specify a sequence of LINK and/or STYLE elements. The style information is cascaded in the
order the elements appear in the HEAD.

36 | P a g e
CSS Font - CSS font properties define the font family, boldness, size, and the style of a text.
font-family:"Times New Roman", Times, serif;

CSS Borders - you can create rounded borders, add shadow to boxes, and use an image as a
border - without using a design program, like Photoshop.

div
{
border:2px solid;
border-radius:25px;
}

CSS Classes

The id and class Selectors


In addition to setting a style for a HTML element, CSS allows you to specify your own selectors
called "id" and "class".

ID

The id selector is used to specify a style for a single, unique element.The id selector uses the id
attribute of the HTML element, and is defined with a "#".The style rule below will be applied to the
element with id="para1":

#para1
{
text-align:center;
color:red;
}

Class Selectors

The class selector is used to specify a style for a group of elements. Unlike the id selector, the class
selector is most often used on several elements..center {text-align:center;}

37 | P a g e
SUMMARY

1. The World Wide Web is a worldwide information service on the Internet.


2. The World Wide Web or the Web, as it is popularly known uses special software called a
Browser (client) and TCP/IP, HTTP and a Web server to function.
3. All the information placed with in the <HEAD></HEAD> tags is not displayed in the browser.
4. Body tag used to indicate the start and end of the main body of textual information.
5. A web page would have a title that describe what the page is about without being too wordy.
This can be achieved by using the TITLE tag.
6. HTML documents are divided into paragraphs. Paragraphs are defined with the <p> tag.
7. Tables are defined with the <table> tag.
8. A table is divided into rows with the <tr> tag. (tr stands for table row)
9. A row is divided into data cells with the <td> tag. (td stands for table data)
10. A row can also be divided into headings with the <th> tag. (th stands for table heading)
11. An ordered list starts with the <OL> tag. Each list item starts with the <LI> tag. The list items
are marked with numbers.
12. An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items
are marked with bullets (typically small black circles).

13. A description list is a list of terms/names, with a description of each term/name.


14. The <dl> tag defines a description list.The <dl> tag is used in conjunction with <dt> (defines
terms/names) and <dd> (describes each term/name)
15. CSS is a style sheet language used to determine the formatting of an HTML document.
16. To specify style information for more than one element, we should use the STYLE element.
17. The id selector is used to specify a style for a single, unique element.The id selector uses the
id attribute of the HTML element, and is defined with a "#".

38 | P a g e
Lesson-4
WEB SCRIPTING JAVA SCRIPT
Introduction and History of Java Script You will learn

JavaScript started life as Live Script, but Netscape changed the


CREATING INTERACTIVE WEBPAGES
name, possibly because of the excitement being generated by USING JAVASCRIPT
Introduction and History of
Java.to JavaScript. JavaScript is a lightweight, interpreted Java Script

programming language with object-oriented capabilities that Objectives and Propertie

allows you to build interactivity into otherwise static HTML pages. Variables & Operators

 Variable constraints,
The general-purpose core of the language has been embedded in
 Types of Operators:
logical, arithmetic,
Netscape, Internet Explorer, and other web browsers.
relational
 Decision Making using if
Client-side JavaScript is the most common form of the language. & Switch
 Iteration – Loops
The script should be included in or referenced by an HTML  Window Object
Popup Boxes – alert, confirm
document for the code to be interpreted by the browser. etc.
It means that a web page need no longer be static HTML,

but can include programs that interact with the user, control the browser, and dynamically create
HTML content.

Objectives and Properties


JavaScript is:

• JavaScript is a lightweight, interpreted programming language


• Designed for creating network-centric applications
• Complementary to and integrated with Java
• Complementary to and integrated with HTML
• Open and cross-platform

41 | P a g e
The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and
other web browsers

Advantages of JavaScript: The merits of using JavaScript are:

• Less server interaction: You can validate user input before sending the page off to the
server. This saves server traffic, which means less load on your server.
• Immediate feedback to the visitors: They do not have to wait for a page reload to see if they
have forgotten to enter something.
• Increased interactivity: You can create interfaces that react when the user hovers over them
with a mouse or activates them via the keyboard.
• Richer interfaces: You can use JavaScript to include such items as drag-and-drop
components and sliders to give a Rich Interface to your site visitors.

Limitations with JavaScript:


• We cannot treat JavaScript as a full-fledged programming language.
• Client-side JavaScript does not allow the reading or writing of files. This has been kept for
security reason.
• JavaScript cannot be used for networking applications because there is no such support
available.
• JavaScript does not have any multithreading or multiprocess capabilities.

JavaScript Syntax:
A JavaScript consists of JavaScript statements that are placed within the <script>... </script> HTML
tags in a web page.

<script language="javascript" type="text/javascript">

JavaScript code

</script>

The script tag takes two important attributes:

• Language: This attribute specifies what scripting language you are using. Typically, its value
will be JavaScript.
• Type: This attribute is what is now recommended to indicate the scripting language in use and
its value should be set to "text/javascript".

42 | P a g e
Your First JavaScript Script:
Let us write an example to print out "Hello World".

<html>

<body>

<script language="javascript" type="text/javascript">

<!--

document.write("Hello World!")

//-->

</script>
Used to write text, HTML, or both

</body>

</html>

So above code will display following result:

Hello World!

Variables & Operators


• Variable constraints,

JavaScript Data Types: One of the most fundamental characteristics of a programming language is
the set of data types it supports. These are the type of values that can be represented and
manipulated in a programming language.

JavaScript allows you to work with three primitive data types:


• Numbers eg. 123, 120.50 etc.
• Strings of text e.g. "This text string" etc.
• Boolean e.g. true or false.
Java does not make a distinction between integer values and floating-point values.

JavaScript Variables
Variable is the stored memory location that can hold a value in it. Variables are declared
with the var keyword. Storing a value in a variable is called variable initialization.

43 | P a g e
Example:

<script type="text/javascript">

<!--

var name = "Ali";

var money;

money = 2000.50;

//-->

</script>

JavaScript Variable Scope:

The scope of a variable is the region of your program in which it is defined. JavaScript variable will
have only two scopes.

• Global Variables: A global variable has global scope which means it is defined everywhere in
your JavaScript code.
• Local Variables: A local variable will be visible only within a function where it is defined.
Function parameters are always local to that function.

<script type="text/javascript">

<!--

var myVar = "global"; // Declare a global variable

function checkscope( ) {

var myVar = "local"; // Declare a local variable

document.write(myVar);

//-->
</script>

44 | P a g e
This produces the following result:

Local

JavaScript Variable Names:

While naming your variables in JavaScript keep following rules in mind.

• You should not use any of the JavaScript reserved keyword as variable name.
• JavaScript variable names should not start with a numeral (0-9). They must begin with a letter
or the underscore character.
• JavaScript variable names are case sensitive.

JavaScript Reserved Words:

The following are reserved words in JavaScript. They cannot be used as JavaScript variables,
functions, methods, loop labels, or any object names.

abstract else instanceof switch


boolean enum int synchronized
break export interface this
byte extends long throw
case false native throws
catch final new transient
char finally null true
class float package try
const for private typeof
continue function protected var
debugger goto public void
default if return volatile
delete implements short while
do import static with
double in super

45 | P a g e
• Types of Operators: logical, arithmetic, relational

Operators: An Operator is a symbol that performs an operation.


JavaScript language supports following type of operators.

• Arithmetic Operators
• Comparision Operators
• Logical (or Relational) Operators
• Assignment Operators
• Conditional (or ternary) Operators

The Arithmetic Operators:

Assume variable A holds 10 and variable B holds 20 then:

Operator Description Example

+ Adds two operands A + B will give 30

- Subtracts second operand from the first A - B will give -10

* Multiply both operands A * B will give 200

/ Divide numerator by denumerator B / A will give 2

% Modulus Operator and remainder of after an integer division B % A will give 0

++ Increment operator, increases integer value by one A++ will give 11

-- Decrement operator, decreases integer value by one A-- will give 9

46 | P a g e
The Comparison Operators:

Assume variable A holds 10 and variable B holds 20 then:

Operator Description Example

== Checks if the value of two operands are equal or not, if (A == B) is not true.
yes then condition becomes true.

!= Checks if the value of two operands are equal or not, if (A != B) is true.


values are not equal then condition becomes true.

> Checks if the value of left operand is greater than the (A > B) is not true.
value of right operand, if yes then condition becomes
true.

< Checks if the value of left operand is less than the value (A < B) is true.
of right operand, if yes then condition becomes true.

>= Checks if the value of left operand is greater than or (A >= B) is not true.
equal to the value of right operand, if yes then condition
becomes true.

<= Checks if the value of left operand is less than or equal to (A <= B) is true.
the value of right operand, if yes then condition becomes
true.

47 | P a g e
The Logical Operators:
Assume variable A holds 10 and variable B holds 20 then:

Operator Description Example

&& Called Logical AND operator. If both the operands are (A && B) is true.
non zero then then condition becomes true.

|| Called Logical OR Operator. If any of the two (A || B) is true.


operands are non zero then then condition becomes
true.

! Called Logical NOT Operator. Use to reverses the !(A && B) is false.
logical state of its operand. If a condition is true then
Logical NOT operator will make false.

The Assignment Operators:


Operator Description Example

= Simple assignment operator, Assigns values from C = A + B will assign value of A +


right side operands to left side operand B into C

+= Add AND assignment operator, It adds right operand C += A is equivalent to C = C + A


to the left operand and assign the result to left
operand

-= Subtract AND assignment operator, It subtracts right C -= A is equivalent to C = C - A


operand from the left operand and assign the result to
left operand

*= Multiply AND assignment operator, It multiplies right C *= A is equivalent to C = C * A


operand with the left operand and assign the result to
left operand

48 | P a g e
/= Divide AND assignment operator, It divides left C /= A is equivalent to C = C / A
operand with the right operand and assign the result
to left operand

%= Modulus AND assignment operator, It takes modulus C %= A is equivalent to C = C %


using two operands and assign the result to left A
operand

• Decision Making using if & Switch


if...else Statements: While writing a program, you need to make use of conditional statements that
allow your program to make correct decisions and perform right actions.

JavaScript supports following forms of if..else statement:

• if statement
• if...else statement
• if...else if... statement.

if statement:

The if statement allows JavaScript to make decisions and execute statements conditionally.

Syntax:

if (expression){
Statement(s) to be executed if expression is true
}

Example:

<script type="text/javascript">
var age = 20;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}
</script>

49 | P a g e
This will produce following result:

Qualifies for driving

if...else statement:

The if...else statement is the next form of control statement that allows JavaScript to execute
statements in more controlled way i.e to choose from given options.

Syntax:

if (expression){
Statement(s) to be executed if expression is true
}else{
Statement(s) to be executed if expression is false
}

Example:

<script type="text/javascript">
var age = 15;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}else{
document.write("<b>Does not qualify for driving</b>");
}
</script>

This will produce following result:

Does not qualify for driving

if...else if... statement:

The if...else if... statement allows JavaScript to make correct decision out of several conditions.

50 | P a g e
Syntax:
if (expression 1){
Statement(s) to be executed if expression 1 is true
}else if (expression 2){
Statement(s) to be executed if expression 2 is true
}else if (expression 3){
Statement(s) to be executed if expression 3 is true
}else{
Statement(s) to be executed if no expression is true
}
Example:

<script type="text/javascript">
var book = "maths";
if( book == "history" ){
document.write("<b>History Book</b>");
}else if( book == "maths" ){
document.write("<b>Maths Book</b>");
}else if( book == "economics" ){
document.write("<b>Economics Book</b>");
}else{
document.write("<b>Unknown Book</b>");
}
</script>

This will produce following result:

Maths Book

Switch Case: You can use multiple if...else if statements, to perform a multiway branch. However,
this is not always the best solution, especially when all of the branches depend on the value of a
single variable.

51 | P a g e
Syntax: The basic syntax of the switch statement is to give an expression to evaluate and
several different statements to execute based on the value of the expression. The interpreter checks
each case against the value of the expression until a match is found. If nothing matches, a
default condition will be used.

switch (expression)
{
case condition 1: statement(s)
break;
case condition 2: statement(s)
break;
...
case condition n: statement(s)
The break statements indicate to the
break;
interpreter the end of that particular
default: statement(s)
case. If they were omitted, the
}
interpreter would continue executing
each statement in each of the following cases.

Example: Following example illustrates a basic Switch case:

<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
switch (grade)
{
case 'A': document.write("Good job<br />");
break;
case 'B': document.write("Pretty good<br />");
break;
case 'C': document.write("Passed<br />");
break;
case 'D': document.write("Not so good<br />");
break;
case 'F': document.write("Failed<br />");
break;
default: document.write("Unknown grade<br />")

52 | P a g e
}
document.write("Exiting switch block");
</script>

This will produce following result:

Entering switch block


Good job
Exiting switch block

Example:Consider a case if you do not use break statement:

<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
switch (grade)
{
case 'A': document.write("Good job<br />");
case 'B': document.write("Pretty good<br />");
case 'C': document.write("Passed<br />");
case 'D': document.write("Not so good<br />");
case 'F': document.write("Failed<br />");
default: document.write("Unknown grade<br />")
}
document.write("Exiting switch block");
</script>

This will produce following result:

Entering switch block


Good job
Pretty good
Passed
Not so good
Failed
Unknown grade
Exiting switch block

53 | P a g e
Iteration – Loops
A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.

This not only saves you the time and trouble of repeatedly typing the same lines of code, but
also avoids typing errors in the repeated lines.

JavaScript allows you to use the for, while, and do while loops.

 For loop: Structure of a for Loop


This line determines how many times the loop will
for (initialization; test condition; iteration statement) run

JavaScript Code Here The JavaScript code for the loop will be inside the brackets here

Parts of for loop are:

1. Initialization: Here we initialize our counter to a starting value. The initialization statement is
executed before the loop begins.
2. Test condition: If condition is true then code given inside the loop will be executed otherwise
loop will come out.
3. Iteration statement: The iteration statement where you can increase or decrease your
counter.

Example: JavaScript to write a sentence to the page 5 times

<script type="text/javascript">
<!--
for (var count=1;count<6;count+=1) {

document.write("I am part of a loop!<br />");

//-->

</script>

54 | P a g e
This will produce following result:

I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!

 While loop:

syntax : initialization;

while( condition )

{ JavaScript Code Here;

Update expression;

Example:

A variable is assigned a value to count the loop


var count=1;

while (count<6) The while statement begins with a comparison

JavaScript Code Here


The count variable is adjusted so that you do not have an endless
count++; loop

Program to print 5 numbers using a basic while loop:

<script type="text/javascript">
var count = 1;
document.write("Starting Loop" + "<br />");
while (count <= 5)
{

55 | P a g e
document.write("Number : " + count + "<br />");

count++;
}
document.write("Loop stopped!");
</script>

This will produce following result:

Starting Loop
Number : 1
Number : 2
Number : 3
Number : 4
Number : 5
Loop stopped!

Window Object

Popup Boxes – alert, confirm etc.

JavaScript supports three important types of dialog boxes. These dialog boxes can be used to raise
and alert, or to get confirmation on any input or to have a kind of input from the users.

 Alert Dialog Box:

An alert dialog box is mostly used to give a warning message to the users.

<html>

<head>

<script type="text/javascript">

<!--

function Warn()

alert("This is a warning message!");

56 | P a g e
}

//-->

</script>

</head>

<body>

<p>Click the following button to see the result: </p>

<form>

<input type="button" value="Click Me" onclick="Warn();" />

</form>

</body>

</html>

Nonetheless, an alert box can still be used for friendlier messages. Alert box gives only one button
"OK" to select and proceed.

On clicking button, ‘Click Me’ an alert


window appears.

 Confirmation Dialog Box:

A confirmation dialog box is mostly used to take user's consent on any option. It displays a dialog box
with two buttons: OK and Cancel.

57 | P a g e
If the user clicks on OK button the window method confirm() will return true. If the user clicks on the
Cancel button confirm() returns false. You can use confirmation dialog box as follows:

<html>
<head>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
alert("User wants to continue!");
return true;
}else{
alert("User does not want to continue!");
return false;
}
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getConfirmation();" />
</form>
</body>
</html>

Output will appear on the screen.

On clicking button ‘Click Me’ a confirmation, dialog box appears.

58 | P a g e
 Prompt Dialog Box

The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus it
enable you to interact with the user. The user needs to fill in the field and then click OK.

This dialog box is displayed using a method called prompt() which takes two parameters (i) A label
which you want to display in the text box (ii) A default string to display in the text box.

This dialog box with two buttons: OK and Cancel. If the user clicks on OK button the window
method prompt() will return entered value from the text box. If the user clicks on the Cancel button the
window method prompt() returns null.

You can use prompt dialog box as follows:

<html>
<head>
<script type="text/javascript">

function getValue(){
var retVal = prompt("Enter your name : ", "your name here");
alert("You have entered : " + retVal );
}
</script>
</head>

<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getValue();" />
</form>
</body>
</html>

59 | P a g e
Output will appear on the screen.

On clicking button ‘Click Me’ prompt dialog box will appear on the screen.

SUMMARY

1. The general-purpose core of the language has been embedded in Netscape, Internet Explorer,
and other web browsers.
2. A JavaScript consists of JavaScript statements that are placed within the <script>... </script>
3. One of the most fundamental characteristics of a programming language is the set of data
types it supports.
4. Variable is the stored memory location that can hold a value in it. Variables are declared with
the var keyword.
5. Storing a value in a variable is called variable initialization.

6. A global variable has global scope which means it is defined everywhere in your JavaScript
code.
7. A local variable will be visible only within a function where it is defined. Function parameters are always
local to that function.
8. You should not use any of the JavaScript reserved keyword as variable name.

60 | P a g e
9. if...else Statements make use of conditional statements that allow your program to make
correct decisions and perform right actions.
10. Switch Case is one of the alternate of multiple if...else if statements.
11. A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.
12. JavaScript supports three important types of dialog boxes. These dialog boxes can be used to
raise and alert, or to get confirmation on any input or to have a kind of input from the users.

13. An alert dialog box is mostly used to give a warning message to the users.

14. A confirmation dialog box is mostly used to take user's consent on any option. It displays a
dialog box with two buttons: OK and Cancel.
15. The prompt dialog box is very useful when you want to pop-up a text box to get user input.
Thus it enable you to interact with the user. The user needs to fill in the field and then click OK.

EXERCISES

A. Fill in the blanks


i. JavaScript is a lightweight, ______________programing language.
ii. JavaScript is Open and _________________.
iii. JavaScript does not have any ___________ or _____________.
iv. Java Script Consists of JavaScript statements that are placed within __________ HTML
tags in a web page.
v. Scripts tag has two attributes___________ and ______________.
vi. Variables are declared with the __________ keyboard.
vii. ____________ can not be used as JavaScript variables, functions, methods.
viii. Switch case is one of the alternate form of________________.
ix. The ______________ statement indicates to the interpreter the end of the particular
case.
x. A loop is a block of code that allows you to __________ a section of code.
61 | P a g e
Lesson-5
DATABASE CONCEPTS- RDBMS

You will learn


Basics of RDBMS
Basics of RDBMS
 Purpose
Database Management System or DBMS in short, refers to the
 Data Models
technology of storing and retrieving user’s data with utmost  Relational Model
efficiency along with safety and security features. DBMS allows Data Definition Language
 Creating Database and
its users to create their own databases, which are relevant with
Tables
the nature of work they want. These databases are highly  Creating Views
configurable and offers bunch of options. Data Manipulation Language
 Data input, modify, display
& deleting in tables
Database is collection of data, which is related by some  Ordering & grouping
aspect. Data is collection of facts and figures which can be Operating with multiple tables
Union
processed to produce information. Name of a student, age, class Join
and her subjects can be counted as data for recording purposes.

Mostly data represents recordable facts. Data aids in


producing information, which is based on facts. For example,
if we have data about marks obtained by all students, we can
then conclude about toppers and average marks etc.

63 | P a g e
A database management system stores data, in such a way,
which is easier to retrieve, manipulate and helps to produce
information.

Users
DBMS is used by various users for various purposes. Some may involve in retrieving data and some
may involve in backing it up. Some of them are described as follows:

Administrators: A bunch of users maintain the DBMS and are responsible for administrating the
database. They are responsible to look after its usage and by whom it should be used.

Designer: This is the group of people who actually works on designing part of database. The actual
database is started with requirement analysis followed by a good designing process.

End Users: This group contains the persons who actually take advantage of database system. End
users can be just viewers who pay attention to the logs or market rates or end users can be as
sophisticated as business analysts who take the most of it.

Purpose of RDBMS:
A relational database will allow you to store data organized such that you can store your information
in tables, organized by rows (records) and columns (fields) which you can then store and access as
required.

64 | P a g e
The features of a relational database is storage minimization - you, as a DB designer try and
use the least storage that you can and still be able to access the data efficiently.

If you then need to retrieve any data, you would 'query' the database (ask it) if record exists in
the database or not. This interaction is done via SQL - Structured Query Language - to get the
records (rows) that you need.

By utilizing a well-structured database, you can store a lot of information and retrieve it quickly.

Data Models

Data model tells how the logical structure of a database is modeled. Data Models are fundamental
entities to introduce abstraction in DBMS. Data models define how data is connected to each other
and how it will be processed and stored inside the system.

The very first data model could be flat data-models where all the data used to be kept in same plane.
Because earlier data models were not so scientific, they were prone to introduce lots of duplication
and update anomalies.

1. Hierarchical Model: The hierarchical data model organizes data in a tree structure.

2. Network Model: Some data were more naturally modeled with more than one parent per child.
Therefore, the network model permitted the modeling of many-to-many relationships in data.

3. Object-Oriented Model: Object DBMSs add database functionality to object programming


languages.

Relational Model
The most popular data model in DBMS is Relational Model. It is more
scientific model then others. This model is based on first-order
predicate logic and defines table as an n-any relation.

Concepts

65 | P a g e
Tables: In relation data model, relations are saved in the format of Tables. This format stores the
relation among entities. A table has rows and columns, where rows represent records and columns
represents the attributes

Tuple: A single row of a table, which contains a single record for that relation, is called a tuple.

Relation instance: A finite set of tuples in the relational database system represents relation
instance. Relation instances do not have duplicate tuples.

Relation schema: This describes the relation name (table name), attributes and their names.

Relation key: Each row has one or more attributes, which can identify the row in the relation (table)
uniquely, is called the relation key.

Attribute domain: Every attribute has some pre-defined value scope, known as attribute domain.

The main highlights of this model are:

• Data is stored in tables called relations.


• Relations can be normalized.
• In normalized relations, values saved are atomic values.
• Each row in relation contains unique value
• Each column in relation contains values from a same domain.

Data Definition Language


Data Definition Language (DDL) statements are used to define the database structure. Some
examples:

• CREATE - to create objects in the database


• ALTER - alters the structure of the database
• DROP - delete objects from the database
• TRUNCATE - remove all records from a table, including all spaces allocated for the records
are removed
• COMMENT - add comments to the data dictionary
• RENAME - rename an object

Create database: The CREATE DATABASE statement is used to create a database.

Syntax: CREATE DATABASE your_name;

Create Table: The CREATE TABLE statement is used to create a table in a database.

Tables are organized into rows and columns and each table must have a name.

66 | P a g e
CREATE TABLE Student
(
RollNo int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);

Creating Views: A view is a virtual table. A view can contain all rows of a table or select rows from a
table. A view comes from one or more tables or just a part of table.

Database views are created using the CREATE VIEW statement. Views can be created from a single
table, multiple tables, or another view.

To create a view, a user must have the appropriate system privilege according to the specific
implementation.

Consider the CUSTOMERS table having the following records:

+----+------------+--------+----------------+--------------+
| ID | NAME | AGE | ADDRESS | SALARY |
+----+------------+------ +-----------------+--------------+
|1 |Ramesh |32 |Ahmedabad |2000.00 |
|2 |Khilan |25 |Delhi |1500.00 |
|3 | kaushik |23 |Kota |2000.00 |
|4 |Chaitali |25 |Mumbai |6500.00 |
|5 |Hardik |27 |Bhopal |8500.00 |
|6 |Komal |22 | MP |4500.00 |
|7 |Muffy |24 |Indore |10000.00 |
+----+-----------+---------+----------------+--------------+

Now, following is the example to create a view from CUSTOMERS table. This view would be used to
have customer name and age from CUSTOMERS table:

SQL > CREATE VIEW CUSTOMERS_VIEW AS

SELECT name, age FROM CUSTOMERS;

Now, you can query CUSTOMERS_VIEW in similar way as you query an actual table.

Following is the example:


67 | P a g e
SQL > SELECT * FROM CUSTOMERS_VIEW;

This would produce the following result:

Data Manipulation Language

Data Manipulation Language (DML) statements are used for managing data within schema objects.
Some examples:

• SELECT - retrieve data from the a database


• INSERT - insert data into a table
• UPDATE - updates existing data within a table
• DELETE - deletes all records from a table, the space for the records remain
• MERGE - UPSERT operation (insert or update)

SQL SELECT Syntax

SELECT column_name,column_name OR SELECT * FROM table_name;


FROM table_name;

SQL INSERT INTO Syntax


INSERT INTO table_name (column1,column2, column3,...)
VALUES (value1,value2,value3,...);

SQL UPDATE Syntax


UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;

68 | P a g e
SQL DELETE Syntax
DELETE FROM table_name
WHERE some_column=some_value;

Ordering & grouping


The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set
by one or more columns.

Syntax
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name;

Example:
SELECT ZIP
FROM Customers
GROUP BY ZIP

ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set by one or more columns. The ORDER BY
keyword sorts the records in ascending order by default. To sort the records in a descending order,
you can use the DESC keyword.

SQL ORDER BY Syntax


SELECT column_name,column_name
FROM table_name
ORDER BY column_name,column_name ;

Operating with multiple tables.

Union

The SQL UNION query is a SQL query to combine the result sets of 2 or more SQL SELECT
statements. It removes duplicate rows between the various SELECT statements.

The following is an example of the SQL UNION query that returns one field from multiple SELECT
statements (and both fields have the same data type):

69 | P a g e
SELECT supplier_id
FROM suppliers
UNION
SELECT supplier_id
FROM orders;

Join

SQL JOINS are used in a SQL query to retrieve data from multiple tables. A SQL JOIN is performed
whenever two or more tables are joined in a SQL statement. There are 4 different types of SQL joins:

• SQL INNER JOIN (or sometimes called simple join)


• SQL LEFT OUTER JOIN (or sometimes called LEFT JOIN)
• SQL RIGHT OUTER JOIN (or sometimes called RIGHT JOIN)
• SQL FULL OUTER JOIN (or sometimes called FULL JOIN)

SUMMARY
1. Database Management System or DBMS in short, refers to the technology of storing and
retrieving user’s data with utmost efficiency along with safety and security features.
2. Database is collection of data, which is related by some aspect. Data is collection of facts and
figures which can be processed to produce information.
3. DBMS is used by various users for various purposes. Some may involve in retrieving data and
some may involve in backing it up.
4. Administrators: A bunch of users maintain the DBMS and are responsible for administrating
the database. They are responsible to look after its usage and by whom it should be used.
5. Designer: This is the group of people who actually works on designing part of database. The
actual database is started with requirement analysis followed by a good designing process.
6. End Users: This group contains the persons who actually take advantage of database system.
End users can be just viewers who pay attention to the logs or market rates or end users can
be as sophisticated as business analysts who take the most of it.
7. A relational database will allow you to store data organized such that you can store your
information in tables, organized by rows (records) and columns (fields) which you can then
store and access as required.

70 | P a g e
8. Data model tells how the logical structure of a database is modeled. Data Models are
fundamental entities to introduce abstraction in DBMS.
9. The hierarchical data model organizes data in a tree structure.
10. Some data were more naturally modeled with more than one parent per child. Therefore, the
network model permitted the modeling of many-to-many relationships in data.
11. The most popular data model in DBMS is Relational Model. It is more scientific model then
others. This model is based on first-order predicate logic and defines table as an n-any
relation.
12. A table has rows and columns, where rows represent records and columns represents the
attributes
13. Tuple: A single row of a table, which contains a single record for that relation, is called a tuple.
14. Relation instance is a finite set of tuples in the relational database system represents relation
instance.
15. Relation schema describes the relation name (table name), attributes and their names.

16. Data Definition Language (DDL) statements are used to define the database structure.
17. The CREATE DATABASE statement is used to create a database.

18. The CREATE TABLE statement is used to create a table in a database.


19. A view is a virtual table. A view can contain all rows of a table or select rows from a table.
20. DML statements are used for managing data within schema objects.

21. The GROUP BY statement is used in conjunction with the aggregate functions to group the
result-set by one or more columns.
22. The ORDER BY keyword is used to sort the result-set by one or more columns.
23. The SQL UNION query is a SQL query to combine the result sets of 2 or more SQL SELECT
statements. It removes duplicate rows between the various SELECT statements.
24. SQL JOINS are used in a SQL query to retrieve data from multiple tables. A SQL JOIN is
performed whenever two or more tables are joined in a SQL statement.

EXERCISES

71 | P a g e
Lesson-6
NETWORK SAFETY OF
COMPUTER SYSTEM
You will learn
Network Safety and Security
Network Safety Network Safety
Social Networking Ethics
Network safety consists of the provisions and policies adopted by Network Security Tools And
Services
a network administrator to prevent and monitor unauthorized
 Tools
access, misuse, modification, or denial of a computer network  LAN Management
and network-accessible resources. Network security involves the  MAN Management
 WAN Management
authorization of access to data in a network, which is controlled
 PAN Management
by the network administrator. Users choose or are assigned an ID  VOIP
and password or other authenticating information that allows them Cyber Security
 need
74 | P a g e
 Objectives
Social Networking Various
Practices
access to information and programs within their authority.

Social Networking Ethics


1. Under no circumstances should a post be threatening,
harassing, bullying, pornographic, racist, homophobic,
or libellous.
2. Practice respectful conversation: No obscenities, personal attacks, name-calling, accusations,
defamation, or hate speech.
3. Refrain from posting comments, images, or links not directly related to the content of the forum.
4. Do not post:
• Intentionally misleading or inaccurate information.
• Contact information or identifying details, such as phone numbers or e-mail
addresses.
• Information related to advertising, promotion, job recruiting, and campaigning,
lobbying, spam, soliciting, or proselytizing.
5. Do not post anything while posing as someone else.
6. Do not infringe on the copyright of others.

Network Security Tools and Services


Tools

This concise, high-end guide shows experienced administrators how to customize and extend popular
open source security tools such as port scanners, packet injectors, network sniffers, and web
assessment tools. Network security tools are used to lock down the network for safety.

LAN Management

A local area network (LAN) is a computer network that interconnects computers in a limited area such
defining characteristics of LANs, in contrast to wide area network (WANs), include their smaller
geographic area.Token ring and other technology standards have been used in the past, but
Ethernet over twisted pair cabling and Wi- Fi are the two most common technologies currently used to
build LANs.as a home, school, computer laboratory, or office building using network media.

MAN Management

A Metropolitan Area Network(MAN) is a computer network in which two or more computers or


communicating devices or networks which are geographically separated but in same metropolitan city
and are connected to each other are said to be connected on MAN. Metropolitan limits are

75 | P a g e
determined by local municipal corporations; the larger the city, the bigger the MAN, the smaller a
metro city, smaller the MAN

WAN Management

A wide area network (WAN) is a network that covers a broad area (i.e., any telecommunication
network that links across metropolitan, regional, or national boundaries) using private
or public network transports. Business and government entities utilize WANs to relay data among
employees, clients, buyers, and suppliers from various geographical locations. In essence, this mode
of telecommunication allows a business to effectively carry out its daily function regardless of
location. The Internet can be considered a WAN as well, and is used by businesses, governments,
organizations, and individuals.

PAN management

A PAN(Personal Area Network) is a network of Communicating devices (Computer, Phone, MP3/MP4


Player, Camera etc.) in the proximity of an individual. It can cover an area of a few meters
radius.When you have to transfer songs from one cell phone to another, you set up a PAN of two

phones. When files are transferred from a PC to an MP3 player, a PAN is set up between the two.
There can also be multiple devices in PAN. A PAN can be set up using guided media (USB cable) or
unguided media (Bluetooth, Infrared).

VOIP

Voice over Internet Protocol (VoIP) is a methodology and group of technologies for the delivery
of voice communications and multimedia sessions over Internet Protocol (IP) networks, such as the
Internet. Early providers of voice over IP services offered business models and technical solutions
that mirrored the architecture of the legacy telephone network. Second-generation providers, such as
Skype have built closed networks for private user bases, offering the benefit of free calls and
convenience while potentially charging for access to other communication networks.

Cyber Security

Cyber security is information security applied to computers and computer network. The field covers all
the processes and mechanisms by which computer-based equipment, information and services are
protected from unintended or unauthorized access, change or destruction. Cyber security also
includes protection from unplanned events and natural disasters.

Need: Governments, military, corporations, financial institutions, hospitals and other businesses
collect, process and store confidential information on computers and transmit that data across
networks to other computers. With the growing volume and sophistication of cyber-attacks, ongoing

76 | P a g e
attention is required to protect sensitive business and personal information, as well as safeguard
national security. So to secure all crucial and confidential data cyber security is required.

Objectives Cyber Security’s main purpose is to secure the data and maintain confidentiality of any
information stored in computer. It is use to secures the network, as well as protect and oversee
operations being done.

Social Networking Practices


To practice safely on Social networking sites few things are important to keep in mind, such
as:-
1. Never open random link or any link sends by unknown person.
2. Never trust any messages on your social network website or e-mail.
3. Always keep your personal information secure by private settings.
4. Try to avoid uploading any private information, picture or video.
5. Change use password after an interval.
6. Avoid opening your social network website or email id on unknown system.

New emerging trends


Mobile Computing

Mobile computing is human–computer interaction by which a computer is expected to be transported


during normal usage. Mobile computing involves mobile communication, mobile hardware, and
mobile software. Communication issues include ad hoc and infrastructure networks as well as
communication properties, protocols, data formats and concrete technologies. Hardware includes
mobile devices or device components. Mobile software deals with the characteristics and
requirements of mobile applications.

Cloud Computing

Cloud computing enables companies to consume compute resources as a utility just like electricity --
rather than having to build and maintain computing infrastructures in-house.

Cloud computing promises several attractive benefits for businesses and end users including:

77 | P a g e
• Self-service provisioning: End users can spin up computing resources for almost any type of
workload on-demand.
• Elasticity: Companies can scale up as computing needs increase and then scale down again
as demands decrease.
• Pay per use: Computing resources are measured at a granular level, allowing users to pay
only for the resources and workloads they use.

Cloud computing services can be private, public or hybrid.

SUMMARY

1. Network safety consists of the provisions and policies adopted by a network administrator to
prevent and monitor unauthorized access, misuse, modification, or denial of a computer
network and network-accessible resources.
2. A local area network (LAN) is a computer network that interconnects computers in a limited
area such defining characteristics of LANs.

3. A Metropolitan Area Network(MAN) is a computer network in which two or more computers or


communicating devices or networks which are geographically separated but in same
metropolitan city.
4. A wide area network (WAN) is a network that covers a broad area (i.e., any telecommunication
network that links across metropolitan, regional, or national boundaries) using private
or public network transports.
5. A PAN(Personal Area Network) is a network of Communicating devices (Computer, Phone,
MP3/MP4 Player, Camera etc.) in the proximity of an individual. It can cover an area of a few
meters radius.
6. Voice over Internet Protocol (VoIP) is a methodology and group of technologies for the delivery
of voice communications and multimedia sessions over Internet Protocol (IP) networks, such
as the Internet.

78 | P a g e
7. Cyber security is information security applied to computers and computer network.
8. Mobile computing is human–computer interaction by which a computer is expected to be transported
during normal usage.
9. Cloud computing enables companies to consume compute resources as a utility just like
electricity -- rather than having to build and maintain computing infrastructures in-house.

EXERCISES

A. Fill in the blank

i. ___________ interconnects in a limited area.


ii. ___________ networks are geographically separated but in same city.
iii. Cyber security is_____________ security applied to computers and computer networks.
iv. _____________ enables companies to consume compute resources as a utility just like
electricity.
v. _____________ computing is human- interaction by which a computer is expected to be
transported during normal usage.

B. Find true or false


i. MAN is a computer network covers a broad area.
ii. VOIP is a methodology and group of technologies for delivery of voice communication.
iii. Do not post anything while posing as someone else is one of the ethics of social
networking.
iv. Cyber security main purpose is to remove users who don not follows the ethics of social
networks.
v. Cloud computing services can be private, public or hybrid.

C. Short Answer Questions.


i. What is network safety?
ii. Write two ethics of Social network.
iii. Write about:
79 | P a g e
Lesson-4
Web Scripting using JavaScript
You will learn

REVIEW OF JAVA SCRIPT OF CLASS IX


REVIEW OF JAVA SCRIPT OF CLASS IX  Variables & Operators
 If & Switch
 Iteration (Loops)
Variables & Operators
 Window Object
JavaScript Data Types: One of the most fundamental  Pop – Up Boxes –Alert,
Confirm Etc.
characteristics of a programming language is the set of
data types it supports. These are the type of values that FUNCTIONS –USER DEFINED
can be represented and manipulated in a programming  Function Definition
language.  Calling a Function
 Function Parameters
 Return Statement
JavaScript allows you to work with three primitive
String Object
data types:  Syntax
• Numbers eg. 123, 120.50 etc.  String Properties
 String Methods
• Strings of text e.g. "This text string" etc.  String HTML Wrappers
Math Object 35 |
Page  Syntax
Array Properties
Array Methods
Event
What is an Event?
An click Event Type
• Boolean e.g. true or false.
Java does not make a distinction between integer
values and floating-point values.
JavaScript Variables:
Variable is the stored memory location that can
hold a value in it. Variables are declared with the var
keyword. Storing a value in a variable is called variable
initialization.

Example:
<script type="text/javascript">
<!--
var name = "Ali";
var money;
money = 2000.50;
//-->
</script>

JavaScript Variable Scope:

The scope of a variable is the region of your program in which it is defined. JavaScript variable will
have only two scopes.

• Global Variables: A global variable has global scope which means it is defined everywhere in
your JavaScript code.
• Local Variables: A local variable will be visible only within a function where it is defined.
Function parameters are always local to that function.

<script type="text/javascript">
<!--
var myVar = "global"; // Declare a global variable
function checkscope( ) {
var myVar = "local"; // Declare a local variable
document.write(myVar);
}

36 |
Page
//-->
</script>

This produces the following result: Local

JavaScript Variable Names:

While naming your variables in JavaScript keep following rules in mind.

• You should not use any of the JavaScript reserved keyword as variable name.
• JavaScript variable names should not start with a numeral (0-9). They must begin with a letter
or the underscore character.
• JavaScript variable names are case sensitive.

JavaScript Reserved Words:

The following are reserved words in JavaScript. They cannot be used as JavaScript variables,
functions, methods, loop labels, or any object names.

37 |
Page
abstract else instanceof switch
boolean enum int synchronized
break export interface this
byte extends long throw
case false native throws
catch final new transient
char finally null true
class float package try
const for private typeof
continue function protected var
debugger goto public void
default if return volatile
delete implements short while
do import static with
double in super

Types of Operators: logical, arithmetic, relational


Operators: An Operator is a symbol that performs an operation. JavaScript language supports
following type of operators.
• Arithmetic Operators
• Comparision Operators
• Logical (or Relational) Operators
• Assignment Operators
• Conditional (or ternary) Operators

The Arithmetic Operators:

Assume variable A holds 10 and variable B holds 20 then:

Operator Description Example

38 |
Page
+ Adds two operands A + B will give 30

- Subtracts second operand from the first A - B will give -10

* Multiply both operands A * B will give 200

/ Divide numerator by denumerator B / A will give 2

% Modulus Operator and remainder of after an integer division B % A will give 0

++ Increment operator, increases integer value by one A++ will give 11

-- Decrement operator, decreases integer value by one A-- will give 9

The Logical Operators:


Assume variable A holds 10 and variable B holds 20 then:

Operator Description Example

&& Called Logical AND operator. If both the operands are (A && B) is true.
non zero then then condition becomes true.

|| Called Logical OR Operator. If any of the two (A || B) is true.


operands are non zero then then condition becomes
true.

! Called Logical NOT Operator. Use to reverses the !(A && B) is false.
logical state of its operand. If a condition is true then
Logical NOT operator will make false.

The Comparison Operators:


Assume variable A holds 10 and variable B holds 20 then:

39 |
Page
Operator Description Example

== Checks if the value of two operands are equal or not, if (A == B) is not true.
yes then condition becomes true.

!= Checks if the value of two operands are equal or not, if (A != B) is true.


values are not equal then condition becomes true.

> Checks if the value of left operand is greater than the (A > B) is not true.
value of right operand, if yes then condition becomes
true.

< Checks if the value of left operand is less than the value (A < B) is true.
of right operand, if yes then condition becomes true.

>= Checks if the value of left operand is greater than or (A >= B) is not true.
equal to the value of right operand, if yes then condition
becomes true.

<= Checks if the value of left operand is less than or equal to (A <= B) is true.
the value of right operand, if yes then condition becomes
true.

40 |
Page
The Assignment Operators:

Operator Description Example

= Simple assignment operator, Assigns values from C = A + B will assign value of A +


right side operands to left side operand B into C

+= Add AND assignment operator, It adds right operand C += A is equivalent to C = C + A


to the left operand and assign the result to left
operand

-= Subtract AND assignment operator, It subtracts right C -= A is equivalent to C = C - A


operand from the left operand and assign the result to
left operand

*= Multiply AND assignment operator, It multiplies right C *= A is equivalent to C = C * A


operand with the left operand and assign the result to
left operand

/= Divide AND assignment operator, It divides left C /= A is equivalent to C = C / A


operand with the right operand and assign the result
to left operand

%= Modulus AND assignment operator, It takes modulus C %= A is equivalent to C = C %


using two operands and assign the result to left A
operand

Decision Making using if & Switch


if...else Statements: While writing a program, you need to make use of conditional statements that
allow your program to make correct decisions and perform right actions.

JavaScript supports following forms of if..else statement:

41 |
Page
• if statement
• if...else statement
• if...else if... statement.

if statement:

The if statement allows JavaScript to make decisions and execute statements conditionally.

Syntax:

if (expression){
Statement(s) to be executed if expression is true
}

Example:

<script type="text/javascript">
var age = 20;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}
</script>

This will produce following result:

Qualifies for driving

if...else statement:

The if...else statement is the next form of control statement that allows JavaScript to execute
statements in more controlled way i.e to choose from given options.

Syntax:

if (expression){
Statement(s) to be executed if expression is true
}else{
Statement(s) to be executed if expression is false
}

42 |
Page
Example:

<script type="text/javascript">
var age = 15;
if( age > 18 ){
document.write("<b>Qualifies for driving</b>");
}else{
document.write("<b>Does not qualify for driving</b>");
}
</script>

This will produce following result:

Does not qualify for driving

if...else if... statement: The if...else if... statement allows JavaScript to make correct decision out of
several conditions.
Syntax:
if (expression 1){
Statement(s) to be executed if expression 1 is true
}else if (expression 2){
Statement(s) to be executed if expression 2 is true
}else if (expression 3){
Statement(s) to be executed if expression 3 is true
}else{
Statement(s) to be executed if no expression is true
}
Example:

<script type="text/javascript">
var book = "maths";
if( book == "history" ){
document.write("<b>History Book</b>");
}else if( book == "maths" ){
document.write("<b>Maths Book</b>");
}else if( book == "economics" ){
document.write("<b>Economics Book</b>");
}else{
document.write("<b>Unknown Book</b>");
}
43 |
Page
</script>

This will produce following result:

Maths Book

Switch Case: You can use multiple if...else if statements, to perform a multiway branch. However,
this is not always the best solution, especially when all of the branches depend on the value of a
single variable.
Syntax:The basic syntax of the switch statement is to give an expression to evaluate and several
different statements to execute based on the value of the
expression. The interpreter checks each case against the switch (expression)
value of the expression until a match is found. If nothing {
matches, a default condition will be used. case condition 1: statement(s)
The break statements indicate to the interpreter the break;
end of that particular case. If they were omitted, the case condition 2: statement(s)

interpreter would continue executing each statement in each break;

of the following cases. ...


case condition n: statement(s)
break;
default: statement(s)
}

Example: Following example illustrates a basic Switch case:

<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");

44 |
Page
switch (grade)
{
case 'A': document.write("Good job<br />");
break;

case 'B': document.write("Pretty good<br />");


break;
case 'C': document.write("Passed<br />");
break;
case 'D': document.write("Not so good<br />");
break;
case 'F': document.write("Failed<br />");
break;
default: document.write("Unknown grade<br />")
}
document.write("Exiting switch block");
</script>

This will produce following result:

Entering switch block


Good job
Exiting switch block

Example:Consider a case if you do not use break statement:

<script type="text/javascript">
var grade='A';
document.write("Entering switch block<br />");
switch (grade)
{
case 'A': document.write("Good job<br />");
case 'B': document.write("Pretty good<br />");
case 'C': document.write("Passed<br />");
case 'D': document.write("Not so good<br />");
case 'F': document.write("Failed<br />");
default: document.write("Unknown grade<br />")
}
document.write("Exiting switch block");
</script>

45 |
Page
This will produce following result:

Entering switch block


Good job
Pretty good
Passed
Not so good
Failed
Unknown grade
Exiting switch block

Iteration – Loops
A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.

This not only saves you the time and trouble of repeatedly typing the same lines of code, but also
avoids typing errors in the repeated lines.

JavaScript allows you to use the for, while, and do while loops.

 For loop: Structure of a for Loop


for (initialization; test condition; iteration statement) This line determines how many times the loop will
run
{

JavaScript Code Here The JavaScript code for the loop will be inside the brackets here

Parts of for loop are:

1. Initialization: Here we initialize our counter to a starting value. The initialization statement is
executed before the loop begins.
2. Test condition: If condition is true then code given inside the loop will be executed otherwise
loop will come out.
46 |
Page
3. Iteration statement: The iteration statement where you can increase or decrease your
counter.

Example: JavaScript to write a sentence to the page 5 times

<script type="text/javascript">
<!--
for (var count=1;count<6;count+=1) {
document.write("I am part of a loop!<br />");
}
//-->
</script>

This will produce following result:

I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!
I am part of a loop!

 While loop:
syntax : initialization;

while( condition )

{ JavaScript Code Here;

Update expression;

Example:

A variable is assigned a value to count the loop


var count=1;
47 |
Page The while statement begins with a comparison

The count variable is adjusted so that you do not have an endless


loop
while (count<6)

JavaScript Code Here

count++;

Program to print
5 numbers using
a <script type="text/javascript"> basic while
var count = 1;
loop:
document.write("Starting Loop" + "<br />");
while (count <= 5)
{
document.write("Number : " + count + "<br />");
count++;
}
document.write("Loop stopped!");
</script>

This will produce following result:

Starting Loop
Number : 1
Number : 2
Number : 3
Number : 4
Number : 5
Loop stopped!

Window Object
The window object represents an open window in a browser.

If a document contain frames (<iframe> tags), the browser creates one window object for the HTML
document, and one additional window object for each frame.
48 |
Page
Some common Window Object Methods:

alert() Displays an alert box with a message and an OK button

blur() Removes focus from the current window

close() Closes the current window

confirm() Displays a dialog box with a message and an OK and a Cancel button

focus() Sets focus to the current window

getSelection() Returns a Selection object representing the range of text selected by the user

moveTo() Moves a window to the specified position

open() Opens a new browser window

print() Prints the content of the current window

prompt() Displays a dialog box that prompts the visitor for input

resizeBy() Resizes the window by the specified pixels

scrollBy() Scrolls the document by the specified number of pixels

stop() Stops the window from loading

Popup Boxes – alert, confirm etc.

JavaScript supports three important types of dialog boxes. These dialog boxes can be used to raise
and alert, or to get confirmation on any input or to have a kind of input from the users.

 Alert Dialog Box:

An alert dialog box is mostly used to give a warning message to the users.

<html>
<head>
<script type="text/javascript">
<!--
function Warn()

49 |
Page
{
alert("This is a warning message!");
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="Warn();" />
</form>
</body>
</html>

Nonetheless, an alert box can still be used for friendlier messages. Alert box gives only one button
"OK" to select and proceed.

On clicking button, ‘Click Me’ an alert


window appears.

 Confirmation Dialog Box:

A confirmation dialog box is mostly used to take user's consent on any option. It displays a dialog box
with two buttons: OK and Cancel.

If the user clicks on OK button the window method confirm() will return true. If the user clicks on the
Cancel button confirm() returns false. You can use confirmation dialog box as follows:

50 |
Page
<html>
<head>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
alert("User wants to continue!");
return true;
}else{
alert("User does not want to continue!");
return false;
}
}
//-->
</script>

</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getConfirmation();" />
</form>
</body>
</html>

Output will appear on the screen.

On clicking button ‘Click Me’ a confirmation, dialog


box appears.

 Prompt Dialog Box


51 |
Page
The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus it
enable you to interact with the user. The user needs to fill in the field and then click OK.

This dialog box is displayed using a method called prompt() which takes two parameters (i) A label
which you want to display in the text box (ii) A default string to display in the text box.

This dialog box with two buttons: OK and Cancel. If the user clicks on OK button the window
method prompt() will return entered value from the text box. If the user clicks on the Cancel button the
window method prompt() returns null.

You can use prompt dialog box as follows:

<html>
<head>
<script type="text/javascript">

function getValue(){

var retVal = prompt("Enter your name : ", "your name here");


alert("You have entered : " + retVal );
}
</script>
</head>

<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="getValue();" />
</form>
</body>
</html>

Output will appear on the screen.

On clicking button ‘Click Me’ prompt dialog box will appear on the screen.

52 |
Page
FUNCTIONS –USER DEFINED

A function is a group of reusable code which can be called anywhere in your programme. This
eliminates the need of writing same code again and again. This will help programmers to write
modular code. You can divide your big programme in a number of small and manageable functions.

Function Definition:

The most common way to define a function in JavaScript is by using the function keyword, followed
by a unique function name, a list of parameters (that might be empty), and a statement block
surrounded by curly braces.
The basic syntax is
shown here:

Example:

A simple function that takes no parameters called sayHello is defined here:

53 |
Page
<script type="text/javascript">
<!--
function sayHello()
{
alert("Hello there");
}
//-->
</script>

Calling a Function:

To invoke a function , you would simple need to write the name of that function as follows:

<script type="text/javascript">

<!--

sayHello();

//-->

</script>

Function Parameters:
We can pass different parameters while calling a function. These passed parameters can be captured
inside the function and any manipulation can be done over those parameters.
A function can take multiple parameters separated by comma.

Example: Let us do a bit modification in our sayHello function. This time it will take two parameters:

<script type="text/javascript">
<!--
function sayHello(name, age)
{
alert( name + " is " + age + " years old.");
}
//-->
</script>

54 |
Page
Note: We are using + operator to concatenate string and number all together. JavaScript does not
mind in adding numbers into strings.Now we can call this function as follows:

<script type="text/javascript">
<!--
sayHello('Zara', 7 );
//-->
</script>

The return Statement

A JavaScript function can have an optional return statement. This is required if you want to return a
value from a function. This statement should be the last statement in a function.

For example you can pass two numbers in a function and then you can expect from the function to
return their multiplication in your calling program.

Example:

This function takes two parameters and concatenates them and return resultant in the calling
program:

<script type="text/javascript">
<!--
function concatenate(first, last)
{

var full;

full = first + last;


return full;
}
//-->
</script>

Now we can call this function as follows:

<script type="text/javascript">
<!--
var result;

55 |
Page
result = concatenate('Zara', 'Ali');
alert(result );
//-->
</script>

String Object

JavaScript is an Object Oriented Programming (OOP) language. A programming language can be


called object-oriented if it provides four basic capabilities to developers:

• Encapsulation . the capability to store related information, whether data or methods, together in
an object
• Aggregation . the capability to store one object inside of another object
• Inheritance . the capability of a class to rely upon another class (or number of classes) for use
of its properties and methods
• Polymorphism . the capability to write one function or method that works in a variety of different
ways

The String object let's you work with a series of characters and wraps Javascript's string primitive
data type with a number of helper methods.

Syntax : var val = new String(string)

Example:
var guitar_string = new String("Gagan");

OR

var val = string;


Example:
var s1= “Gagan”;

String Properties

Here is a list of each property and their description.

Property Description

length Returns the length of the string.

56 |
Page
EXAMPLE:

<body>

<script type="text/javascript">

var myname="John";

document.write("The name has "+myname.length+" characters.");

</script>

</body>

Result is :

The name has 4 characters.

String Methods

Here is a list of each method and its description.

Method Description

charAt() Returns the character at the specified index.

concat() Combines the text of two strings and returns a new


string.

substr() Returns the characters in a string beginning at the

57 |
Page
specified location through the specified number of
characters.

substring() Returns the characters in a string between two


indexes into the string.

toLowerCase() Returns the calling string value converted to lower


case.

toString() Returns a string representing the specified object.

toUpperCase() Returns the calling string value converted to


uppercase.

Example:

var str1= new String("Gagan");


var str2 = new String("Sagan");
document .write(concat(str1,str2));

Result is : GaganSagan

String HTML Wrappers

Here is a list of each method, which returns a copy of the string wrapped inside the appropriate HTML
tag.

Method Description

big() Creates a string to be displayed in a big font as if it were in a <big> tag.

58 |
Page
blink() Creates a string to blink as if it were in a <blink> tag.

bold() Creates a string to be displayed as bold as if it were in a <b> tag.

fontcolor() Causes a string to be displayed in the specified color as if it were in a <font


color="color"> tag.

fontsize() Causes a string to be displayed in the specified font size as if it were in a <font
size="size"> tag.

italics() Causes a string to be italic, as if it were in an <i> tag.

link() Creates an HTML hypertext link that requests another URL.

small() Causes a string to be displayed in a small font, as if it were in a <small> tag.

strike() Causes a string to be displayed as struck-out text, as if it were in a <strike> tag.

Example:
var text = "I am so mad I am red!";
document.write(text.fontcolor("red"));

This script places the following code into the page source:
<font color="red">I am so mad I am red!</font>

Result is: I am so mad I am red!

Math Object

The math object provides you properties and methods for mathematical constants and functions.

Syntax

var variablename = mathfunction;

Example:
59 |
Page
var pi_val = Math.PI; // pi_val =3.14159
var sq = Math.SQRT2; // sq = 1.414

Math Properties

Here is a list of each property and their description.

Property Description

PI Ratio of the circumference of a circle to its diameter, approximately 3.14159.

SQRT2 Square root of 2, approximately 1.414.

Math Methods

Here is a list of each method and its description.

Method Description

abs() Returns the absolute value of a number.

max() Returns the largest of zero or more numbers.

min() Returns the smallest of zero or more numbers.

pow() Returns base to the exponent power, that is, base exponent.

random() Returns a pseudo-random number between 0 and 1.

round() Returns the value of a number rounded to the nearest integer.

sqrt() Returns the square root of a number.

Example :

60 |
Page
var num =4;
document .write(“ SQURE ROOT OF NUM = “+ sqrt(num) );

Result is : SQURE ROOT OF NUM = 2

Event

What is an Event?

An occurance of an activity is called an event.

When the page loads, that is an event. When the user clicks a button, that click, too, is an event.
Another example of events are like pressing any key, closing window, resizing window etc.

On click Event Type

This is the most frequently used event type which occurs when a user clicks mouse left button. You
can put your validation, warning etc against this event type.

Example:

<html>
<head>
<script type="text/javascript">
<!--
function sayHello() {
alert("Hello World")
}
//-->
</script>
</head>
<body>
<input type="button" onclick="sayHello()" value="Say Hello" />
</body>
</html>

This will produce following result and when you click Hello button then onclick event will occur
which will trigger sayHello() function.

On Submit Event Type

61 |
Page
Another most important event type is on submit. This event occurs when you try to submit a form. So
you can put your form validation against this event type.

Example:

<html>
<head>
<script type="text/javascript">
<!--
function validation() {
all validation goes here
.........
return either true or false
}
//-->
</script>
</head>
<body>
<form method="POST" action="t.cgi" onsubmit="return validate()">
.......
<input type="submit" value="Submit" />
</form>
</body>
</html>

On Mouseover & On Mouseout

The onmouseover event occurs when you bring your mouse over any element and theonmouseout
occurs when you take your mouse out from that element.

Example: Following example shows how a division reacts when we bring our mouse in that division:

<html>
62 |
Page
<head>
<script type="text/javascript">
<!--
function over() {
alert("Mouse Over");
}
function out() {
alert("Mouse Out");
}
//-->
</script>
</head>
<body>
<div onmouseover="over()" onmouseout="out()">
<h2> This is inside the division </h2>
</div>
</body>
</html>

HTML 4 Standard Events

The standard HTML 4 events are listed here for your reference. Here script indicates a Javascript
function to be executed agains that event.

Event Value Description

onchange script Script runs when the element changes

onsubmit script Script runs when the form is submitted

onreset script Script runs when the form is reset

onclick script Script runs when a mouse click

onmouseout script Script runs when mouse pointer moves


out of an element

onmouseover script Script runs when mouse pointer moves

63 |
Page
over an element

SUMMARY
1. One of the most fundamental characteristics of a programming language is the set of data
types it supports.
2. Variable is the stored memory location that can hold a value in it. Variables are declared with
the var keyword.
3. The scope of a variable is the region of your program in which it is defined. JavaScript variable
have only two scopes: Global and Local Variables
4. Global Variables is a global variable has global scope which means it is defined everywhere
in your JavaScript code.
5. Local Variables is a local variable will be visible only within a function where it is defined.
6. An Operator is a symbol that performs an operation. JavaScript language supports Arithmetic,
Comparison, Logical, Assignment, and Conditional Operators.
7. The if statement allows JavaScript to make decisions and execute statements conditionally.
8. The if...else statement is the next form of control statement that allows JavaScript to execute
statements in more controlled way i.e to choose from given options.
9. if...else if... statement: The if...else if... statement allows JavaScript to make correct decision
out of several conditions.
10. Switch case is one of the alternate of multiple if. Else…if…
11. A loop is a block of code that allows you to repeat a section of code a certain number of times;
perhaps changing certain variable values each time the code is executed.
12. The window object represents an open window in a browser
13. A confirmation dialog box is mostly used to take user's consent on any option. It displays a
dialog box with two buttons: OK and Cancel.
14. The prompt dialog box is very useful when you want to pop-up a text box to get user input.
Thus it enable you to interact with the user. The user needs to fill in the field and then click OK.

64 |
Page
15. A function is a group of reusable code which can be called anywhere in your programme. This
eliminates the need of writing same code again and again.
16. The math object provides you properties and methods for mathematical constants and
functions
17. An occurance of an activity is called an event.

18. The onmouseover event occurs when you bring your mouse over any element and
theonmouseout occurs when you take your mouse out from that element.

EXERCISES

A. Fill in the blanks:

i. _____________ is the stored memory location that can hold value in it.
ii. _____________ cannot be used as variable.
iii. An __________ is a symbol that performs an operation.
iv. ___________control statement allows JavaScript to execute statement in more
controlled way.
v. ____________is one of the alternate of multiple if….else….if.
vi. The _____________ object represents an open window in a browser.
vii. ____________ is mostly used to give warning message to the users.
viii. ____________ is a group of reusable code which can be called anywhere in your
program.
ix. ___________keyword is used to define function in JavaScript.
x. The _____________object provides you properties and methods for mathematical
constants and functions.
B. State true or false:

i. The onmouseover event occurs when you take out your mouse out from that
element.
ii. An occurrence of an activity is called event.
iii. Pow( ) method returns base to the exponent power.
iv. Encapsulation is the capability of a class to rely upon another class for use of its
properties and methods.
v. JavaScript function can have a optional return statement.

65 |
Page

You might also like