unit 1 computer networking, open source software … · computer networking, open source software...

68
UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to study about computer Networks, associated terminology and related concept along with network devices. Key Points of the Chapter: Network: A Computer Network is a number of computers (Usually called terminals interconnected by one or more transmission paths. Need of Networking: a) Resource Sharing b) File and data sharing. c) Data security and centralized security d) High Reliability e) Communication Media High Speed f) Flexible working environment g) Cost factor Application of Networks a) Sharing of data, services and resources b) Access to remote database c) Communication facilities Elementary Terminology of Networks : 1. Nodes (Workstations):- The term nodes refer to the computers that are attached to a network and are seeking to share the resources. 2. Server:- A computer that facilitates the sharing of data, software and hardware resources on the network 3. Network Interface Unit (NIU) (MAC Address):- A network interface unit is interpreter that helps in establishing the communication between the server and the client. 4. IP Address:- Every machine on a TCP bar IP Network has a unique identifying no. called an IP Address. 5. Domain Name:-It is a way to identify and locate the computers connected to the internet. It must be unique. NETWORK TOPOLOGIES : The term Network Topologies refer to the way in which the nodes of a network are physically connected together. The important network topologies are 1) Bus Topology or Linear Topology : In this topology a single length of the transmission medium is used onto which the various nodes are attached. The transmission from any station travels the length of the bus, in both directions and can be received by all other stations. The bus has a terminator at either end which absorbs the signal, removing it from the bus. Characteristics: Short cable length and Simple wiring layout A single cable called trunk is used through which all data propagates and to which all nodes are connected Easy to extend There is no central point of failure on a bus because there is no hub. Entire network shuts down if there is break in the main cable. Terminators are required at both ends of the backbone cable. Difficult to identify the problem if the entire network shut down. Addition of nodes negatively affects the performance of the whole network. Only one computer can send messages at a time 2) Ring Topology:

Upload: others

Post on 26-Sep-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

UNIT 1

COMPUTER NETWORKING, OPEN SOURCE SOFTWARE

NETWORKING CONCEPTS

Brief Summary of the Chapter:

In this chapter we are going to study about computer Networks, associated terminology and related

concept along with network devices. Key Points of the Chapter:

Network: A Computer Network is a number of computers (Usually called terminals interconnected by one or

more transmission paths.

Need of Networking:

a) Resource Sharing

b) File and data sharing.

c) Data security and centralized security

d) High Reliability

e) Communication Media High Speed

f) Flexible working environment

g) Cost factor

Application of Networks

a) Sharing of data, services and resources

b) Access to remote database

c) Communication facilities

Elementary Terminology of Networks :

1. Nodes (Workstations):- The term nodes refer to the computers that are attached to a network and are

seeking to share the resources.

2. Server:- A computer that facilitates the sharing of data, software and hardware resources on the network

3. Network Interface Unit (NIU) (MAC Address):- A network interface unit is interpreter that helps in

establishing the communication between the server and the client.

4. IP Address:- Every machine on a TCP bar IP Network has a unique identifying no. called an IP

Address.

5. Domain Name:-It is a way to identify and locate the computers connected to the internet. It must be unique.

NETWORK TOPOLOGIES : The term Network Topologies refer to the way in which the nodes of a

network are physically connected together. The important network topologies are

1) Bus Topology or Linear Topology :

In this topology a single length of the transmission medium is used onto which the various nodes are

attached. The transmission from any station travels the length of the bus, in both directions and can

be received by all other stations. The bus has a terminator at either end which absorbs the signal,

removing it from the bus. Characteristics: Short cable length and Simple wiring layout A single cable

called trunk is used through which all data propagates and to which all nodes are connected Easy to extend

There is no central point of failure on a bus because there is no hub. Entire network shuts down if there is

break in the main cable. Terminators are required at both ends of the backbone cable. Difficult to identify

the problem if the entire network shut down. Addition of nodes negatively affects the performance of the

whole network. Only one computer can send messages at a time

2) Ring Topology:

Page 2: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

In a ring topology each node is connected to two and only two neighboring nodes. Data is accepted from

one of the neighboring nodes and is transmitted onwards to another. Thus data travels only one

direction. Every computer serves as a repeater to boost signals Short cable length. Suitable for optical fiber

Difficult to add computers More expensive If one computer fails, whole network fails Data clashes can

also occur if two machines send messages at the same time.

3) Star Topology:

A start topology is designed with each node connected directly to the server via hub or switch. This

topology is used in most existing information network. Data on a star network passes through the hub or

concentrator before continuing to its destination. Easy to install and wire No disruptions to the network

when connecting or removing devices. Easy to add new station as each station has direct cable connection

to hub or switch. Depending on the intelligence of hub, two or more computers may send message at the

same time One malfunctioning node does not affect the rest of the network. Required more cable length

than a linear topology. All signals transmission through the hub; if down, entire network down

NETWORK DEVICES

1. MODEM( MODulator DEModulator) :

Modem is a device that converts digital data originating from a terminal or computer to analog

signals used by voice communication network such as the telephone system. At one end, modems

convert the digital pulse to audible tones and convert audio tones back to digital pulses at the other

2. RJ –45 Connector:

The RJ-45 is a single line jack for digital transmission over ordinary phone wire. It is a 8 wire connector

which is commonly used to connect computers on the LAN(especially Ethernets). RJ – short for

Registered Jack – 45

3. Ethernet Card or NIC or NIU:

A NIC(Network Interface card) is a computer circuit board or card that is installed in computer so that

it can connected to network. It is suitable for coaxial or twisted pair cables. Hub: Hub is a device used to

connect several computers together. It is a multi-port card. Hubs forward any data packets including e-

mail, word processing documents or print request – they receive over one port from one workstation to all

of their remaining ports.

4. Switches :

Switches are smart hubs that send data directly to the destination rather than everywhere within

network. When the switch receive a packet, the switch examines the destination and source

hardware address and compare them to a table of a network segments and addresses. If the segments are

the same the packet is dropped and if the different then the packet is forwarded to the proper segments. .

5. Repeaters :

A repeater is a device that amplifies a signal being transmitted on the network. Since a signal loses

strength as it passes along a cable, it if often necessary to boost the signal with this device.. The repeater

electrically amplifies the signal it receives and rebroadcasts it. Router: A device that works like a bridge

but can handle different protocols, is known as router. It is used to separate different segments in a

network to improve performance and reliability.

Solved Questions:

Q1. What is MAC Address?

Ans : In computer networking, a Media Access Control address (MAC) is a unique identifier assigned to

most network adapters or network interface cards (NICs) by the manufacturer for identification, and used in the

Media Access Control protocol sub-layer.

Page 3: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Q2. Write two advantages of networks.

Ans: Advantages: i) Data or information can be shared among the users. ii) Fast communication can be

achieved.

Q3. Write two disadvantages of networks.

Ans : Disadvantages of networks:

i. Sophisticated Hardware and software technology is required.

ii. Expensive to install network.

Q4. What is communication channel? Name the basic types of communication channels available.

Ans: Communication channels mean the connecting cables that link various workstations. There are 3 basic types

of cables: Twisted Pair cables Coaxial cables Fiber-optic cables

Q5. Define a network.

Ans: A computer network is a system in which computers are connected to share information and resources.

Q6. What is IP address?

Ans A unique number consisting of 4 parts separated by dots, e.g. 165.113.245.2 Every machine that is on the

Internet has a unique IP number - if a machine does not have an IP number, it is not really on the Internet.

Q7. What is domain name? How is it alternatively known?

Ans The unique name that identifies an Internet site. Domain Names always have 2 or more parts, separated by

dots. The part on the left is the most specific, and the part on the right is the most general. E.g.: matisse.net

Q8. What are the various types of networks?

Ans : Network can be classified on the basis of their size, complexity and geographical spread. On the basis of

geographical spread it can be classified as Local Area Network, Metropolitan Area Network and Wide

Area Network.

Q9. What is the difference between MAN and WAN?

Ans : A metropolitan area network (MAN) is a large computer network that usually spans a city or a large

campus. WAN is a network that covers an area larger than a single building or campus such as across the cities or

countries.

Q10. What is meant by Topology? Name some popular topologies.

Ans: Network topology is defined as the interconnection of the various elements (links, nodes, etc.) of a

computer network. In computer networking, topology refers to the layout of connected devices. • Bus

topology • Star topology • Ring topology • Tree topology • Mesh topology

Q11. What are the similarities and differences between bus and tree topologies?

Ans: In bus topology each machine is connected to a single cable. Each computer or server is

connected to the single bus cable through some kind of connector. Tree topology is a network with the shape of an

inverted tree in which a single link between two nodes.

Q12. What are the limitations of star topology?

Ans i) Central node dependency: In this topology central node is a controller of the network. If the central node

fails, the entire network will be failed. ii) Difficult to expand: The addition of a new node to a network involves a

connection all the way to the central node.

Page 4: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

STRATEGIES FOR BETTER SCORING IN OPEN SOURCE CONCEPTS

Based on the past 3 years question papers it is observed that this chapter is quite scoring. The topics like

OSS, proprietary software, shareware, freeware etc. are asked for differentiation. Topics like common open

standards, character encoding, types of fonts and Indian language text entry etc. are also asked for 1 or 2

marks. The total mark allotted to this chapter according to blue print is 3 to 4 marks.

sno Topic Type of questions Marks

allotted

1 Types of Software-

Opens source

software

Proprietary software

Share ware

Freeware

Free software

1. What is OSS?

2. Examples of OSS. Justify that free software

is not OSS

3. Features of OSS

4. Organization contributed to development of

OSS in India

5. Difference between OSS and proprietary

software

6. Difference between shareware and free

ware

7. Expand OSS,FOSS,FLOSS,NRCFOSS

8. Identifying type of software

2

2 Common Open

standards-ODF,ogg

vorbis

1. What is ODF, ogg vorbis

2. Expand the term ODF

2

3 Character encoding-

ASCII

ISCII , Unicode

1. With what aim Unicode was developed?

2. Name two Indian scripts included in

Unicode.

2

4 Types of fonts-post

script

True

type

Open type

Static and dynamic

fonts

1. Difference between static and dynamic

fonts.

2. Difference between true type font and open

type font.

3. Expand TTF

2

5 Entering Indian

language Text-

Phonetic text entry

Key map based text

entry

1. Difference between phonetic and key map

based text entry.

2

Important question and answers

1 mark questions

1. What is OSS?

A) Open Source Software is a software available with source code and free to change/edit / redistribute and

imposed no further restrictions on product or its usage.

2. Expand the terms: OSI, FLOSS, FSF, GNU, W3C, and PHP, ASCII, NRCFOSS, TTF.

A) OSI: Open source Initiative

Page 5: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

FLOSS: Free Libre and Open Source Software.

FSF: Free software Foundation created for the purpose of supporting free Movement.

GNU: GNU’s Not UNIX Project established with an objective to create a system Compatible to UNIX but

not identical with it.

W3C: World Wide Web consortium is responsible for producing the software standards for World Wide

Web.

PHP: Hypertext Pre-processor is a widely used open source programming language primarily for server

side applications and developing dynamic web content.

ASCII: American Standard Code for Information Interchange

NRCFOSS: National Resource Centre for Free and Open Source Software

TTF: True Type Font

3. What is free software?

A) Free Software means the software is freely accessible and can be freely used, changed improved, copies

and distributed to others.

4. What is openoffice.org?

A) It is Office an application suite which is free software and directly competes with Microsoft Office. It is

compatible with MS Operating System, UNIX, MAC OS.

5. What is Unicode?

A) Unicode provides a unique number for every character, no matter what the platforms, no matter what the

program, no matter what the language. Unicode can represent 94140 characters.

6. What is Ogg Vorbis

A) Ogg Vorbis is Open Source Audio Compression Standard

2 mark questions:

7. Define freeware and shareware.

A) The freeware is the software available free of cost and allows copying and further distribution but does not

allows modification as its source code is not available. Shareware is as software which is available for

redistribution for stipulated time but after some time some license fee is required to be paid.

8. What is font? What is OTF?

A) A font is a set of displayable or printable text characters having specific style and size. Open Type Font: It

is the extension of the True Type Font Format which is 16 bits font and support 65536 characters (Unicode

characters).

9. What are different font categories?

A) There are two categories of font: True Type Font and Open Type Font. True Type Font: It is developed by

Apple and licensed to Microsoft. It is 8 bit font which is compatible with Microsoft Windows and MAC

OS. Open Type Font: It is the extension of the True Type Font Format which is 16 bits fon and support

65536 characters (Unicode characters).

10. Define ODF.

A) ODF is an Open Document file Format used for exchanging office documents such as memos, reports,

spreadsheets, database, charts and presentations. Open document is open, XML based file format used for

exchanging office documents such as memos, reports, spreadsheets, database, charts and presentations.

11. What is key map based text entry?

A) When you type text from a keyboard having key mapping of Indian Languages characters is known as key

map based text entry.

12. What is ISCII?

A) Indian Standard Code for Information Interchange (ISCII) is a coding scheme for representing various

writing systems of India. It encodes the main Indic scripts and a Roman transliteration. When we type

Indian Language words phonetically in English script and tool will automatically convert them into

corresponding language words called as transliteration.

13. What is Indian Script key map known as?

Page 6: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

A) Key map based text entry: When you type text from a keyboard having key mapping of Indian language

characters, is known as key map based text entry

Previous years- questions and answers

1. Name one open source Indian operating system. 1

a) BOSS(Bharat Operating System solutions)

2. Distinguish between Phonetic text entry and key map based entry of typing Indian language text. 2

a) Key map based text entry: When you type text from a keyboard having key mapping of Indian language

characters, is known as key map based text entry

b) Phonetic text entry: When you type text from a traditional keyboard, and based on pronunciation text is

entered in that language is known as phonetic text entry

3. What was the objective behind developing UNICODE? 1

a) Unicode is developed with an aim to conceive all the languages of the world in to single standard code

4. Write one advantage and one disadvantage of Open Source software over Proprietary software. 2

a) Open source comes with source code and it can be modified whereas proprietary software does not come

with any source code

5. Distinguish between Open Source Software and Proprietary software. 2

a) Open source: 1. Source code is available for modification and redistribution 2. There is no need to acquire a

license to use it

Proprietary software: 1. Source code is not available and it is owned by an organization 2. We need to

acquire license to use it

6. Name any two Indian scripts included in Unicode. 1

a) Telugu & Tamil

7. Ms.jayanto das is confused between shareware and open source software. Mention at least two points of

differences to help her understand the same 2

a) Shareware: The software is available to use only for limited period of time 2. It does not come with source

code

Opensource: 1. Source code is available for modification and redistribution 2. There is no need to acquire a

license to use it

8. Write examples of one proprietary and one open source software 1

a) Proprietary: Windows OS

Opensource: linux

9. Ms. Vidya Chauhan is confused between Proprietary Software and open source software. Mention atleast

two points of difference to make her understand the same.

2

Open source: 1. Source code is available for modification and redistribution 2. There is no need to acquire a

license to use it

Proprietary software: 1. Source code is not available and it is owned by an organization 2. We need to

acquire license to use it

10. Which of the following is not a characteristic of Open Source Software? 1

• Its source code is available for modification

• It is owned by a company or an individual

• It can be downloaded from internet

11. Which of the following softwares are open source: 1

Linux,Ms Windows 7,Photoshop, MySQL

a) Linux,MySQL

Page 7: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to
Page 8: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Revision tour of Java GUI programming

Subject: Informatics Practices (065) Class: XII

____________________________________________________________________________________

Easy way of attempting ‘FIND THE ERROR’ questions:

This covers 4 marks (2+2) in CBSE exam. Following strategy can be adopted for slow learners:

1. List out all the possible errors e.g.

a. Missing semicolon

b. Interchanging = and ==

c. Changing the case (lower or upper) of keywords

etc.

2. Let the students practice the questions based on only the listed out error types.

3. Don’t forget to underline each corrections

Easy way of attempting ‘CONVERSION’ type of questions:

This also covers 4 (2+2) marks. Usually one question is asked from selection statement (‘if’ to ‘switch’ or vice-

versa) and iteration statement (‘for’ to ‘while’ or vice-versa). Following strategy can be adopted for slow learners

to attempt these types of questions:

SELECTION Statement:

1. Identify three parameters

a. Variable

b. constant and

c. body of selection statement(s).

2. Place these three parameters in the structure of if/switch.

3. In case of’ if to switch’, place break statement at appropriate place. Also in case of ‘if-else-if’ , place

the last else statement in default section.

4. In case of ‘switch to if’, eliminate the break statement.

ITERATION statement:

1. Identify four parameters essentially required for iteration i.e.

a. Initialization

b. Condition or test expression

c. Updation

d. Loop body

2. Place all these parameters in appropriate place as per the given loop.

Easy way of attempting ‘FIND THE OUTPUT’ type of questions:

1.Problems based on expression evaluation.

Identify the whether the question is for finding the content of GUI component or variable

Find out the the value of the variable used in the setText() method by evaluating the expression

Points to remember while evaluating the Expression

Use of increment or decrement operator

Page 9: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Shortcuts like +=,-=,/= and their usage

Precedence of operators.

2.Problems based on the programming constructs

Mostly loops will be asked in this type.

Identify the initialization expression, Modification Expression, test expression and the body of the loop.

Draw the flowchart and fill the flowchart with corresponding part.

Draw boxes for the variables and update the boxes while tracing the flow.

Find out which variable is printed or displayed in a component. Give the value of the variable as

output.(Remember: You have to give the value of the variable each time it is printed)

3. Problems based on Library Functions

The string and math functions will be asked in this type of problems.

Thorough understanding of the string functions like length() ,concat() etc is required.

Page 10: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Easy way of attempting ‘GUI’ type of questions:

This question carries 6 (1+2+3 or 2+2+2) marks. Following strategy can be adopted for slow learners:

1. Attempt at least ‘CLEAR’ button and ‘EXIT’ button codes.

2. For ‘CALCULATE’ button at least declare the variables and write getText() and setText() commands.

Classes and libraries in Java

It has been reviewed that this chapter is very important . Topics like access specifiers :protected default and private

access specifiers, stringbuffer class and methods libraries are packages or asked for 1, 2 or 6 marks. Topics like

access specifiers protected default and private access specifiers or put up for 6 marks.

Access specifier libraries and packages

Default in private access specifiers

Stringbuffer class and methods

Inheritance and polymorphism

From past 3 years it has been analysed that this chapter is quite scoring. Topics like concept of inheritance

super class subclass forms of inheritance abstract class methods and polymorphic variables are asked for 2 or 6

marks. Topics like concept of inheritance abstract class methods and polymorphism of put off for 6 marks.

Web application development

It has been noticed that this chapter is importance from the perspective of exam. topics like wev server and

communicating with the web server and concepts of client-server are asked for1 mark.

web server and communicating with the web server

Concept of client and server

HTML and XML

It has been observed that this chapter is quite scoring and of maximum weightage. Topics like structure of

HTML, basic tags, headings in HTML tags, image tags, form tags, introduction to XML are asked for 1 on 2

marks. Topics like structure of HTML basic tags in HTML tags or put up for 2 marks.

Structure of HTML and basic tags

Headings in HTML tags

Image tag and form style Form

Introduction to XML

Sample Questions:

Finding the output

Type1 1mark

Page 11: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

1)Write the output in jTextField1 if choice is 5.

switch (choice)

{

case 1 :

var=choice+3;

break;

case 2 :

var=choice+2;

break;

default :

var=0;

}

jTextField1.setText( " " +var);

Answer:

jTextFeild1 will display 0 since no case values matches statement under default will be executed

2)Write the value of variable ‘c’ after execution of the following code

int d;

int c;

d=7;

c = (5 * ++d)%3;

Answer:

c=1

3)Write the value of t after the execution of the following code

int t;

int s;

s=6;

t = (8 * s++) % 7;

Answer:

t=6

TYPE 2 2Marks

1)BASED ON EXPRESSION EVALUATION

a)What will be displayed in jTextField1 and jTextField2 after the following code is

executed:

int p;

int q;

k = 2;

p= (4*k++)/2;

Page 12: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

jTextField1.setText(“ ”+p);

jTextField2.setText(“ ”+k);

Answer:

p=4

k=3

b)Write the values of v and u after execution of the following code

int v,u;

v = 7;

u= 5;

v= v+ (u++);

Answer:

v=12

u=6

c)Write the values of sum and t after execution of the following code :

int sum,t;

sum = 27;

t = 3;

sum = sum + 2 * (++t);

Answer:

sum=35

t=4

2)BASED ON STRING AND MATH FUNCTIONS

a)Write the contents of jTextField1, jTextField2, jTextField3 and jTextField4 when

the following statements are executed

String x;

String str = “Java”;

x = str.concat(“study”);

double a = 7.8765;

jTextField1.setText(x.length()+“ ”);

Page 13: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

jTextField2.setText (x.toUpperCase () );

jTextField3.setText (x.substring (2,5));

jTextField4.setText (Math.round(7.8765)+“ ”);

ANSWER:

jTextField1- 9 length of the string

jTextField2- JAVASTUDY

jTextField3- vas

jTextField4- 8

b)What will be the contents of jTextField1 and jTextField2 after executing the following code

String s = "variable";

jTextField1.setText(s.length()+" ");

jTextField2.setText(s.toUpperCase());

ANSWER:

jTextField1- 8 length of the string

jTextField2- VARIABLE

c)What will be the contents of jTextField1 and jTextField2 after executing the following code

String p = “Fast”;

String q = “Food”;

String r;

r = p.concat(q);

jTextField1.setText(r);

jTextField2.setText(q.toUpperCase());

ANSWER:

jTextField1- FastFood

jTextField2- FOOD

3)BASED ON EXECUTION OF LOOPS

a)Write the output that will be generated by the code given below

Page 14: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

int i=7;

int r=8;

while (i<=10)

{

System.out.println(r*i);

i = i+2;

}

ANSWER

56

72

b)Write the output that will be generated by the code given below

int i;

int t;

for (i = 5; i <=10; i = i+5)

{

t = i+3;

system.out.println(“ ”+t);

}

ANSWER

8

13

c) What will be the values of variables sum and sum1 after the execution of the

following loops

ANSWER

sum=5

sum1=8

Object Oriented Programming Concept

1.What is Object Oriented Programming?

Loop A

int v=5,sum=0;

int w=8, sum1=0;

while (v>3 )

{

Sum+=v;

v-=2;

}

Loop B

do

{

Sum1+=w;

w-=2;

}while(w>6);

Page 15: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Object oriented programming is a programming method.

Every entity in the real world is viewed as an object.

Objects are classified based on their common properties and behaviours.

2.What is a class and object in the context of Object Oriented Programming?

A class is the description of an object. It describes all the properties and behaviour of the objects belonging to that

class

Object is the real world entity of a particular class.

Example Class:STUDENT

-rollno

-name

-marks

Objects:STUDENT1 STUDENT2

101 102

Raj Dev

25 30

3.What you mean by inheritance?

Inheritance is the process of implementing “is a” relationship between two classes.

Base Class: PERSON

Subclass: STUDENT

STUDENT “is a” PERSON

4.What is Polymorphism?

Ability of a data or a function(method) or an operator to be processed in more than one form.

Same function can give different output based on the inputs.

Same operator can do different operations based on the type of operands.

Eg:- + operator will give sum of two operands if two operands are of Numerical datatype.

The same + operator will give concatenated string if any operand is a string.

FIND THE ERROR:

1. int I = 2; j = 5; I = j – 2 ;

While j >I

{ jTextField1.getText (“j is greater”);

J - - ; + + I ; }

Page 16: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

jOptionpane.showMessageDialog (“Hello”);

2. int I , j = 5;

I = = j + 5 ;

if ( I = j )

{ jTextField1.setText(“I and j are equal”);

jTextField1.setText(“I and j are not equal”);

break;

}

else

jTextField1.setText(“I and j are equal”);

3. int I = 0; x = 0;

while (I < 10)

{ if (I % 2 = 0)

{ x = x + I ;

System.out.print (x + 1);

}

I + +

}

4. int s = 15

if s < 20

System.out.print(“under”);

Otherwise

System.out.print(“over”);

5. int a = 20, b = 5, c ;

for (I = 1; I < = 5 ; I + +)

{ if (a % b = 0);

c = a + b;

else

c = a – b;

b ++;

System.println (a + “,” + b );

6. int I = 1, j = 5, k = 0;

while (I < 3 & j > = 1)

{ k + 5 = k;

I ++;

}

jTextField1.displayText(k);

Page 17: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

CONVERSION:

1. Write in for loop

int I = 1, sum = 0;

while (I < 10)

{ sum + = I ;

I + = 2;

}

2. Write in while loop

int I, sum = 0;

for ( I = 1; I < 10; I +=2)

sum = sum + I;

3. Write in for loop

Int I =1, fact = 1, n = 5;

While ( I < n)

{ fact * = I ;

I = I + 1;

}

System.out.print(“Factorial = ” + fact);

4. Write in switch case

If (num == 1)

jTextField1.setText (“Number is one”);

If (num == 2)

jTextField1.setText (“Number is two”);

If (num == 3)

jTextField1.setText (“Number is three”);

else

jTextField1.setText (“Number is more than three”);

5. Write in if-else

int c = jComboBox1.getSelectedIndex( );

switch (c)

{ case 0 : amount = bill; break;

case 1 : amount = 0.9 * bill; break;

case 2 : amount = 0.8 * bill; break;

default : amount = bill;

}

6. Write in switch case

if (d == 1)

Day = “Monday”;

if (d == 2)

Day = “Tuesday”;

if (d == 3)

Day = “Wednesday”;

Page 18: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

else

Day = “---”;

7. Write in switch case

if (ch = = ‘E’)

Eastern + +;

if (ch = = ‘W’)

Western + +;

if (ch = = ‘N’)

Northern + +;

if (ch = = ‘S’)

Southern + +;

else

Unknown ++;

GUI BASED QUESTIONS:

1. An electronic shop has announced the following seasonal discounts on the purchase of certain items.

Purchase amount in

Rs

Discount on

TV

Discount on Music

System

0 - 25000 5% 10%

25001 – 50000 10% 20%

More than 50000 15% 30%

Develop an application based on the above criteria, to input amount of purchase and the type of purchase

(using radio button) by a customer. Compute and print the net amount paid by a customer along with his

name accepted in a textfield.

2. Develop an application to create Arithmetic Calculator(+, -, *, /, %).Also write proper error handling

statements.

3. Create a Java Desktop Application to convert a given temperature Farenheit to Celsius and vice versa

.For an incorrect choice or input,an appropriate error message should be displayed. (Hints: C= 5/9 (F-

32) and F = 1.8 (C+32) ) Using a JButton’s (Convert ) click event handler, display the corresponding

temperature value in aJTextField control.

Page 19: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

4. Develop an application to calculate simple interest and amount . If the principal amount is more than

20000 then rate of interest is 5%, otherwise 6%. (Take principal amount using radio button).

5. Develop an application to prepare students’ result on the basis of marks entered.

Compute result button computes the result i.e total, percentage and grade.

Permissible range for marks is 0-100.Beyond this error message should be displayed.

Mark % Grade

>90 A

75-90 B

50-74 C

40-49 D

<40 Fail

6. Develop a java application to print the numbers and also find the sum and average of the numbers upto

the numbers entered by the user.

7. Develop an application to check a number is odd or even. If the number is even find its square and if

the number is odd find its cube and print the results in textfields.

8. Develop an application to print even numbers or odd numbers in a Textarea depending on the option

(given in Radio buttons) selected by the user. If the user does not select any option a message will be

displayed prompting the user to select either even or odd numbers.

9. MrMadhavworks in a construction company. To calculate total wages he has developed the following

GUI in NetBeans.

Page 20: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Male and female labours are respectively paid Rs 150 and Rs 170 perday. Skilled labourers are paid

extra at the rate of Rs 100 per day. Male and female labourers from rural areas are paid 10% less per

day.

a) When calculate wage button is clicked, the total wages is calculated as per the given criteria and

displayed in total wage textbox.

b) When clear button is clicked , all the textboxes should be cleared and radio button and check boxes

should be deselected.

c) Close the application when Quit button is pressed.

10. Design an application for Theatre Booking System.

a) When the user select different seat type, its price should be displayed in the label.

b) If the user enters an invalid no of seats, an error message should be displayed in the dialog box.

c) When the user click at the Book seats button, then total amount (no of seats x price per seat) should

be displayed along with payment mode.

Price per seat depend on the seat type :

Stall 625/-

Circle 750/-

Upper circle 850/-

Box 1000/-

Page 21: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

11. ABN Shipment Corporation imposes charges to customers for different product. The shipment company

calls for an order in two forms: Wholesalers and Retailors. The cost is calculated on unit basis as follows:

For Units Price for Wholesalers

(per unit)

Price for Retailors

(per unit)

1-15 Rs. 50/- Rs. 60/-

16-20 Rs. 45/- Rs. 55/-

21-30 Rs. 40/- Rs. 50/-

31-50 Rs. 35/- Rs. 45/-

>50 Rs. 30/- Rs. 40/-

Special customers are given a discount of 10%. The following is the screen used to calculate cost for an order:

(a) Write the code to disable the text field TotalCostTF and set WholesaleRB as default option.

(b) Write the code to Calculate Cost Button (CalcBtn) to

(i) Display the price per unit or discounted price per unit in PricePerUnitTF depending upon the

selection of special customer check box.

(ii) To display total cost. (Total cost = Order Unit * Per Unit Price)

(c) Write the code for Clear button (ClearBtn) to clear all text field and make text fields PricePerUintTF and

TotalCostTF as disable.

Write the code for Exit button (ExitBtn)

12. Assume the following interface built using Netbeans used for bill calculation of a icecream

parlor. The parlor offers three verities of ice-cream – vanilla, strawberry,

chocolate. Vanilla ice-cream costs Rs. 30, Strawberry Rs. 35 and Chocolate Rs. 50. A

customer can chose one or more ice-creams, with quantities more than one for each of

the variety chosen. To calculate the bill parlor manager selects the appropriate check

boxes according to the verities of ice-cream chosen by the customer and enter their

respective quantities.

Write Java code for the following:

a. On the click event of the button ‘Bill’, the application finds and displays the total

bill of the customer. It first displays the rate of various ice-creams in the

respective text fields. If a user doesn’t select a check box, the respective icecream

rate must become zero. The bill is calculated by multiplying the various

quantities with their respective rate and later adding them all.

Page 22: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

b. On the Click event of the clear button all the text fields and the check boxes get

cleared.

c. On the click event of the close button the application gets closed

Ans. private void jBtnCalculateMouseClicked(java.awt.event.MouseEvent evt)

{

if(jchkStrawberry.isSelected()==true)

jTxtPriceStrawberry.setText("35");

else

{

jTxtPriceStrawberry.setText("0");

jTxtQtyStrawberry.setText("0");

}

if(jChkChocolate.isSelected()==true)

jTxtPriceChocolate.setText("50");

else

{

jTxtPriceChocolate.setText("0");

jTxtQtyChocolate.setText("0");

}

if(jChkVinella.isSelected()==true)

jtxtPriceVinella.setText("30");

else

{

jtxtPriceVinella.setText("0");

jTxtQtyVinella.setText("0");

}

int r1,r2,r3,q1,q2,q3,a1,a2,a3,gt;

r1=Integer.parseInt(jTxtPriceStrawberry.getText());

r2=Integer.parseInt(jTxtPriceChocolate.getText());

r3=Integer.parseInt(jtxtPriceVinella.getText());

q1=Integer.parseInt(jTxtQtyStrawberry.getText());

Page 23: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

q2=Integer.parseInt(jTxtQtyChocolate.getText());

q3=Integer.parseInt(jTxtQtyVinella.getText());

a1=r1*q1;

jTxtAmtStrawberry.setText(""+a1);

a2=r2*q2;

jTxtAmtChocolate.setText(""+a2);

a3=r3*q3;

jTxtAmtVinella.setText(""+a3);

gt=a1+a2+a3;

jTxtTotalAmt.setText(""+gt);

}

private void jBtncloseActionPerformed(java.awt.event.ActionEvent evt)

Page 61 of 118

{

System.exit(0);

}

private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt)

{

jTxtPriceStrawberry.setText("");

jTxtPriceChocolate.setText("");

jtxtPriceVinella.setText("");

jTxtQtyStrawberry.setText("");

jTxtQtyChocolate.setText("");

jTxtQtyVinella.setText("");

jTxtAmtStrawberry.setText("");

jTxtAmtChocolate.setText("");

jTxtAmtVinella.setText("");

jchkStrawberry.setSelected(false);

jChkChocolate.setSelected(false);

jChkVinella.setSelected(false);

}

13. A shop has the following interface for calculating discount and net bill amount for its

customers.

Page 24: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Ans: private void jBtmBillActionPerformed(java.awt.event.ActionEvent evt)

{

double amt, dis, netamt;

if (jOptSilver.isSelected()==true)

dis= 5;

else if(jOptGold.isSelected()==true)

dis=7;

else if(jOptDiamond.isSelected()==true)

dis=10;

else

dis=0;

if (jChkSpecial.isSelected()==true)

dis=dis+ 2;

jTxtDiscount.setText(""+dis);

amt= Integer.parseInt(jTxtAmount.getText());

netamt= amt - amt * dis/100;

jTxtNetAmount.setText(""+netamt);

}

private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt)

{

jTxtStudName.setText("");

jTxtAmount.setText("");

jTxtDiscount.setText("");

jTxtNetAmount.setText("");

jOptSilver.setSelected(false);

jOptGold.setSelected(false);

jOptDiamond.setSelected(false);

}

private void jBtnCloseActionPerformed(java.awt.event.ActionEvent evt)

{System.exit(0); }

UNIT – II JAVA PROGRAMMING

HTML/XML( CARRIES 4 MARKS)

Key Points:-

HTML stands for Hyper Mark-up Language.

HTML is the subset of SGML (Standard Generalized Markup Language)

The head of the HTML document is where you enter the title of the page.

The HR tag is used to draw a horizontal line.

Headings are typically displayed in larger and/or bolder fonts than normal body text.

HTML has six levels of heading, numbered 1 to 6, with 1 being the largest.

The BACKGROUND is the image attribute in <BODY> tag where you can place graphic object to make

more attractive Web page.

Page 25: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

The BGCOLOR attribute is used to set the background color of your Web page with

<BODY> tag.

The numbered/ordered list <OL> tag is used to indicate a list item as contained in an

ordered or numbered form.

An ordered list is also a list of items. The list items are marked with numbers.

Bulleted/unordered list <UL> tag is used to indicate a list item as contained in an

unordered or bulleted form.

LI list tag is used to denote the beginning of each new list item.

The TYPE attribute is used to change the bulleted symbol in a list. The attribute may

have a value of circle, disc, or square. For example, <UL TYPE=disk>.

The list items are marked with bullets (typically small black circles).

The START attribute is used to change the beginning value of an ordered list. Normally,the ordered list

starts with 1. For example, <OL START = 10>.

The IMG SRC tag specifies an image to be displayed in a Web page. This is an empty

element, which is coded in HTML document. It has attributes like : SRC, ALIGN,

BORDER, HEIGHT, WIDTH and ALT.

A table is divided into rows (with the <tr> tag), and each row is divided into data cells

(with the <td> tag).\ The letters td stands for “table data”, which is the content of a data cell.

<CAPTION>text</CAPTION> places a horizontally centered title at the top or at the

bottom of a table.

Hyperlink links between Web pages is known as hyperlink.

anchor tag <A> marks the text as hypertext link.

The HREF attribute specifies the destination of a link.

The HREF or the name attribute must be present in the <A> tag.

A URL, basically, is a way to tell your web browser (or other program) where to look for something. If you

want to make a hypertext link to a page. You will need its URL.

HREF is an attribute for the <A> tag, which is displayed in a browser, the work Text

describing link would appear underlined and in another order to indicate that clicking

that text initiates the hypertext link.

XML is defined as an application profile of SGML.

XML stands for eXtensible Markup Language.

Page 26: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

XML is a meta-language. A meta-language is a language that’s used to define other

languages.

HTML versus XML

HTML Vs XML

1 HTML document formats and

displays web page’s data

XML documents carry data

along with their description.

2 HTML tags are predefined New tags can be created as

per our requirements.

3 HTML may not have closing

tags.

XML must have closing tags.

4 HTML tags are not case

Sensitive

XML tags are case sensitive.

5 HTML documents are directly

viewable in a browser.

XML documents are viewed

only if proper style sheet file is

also available along with XML

file.

Features of XML

1. XML is designed to carry data not to display data.

2. XML was created to structure, store and to send information.

3. XML is self descriptive. Tags are not pre defined; rather they are created to describe the content in appropriate

manner.

4. XML is free and extensible.

5. XML is platform independent.

6. XML can separate Data from HTML

XML stores and describes data, which can later be formatted and presented in desired

way.

7. XML can be used to create new languages, since it is a meta language.

8. XML is supported and recommended by World Wide Web Consortium (W3C).

Short Answer Type Questions (1 Mark)

1. What do you need to do work with HTML?

Ans. To work with HTML, you need an Editor (Notepad), Internet Browser (IE, FireFox, etc.)

and image editing package.

2.Write as HTML code line to set the background image as CLOUDS.GIF.

Ans. <BODY BACKGROUND = “CLOUDS.GIF”>

Page 27: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

3.Write an HTML code line to set the BGCOLOR as YELLOW.

Ans. <BODY BGCOLOR=”#FFF00”>

4. Write the HTML codes to set the BGCOLOR as PURPLE and a text “I am in Class X-A” as

BLUE.

Ans. <BODY BGCOLOR = “PURPLE” TEXT =”BLUE”>

5. Write the HTML codes to set the BGCOLOR as LIME, header 1 <H1> text “Text Example

with size and color” as BLUE, text font size as 30 and color=”RED”.

Ans. <BODY BGCOLOR = “YELLOW” TEXT =”BLUE”>

6. Write the HTML codes to set the BGCOLOR as NAVY, header 1 <H1> text “Text Example

with size color, and font face” as WHITE, text font size as 20, color ”RED” and font face

“ARIAL”.

Ans. . <BODY BGCOLOR = “LIME” TEXT =”WHITE”>

i. <FONT SIZE = “20” COLOR=”PURPLE” FACE =”ARIAL”>

ii. <H1> Text Example with size, color and font face </H1>

7. What is the method of using comment line in HTML code?

Ans. In HTML code, the comment line is declared as : <! – Any text - >

8. What is the use of <FONT> tag in HTML code? Write any two options used with this tag.

Ans. The <FONT> tag is used to change the size, color and type face of text on an HTML

page. The <FONT> tag uses options like SIZE, FACE, etc.

9. Which tag is used to insert heading of third level on a web page?

Ans. <H3>

10. How would you display in the title bar of browser?

Ans. The TITLE tag is used to display the title bar message with the web browser like

Internet Explorer or Netscape Navigator, For example,

<TITLE> Class – XII Test Review 2010 </TITLE>

11. How <BR> tag is different from <P> tag?

Ans. A line break tag, <BR>, is similar to a paragraph tag, but it behaves in a slightly different

way. It starts a new line within the current paragraph, but it does not start a new

paragraph.

12. What is the purpose of using the tag <H1>…<H6>?

Ans. Headings are typically displays in larger and /or bolder forms than normal body text.

HTML has six levels of heading, numbered 1 to 6, with 1 being the largest. For example,

i. <H1> Heading level One Text </H1>

ii. <H2> Heading level Two Text </H2>

13. How can the font size of a single line on a web page be changed?

Ans. The font size of a single line can be changed by using the HTML code as:

. <P> This is <FONT SIZE = +2>resized </FONT> text.

14. What will be displayed on the web page for the following web page?

<I Atomic weight of> /I> O <sub> 2 <br>

Page 28: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Ans. The web page will be displayed as : Atomic Weight of O2.

15. What is the HTML command to display the following in your web page? X2 + Y2

Ans. The HTML command is: X <sub>2</sub> + Y <sub>2</sub>

16. Write HTML code to set the image “Pen.jpg” stored in “My Pictures” folder in C:\ as the

background of your web page.

Ans. The HTML code is : <BODY BACKGROUND = “C:\My Pictures\Pen.Jpg>

17. Name two common graphics file formats that most browsers recognise.

Ans. The two common graphics file formats are: .gif and .jpg

18. Write the difference between <H1> and <H6> heading tags.

Ans. Headings are typically displayed in larger and/or bolder fonts than normal body text.

HTML has six levels of heading, numbered 1 to 6, with 1 being the largest, for example,\

i. <H1> Heading level One Text </H1>

ii. <H2> Heading level Two Text </H2>

19. What is the purpose of using TYPE attribute used in Lists?

Ans. In a list, the TYPE attribute specifies the type of numbering (:A”, etc.) or bulleting

(“circle”, “Disc”, Square”, etc.) depending on whether the LI is inside an OL or UL list.

20. What is the purpose of using START attribute used in Lists?

Ans. The START attribute is used to change the beginning value of an ordered list.

Normally, the ordered list starts with 1. for example, <OL START = 10>

21. Which HTML tag is used to insert an image in a page? Write an option used with this tag.

Ans. The IMG SRC tag is used to insert an image in a page. This tag uses the options like

ALT, ALIGN, etc.

22. Write the expansions of the following tags used in HTML?

i. <BR>

ii. <A>

iii. <HR>

iv. <|>

Ans. [a] Break line [b] Anchor tag [c] Horizontal Line [d] Comment tag

23. What are the different forms of List used in HTML? Name them.

Ans. The different forms of lists are : ordered and unordered lists. For example, UL and OL.

24. The following code is written to align the image in center in the browser’s window.

However, the desired result is not achieved. Mention the reason.

Ans. Because Center is not an attribute of IMG Align.

25. How can an image be inserted in a Web page?

Ans. An image can be inserted in a web page using the IMG tag. For example

<IMG SRC = “globe.gif” ALT = “[Test Image]” ALIGN = TOP>

26. Consider the HTML code < A HREF = # intro> Introduction </A>. in the above code.

Page 29: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

i. What is the purpose of #?

ii. What will happen when the user clicks “introduction”?

Ans. . [i] # is used to place the nchor in same document.

[ii] When the user clicks on Introduction, the marked anchor intro will be displayed on screen.

27. Give a command to insert an image in to the Web page, assuming that the image is stored

in a file Named “Photo.gif”.

Ans. <IMG SRC =”Photo.gif”>

28. Identify error(s) in the following HTML code. Also write the correct code. <OL> type = “a

start = “d”>

Ans. The OL tags attributes should be placed in between <and> In <OL> list, the TYPE

attribute starts with a number and TYPE attribute specifies “A”, “a”, “I”,”i” or “I”. So, the

correct format is : <OL start = 4 type=”I”>

29. How can text be displayed in place of image for users whose browsers do not support

images?

Ans. If the browser is unable to display the image, it replaces it with any text found in the

ALT = “text” attribute.

30. What is a <OL>…</OL> tag? Name any two attributes used with this tag.

Ans. The <OL> tag is used to indicate a list item as contained in an ordered or numbered

form. For example

i. <OL>

1. <LI> Apples

2. <LI> Oranges

ii. </OL>

iii. Two attributes are: START, TYPE.

31. What is CELLPADDING?

Ans. CELLPADDING tells the browser how much padding is required in the cell. In other

words between the side of the cell and the contents of the cell. Try a few different

numbers. Note that cell and padding run together and are one word. To control the

horizontal alignment of text and images within table cells use the align attribute i.e.,

align=left, align=right or align=center.

32. What is CELLSPACING?

Ans. CELLSPACING defines how much space you’d like in cells. It specifies the amount of

space between the frame of the table and the cells in the table. Note that cell and

spacing run together.

33. What is hyperlink?

Ans. The link between web pages is known as hyperlink. It is the link that leads from one

document to another.

34. What is A element?

Ans. . The A element is one of the distinctive features of HTML. It defines a link between

resources that allows webs of information to be created.

35. How is External linking different from Internal linking?

Ans. External linking links a document with a separate HTML file whereas the Internal

Page 30: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

linking links a section in the same HTML file.

36. What is the purpose of using the attribute HREF in tag <A>?

Ans. HREF is used with tag A to specify the Hyper text Reference link to some HTML

page/Website.

37. Write HTML code for placing an image MONUMENT.GIF at the center of the web page.

Ans. The HTML code is as :

i. <CENTER> <IMG SRC=”MONUMENT.GIF”>

ii. </CENTER>

38. What is the use of XML?

Ans. HTML is used to describe how data is formatted. XML is used

to describe what data actually means.

Long Answer Type Questions (2 Marks)

Q. 1 Explain the term HTML.

Ans. The definition of HTML is HyperText 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.The fact that it is hyper just

means it is not linear – i.e. you can go to any place on the Internet whenever you want

by clicking on links – there is no set order to do things in.

Markup is what HTML tags do to the text inside them. They mark it as a certain type of

text (italicized text, for example).

HTML is a Language, as it has code words and syntax like any other language

Q 2. What is the use of <BODY> tag in HTML code? Write any two attributes used with this

tag.

Ans. The <BODY> tag contains the contents of your document including background color,

text color and page margins. Also, various mark-up elements are allowed within the body

to indicate headings, paragraphs, lists, hypertext links, images and so on. These are

described and illustrated in documents following this one. The two attributes are:

BACKGROUND and BGCOLOR

Q 3. Which tag do we use to change the size and style (face) of the text of an HTML file

viewed on a web browser? Also explain any two attributes used with this tag.

Ans. . FONT tag. SIZE can be 1to 7.

Example :- <FONT SIZE=5 FACE=”ARIAL”> HELLO</FONT>

Q 4. Distinguish between <SUP> and <SUB> tags with example.

Ans. SUP is used for super script whereas SUB is used for subscript

Q 5. What is an unordered list?

Ans. Bulleted/unordered list <UL> tag is used to indicate a list item as contained in an

unordered or bulleted form.

Q 6. What is ordered list?

Ans. The numbered/ordered list <OL> tag is used to indicate a list item as contained in an

Page 31: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

ordered or numbered form.

Q 7. How is <OL> Different from <UL>?

Ans. The numbered/ordered list <OL> tag is used to indicate a list item as contained in an

ordered or numbered form. Bulleted/unordered list <UL> tag is used to indicate a list item as contained in an

unordered or bulleted form.

Q 8. Give the expansion of the following:

a. JPEG

b. <LI> tag

c. <P> tag

d. HREF attribute

Ans. a. JPEG:- Joint Pictures Expert Group

b. <LI> tag :- LIST

c. <P> tag Paragraph

d. HREF attribute Hyper Reference

Q 9. What is table? What are the basic commands for creating a table?

Ans. Table is a collection of rows and column.

Followings are important tags :

<Table> :- used to give identification to a table

<TH> :- To provide headings in a table

<TR>:- (Table Row) to create Row in a table

<TD> :- (Table Data) to create columns in a row

Q 10. What do you understand by ALINK? Explain with an example.

Ans. Links which are currently being visited in web page are known as Active Links (ALINK).

Example:

<BODY TEXT = “#FFFFFF” ALINK=”#FF0000”>

<A HREF=”www.kvsangathan.nic.in”> Kendriya Vidyalaya Sangathan </A><BR>

<A HREF = www.cbse.nic.in> Central Board of Secondary Education </A>

</BODY>

Q 11. What is FORM tag? Explain with example.

Ans. To create or use forms in a web page <FORM> tag is used. Form is means to collect

data from the site visitor. It is done with the help of controls that collect data and send it

over.

Example:

<FORM method = “POST” action=mailto:[email protected]>

Q 12. What is INPUT tag? Explain with example.

Ans. Text boxes are single line text input controls that are created using <INPUT> tag whose

TYPE attribute has a value as “Text”.

Example:

<FORM method = “POST” action=mailto:[email protected]>

First Name:

<INPUT TYPE=”text” NAME = “fname”/>

<BR>

Last Name:

<INPUT TYPE=”text” NAME = “lname” />

Page 32: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

</FORM>

Q 13. What is the purpose of select tag?

Ans. <SELECT> tag is used to create a drop down box in which many options are available;

user can make selection from the list.

Example:

<SELECT name = “stream”>

<OPTION value=”Science”> Science</OPTION>

<OPTION value=”Commerce”> Commerce </OPTION>

<option value=”Humanities”> Humanities </OPTION>

</SELECT>

Q. 14 Differentiate between Container & Empty tags/elements of HTML.

Ans. Container tag needs opening and closing tags whereas empty tag needs only opening tag.

Examples : Container tags: <HTML> </HTML>, <BODY> </BODY>,<P> </P>

Empty tags: <BR>, <HR>, <IMG>

Q. 15 Write any features of XML.

Ans. 1.XML is designed to carry data not to display data.

2. XML was created to structure, store and to send information.

Q. 16 What does XML stand for? How is the purpose of HTML different from XML?

Ans. XML- Extensible markup language .HTML is a page layout and hyperlink specification language used to

design the layout of a document and to certify the hyperlinks.

Q. 17”With XML you invent your own tags.”Explain with one example.

Ans. XML is self descriptive. Tags are not pre defined; rather they are created to describe the content in

appropriate manner. XML can be used to create new languages, since it is a meta language.

Example: <Empdata>

<Employee>

<EmpId>101</EmpId>

<Ename>Aman</Ename>

<Salary>25000</Salary>

</Employee>

</Empdata>

Q. 18 a)Which tag is used to display a horizontal rule on a web page?

b) Identify the error in HTML code: <UL TYPE=”a” START=4>

Ans. a) <HR> tag

b) <OL TYPE=”a” START=4>

Page 33: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

MYSQL REVISION TOUR

Brief Summary of the Chapter:

A database system is basically a computer based record keeping system. There are different data

models are available. The most popular data model is Relational Data Model (RDBMS). In RDBMS data is

arranged in the form of table. MYSQL is software to manipulate database. It is free, open- source RDBMS.

In order to access data within MYSQL database, all programs and users must use, Structured Query

Language (SQL).SQL is the set of commands that is recognized by nearly all RDBMs. SQL commands

can be classified into three categories. These are DDL (Data Definition Language), DML (Data

Manipulations Language) and TCL (Transmission Control Language). Apart from MYSQL is commands, it has

various functions that performs some operation and returns a singlevalue. In this chapter we will learn

various commands and functions in MYSQL and its implementation.

KEY POINTS OF THE CHAPTER

• Structure Query Language

A non-procedural UGL used for querying upon relational database

• DDL: Data Definition Language

Part of the SQL that facilitates defining creation/modification etc. of database object such as tables,

indexes, sequences etc.

• DML: Data Manipulation Language.

Part of the SQL that facilitates manipulation (additions/deletions/modification) of data which residing

in the database tables.

• Meta Data

Facts/data about the data stored in table.

• Data Dictionary

A file containing facts/data about the data stored in table

• Relational Data Model

In this model data is organized into tables i.e. rows and columns. These tables are called relations.

• The Network Data Model

In this model data are represented by collection of records & relationships among data. The

collections of records are connected to one another by means of links.

• The Hierarchical Data Model

In this model records are organized as trees rather than arbitrary graphs.

• Object Oriented Data Model

Data and associated operations are represented by objects. An object is an identifiable entity with

some characteristics and behavior.

• Relation: Table in Database

• Domain: Pool of values from which the actual values appearing

• Tuple: A row of a relation

• Attribute: A column of relation

• Degree: Number of attributes

Page 34: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

• Cardinality: Number of tuples

• View: Virtual table that does not really exist in its own right

• Primary Key: Set of one or more attributes that can uniquely identify tuples with in the relation.

• Candidate Key: A Candidate Key is the one that is capable of becoming Primary key i.e., a field or

attribute that has unique value for each row in the relation.

• Alternate Key: A candidate key that is not primary key is called alternate key.

• Foreign Key: A non-key attribute, whose values are derived from the primary key of some other table.

• Integrity Constraints Integrity Constraints are the rules that a database must comply all the times. It

determines what all changes are permissible to a database.

Accessing Database in MySql

Through USE keyword we can start any database Syntax:

USE <database Name>; Example: USE STUDENT;

CREATING TABLE IN MYSQL

Through Create table command we can define any table. CREATE TABLE

<tablename>

(<columnname> <datatype>[(<Size>)],……..);

Example: CREATE TABLE Student(SRollNo integer, Sname char(20));

INSERTING DATA INTO TABLE

The rows are added to relations using INSERT command. INSERT INTO

<tablename>[<columnname>]

VALUES (<value>, <value>…); Example: INSERT INTO

student (Sid, Sname) VALUES (100,’ABC’);

SELECT COMMAND:

It lets us make queries on the database.

SELECT * FROM tablename WHERE condition; Example: SELECT *

FROM student WHERE Sid=100;

Eliminating Redundant Data

DISTINCT keyword eliminates redundant data Example: SELECT

DISTINCT Sid FROM Student;

Selecting from all the rows-ALL Keyword

Page 35: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

SELECT ALL Sid FROM Student;

Viewing structure of table: DESCRIBE/DESC

<tablename>; Example: DESCRIBE student;

Using column aliases:

SELECT <column name> AS [columnalias][,…] FROM <tablename>;

Example: SELECT rollno, name AS “studentname” FROM student;

Condition based on a range:

Keyword BETWEEN used for making range checks in queries.

Example: SELECT rollno, name FROM student WHERE rollno BETWEEN 10 AND 20;

Condition based on a list:

Keyword IN used for selecting values from a list of values.

Example: SELECT rollno, name FROM student WHERE rollno IN (10, 20, 60);

Condition based on a pattern matches:

Keyword LIKE used for making character comparison using strings percent(%) matches any

substring

underscore(_) matches any character

Example: SELECT rollno, name FROM student WHERE name LIKE ‘%ri’;

ORDER BY clause:

It is used to sort the results of a query.

SELECT <column name> [, <column name>, …] FROM <table name>

[WHERE <condition>]

[ORDER BY <column name>];

Example: SELECT * FROM student WHERE marks>50 ORDER BY name;

Creating tables with SQL Constraint :

CREATE TABLE command is used to CREATE tables

CREATE TABLE tablename(columnname datatype size, …);

MySQL functions:

A function is a special type of predefined command set that performs some operation and returns a

single value.

Page 36: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

String functions : (Lower / LCASE( ), Upper/UCASE( ), Concate( ), Instr( ), Length( ),

RTrim( ), LTrim( ), Substr( ) )

Numeric function :(Round( ), Truncate( ), Mod( ), Sign( ) )

Date functions:(Curdate( ), Date( ), Month( ), year( ), DayName( ), DayofMonth( ),

DayofWeek( ), DayofYear( ), Now( ), SysDate( ))

TYPE A: Very Short Answer Questions

1 What is MySQL server?

Ans. MySQL server listens for client requests coming in over the network and accesses database contents

according to

those requests and provides that to the clients.

2 What is MySQL client?

Ans. MySQL clients are programs that connect to the MySQL server and issue queries in a pre-specified format.

MySQL

is compatible with the standards based SQL. The client program may contact the server programmatically or

manually.

3 What is SQL? What are the different categories of SQL commands?

Ans. SQL is the set of commands that is recognized by nearly all RDBMSs.

SQL commands can be divided into following categories:

1. Data definition Language (DDL) commands.

2. Data Manipulation Language (DML) Commands.

3. Transaction Control Language (TCL) Commands.

4. Session Control Commands.

5. System Control Commands.

4 What does Data Dictionary consists of?

Ans. Data Dictionary consists of metadata i.e., data about data.

5 Maximum how many characters can be stored in a

(i) Text literal Numeric literal?

Ans. (i) 4000 bytes 53 digits of precision

TYPE B: Short Answer Questions

1 What is the role of database server in database management system? Give the key features of MySQL.

Ans. Server listens for client requests coming in over the network and access database contents according to those

requests and provides that to the clients.

following are the key feature of MYSQL

Some of the features of MySQL are :

Fast speed

Ease of use

Query Language Support

Portability

Connectivity

Localization

2 How are SQL commands classified?

Page 37: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Ans. SQL provides many different types of commands used for different purpose. SQL commands can be mainly

divided

into following categories:

1. Data Definition Language (DDL) – commands that allow you to perform tasks related to data definition e.g.,

Creating, altering and dropping.

Granting and revoking privileges and roles.

Maintenance commands

2. Data Manipulation Language (DML) – commands that allow you to perform data manipulation e. g.,

Retrieval, insertion, deletion and modification of data stored in a database.

3. Transaction Control Language (TCL) – commands that allow you to manage and control the transactions e.g.,

Making changes to database permanent

Undoing changes to database, permanent

Creating savepoints

Setting properties for current transactions.

DATABASE TRANSACTIONS

Brief Summary of the Chapter:

Reliability is a quality, which we seek for in everything that we get. The same is applicable to software and to

database. A reliable database system is that which retains our database in a consistent state despite

occurrence of many failures. Database Transaction is the field which requires utmost consistency. This chapter

describes fundamentals of database transactions and its reliable implementation. A database can be called

consistent when it follows ACID properties. A transactions can be called reliable when it either COMMITed

i.e. successfully all its steps are carried out and changes are permanently reflected in the database or be

ROLLBACKed i.e. in case of failures, if transaction cannot be successfully completed then any data

changes made by the transaction are brought back to the state that earlier was prior to the execution of this

transaction.

KEY POINTS OF THE CHAPTER

TRANSACTION-A set of successive statements that succeed or fail as a group so that all effected

statements of the group are retained or all are discarded are called transactions. When a transaction is

done on the database is called database transaction.

COMMIT-This statement is used to end a transaction and make all changes permanent. Until a

transaction is committed, other users cannot see the changes made to the database.

ROLLBACK- The ROLLBACK statement is used to end a transaction and undo the work done by

that transaction. After ROLLBACK, it looks like that transaction had never begun.

SAVEPOINT-It is point in a transaction, up till which all changes have been saved permanently.

Page 38: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

ACID- It is an acronym of ATOMOCITY, CONSISTENCY, ISOLATION, DURABILITY

(For Details see SOLVED QUESTIONS.)

TYPE A: Very Short Answer Questions

1 Define a transaction.

Ans. Transaction is a logical unit of work that must succeed or fail in its entirety.

2 What do you mean by committing a transaction?

Ans. Committing a transaction means all the steps of a transaction are carried out successfully and all data changes

are made permanent in the database.

3 What does transaction ROLLBACK indicates?

Ans. Transaction ROLLBACK means transaction has not been finished completely and hence all data changes

made by

the transaction in the database are undone. And the database returns to the same state as it was before this

transaction execution started.

4 What are the different properties of transactions maintained by database systems?

Ans. Following are the properties of transactions maintained by database systems:

1. Atomicity 2. Consistency 3. Isolation 4. Durability.

5 Define the following terms:

(i) Atomicity (ii) Consistency (iii) Isolation (iv) Durability.

Ans. (i) Atomicity –This property ensures that either all operations of the transaction are reflected properly in the

database, or none are. Atomicity ensures either all-or-none operations of a transaction are carried out.

(ii) Consistency –This property ensures that the database remains in a consistent state before the start of

transaction and after the transaction is over (whether successfully or unsuccessfully).

(iii) Isolation –Isolation ensures that each executing transaction execution in isolation i.e., is unaware of other

transactions executing concurrently in the system.

(iv) Durability –This property ensures that after the successful completion of a transaction i.e., when a

transaction COMMITs, the changes made by it to the database persist i.e., remain in the database

irrespective of other system failures.

TYPE B: Short Answer Questions

1 What is the concept of database transaction?

Ans. A Database transaction is a logical unit of work (LUW) that must succeed or fail in its entirety. This

statements

means that a transaction may involve many sub-steps, which should either all be carried out successfully or all is

ignored if some failure occurs.

Each transaction, generally, involves one or more data manipulation language (DML) statements (such as

INSERT,

DELETE or UPDATE) and ends with either a COMMIT to make the changes permanent or ROLLBACK to undo

the

changes. The database transaction must be handled in a way so that their integrity is maintained.

2 Briefly explain the system view of the transaction.

Ans. The system (data base software) views a transaction as a logical sequence of read and write operations, where

1. Read (X) – operation brings data item X from database to an area in the main memory where the transaction

Page 39: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

is executing.

2. Write (X) – operation transfers data item X from transaction’s main memory area to the database file.

3 What is the function of redo and undo logs?

Ans. DBMS maintains special logs to perform redo and undo operations if required.

A storage area that holds copies of data modified by active transactions. By default, this area is physically part of

the system tablespace. Redo log stores correct data written by incomplete transactions. And used for redo

operations.

Type C: Long Answer Questions

1 Discuss the user view and system view of a transaction.

Ans. 1. User view of the transaction – A user view transaction in terms of work carried out by it i.e., the

function(s)

performed by the transaction. For example, the user views above mentioned transaction T1 as follows:

Begin transaction

Get balance from account X

calculate new balance as X – 1000

Page 2 of 2

store new balance into database file

get balance from account Y

calculate new balance as Y + 1000

store new balance into database file

End transaction

2. System View of the transaction – The system (data base software) views a transaction as a logical sequence

of read and write operations, where

1. Read (X) – operation brings data item X from database to an area in the main memory where the

transaction is executing.

2. Write (X) – operation transfers data item X from transaction’s main memory area to the database file.

MORE ON SQL – GROUPING RECORDS AND TABLE JOINS

Type A: Very Short Answer Questions

1 What are single row functions?

Ans. Single row functions work with a single row at a time. A single row function returns a result for every row of

a

queried table.

2 What are multiple row functions?

Ans. Multiple row functions work with data of multiple rows at a time and return aggregated value.

3 What will be the output of following code?

mysql> SELECT COUNT (‘Inform’, ‘atics’);

Ans. Output of above code will be ‘ERROR’

4 What is Cartesian product? How is it related to join?

Ans. Joining two or more tables without any condition, it is called Cartesian product or Unrestricted Join.

TYPE B: Short Answer Questions

Given the following table:

Page 40: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Give the output of following SQL statements:

(i) SELECT COUNT (DISTINCT SPORTS) FROM Club;

(ii) SELECT MIN(Age) FROM CLUB WHERE Sex=’F’;

(iii) SELECT AVG(Pay) FROM CLUB WHERE Sports = ‘KARATE’;

(iv) SELECT SUM(Pay) FROM CLUB WHERE Datofapp > ‘31/01/98’;

Ans. (i) 4

(ii) 34

(iii) 1100

(iv) 9800

Given the following table:

TABLE: STUDENT

Give the output of following SQL statements:

(i) SELECT MIN(AvgMark) FROM STUDENT WHERE AvgMark<75;

Page 2 of 2

(ii) SELECT SUM(Stipend) FROM Student WHERE Grade=’B’;

(iii) SELECT AVG(Stipend) FROM Student WHERE Class=’12A’;

(iv) SELECT COUNT(DISTINCT) FROM Student;

(i) 64.4

(ii) 1150

(iii) 5

TABLES AND INTEGRITY CONSTRAINTS

TYPE A: Very Short Answer Questions

1 What is a constraint? Name some constraints that you can apply to enhance database integrity.

Page 41: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Ans. A constraint is a property assigned to column or the set of columns in a table that prevents certain types of

inconsistent data values from being placed in the column(s).

1. Primary key constraint

2. Not null constraint

3. Default constraint

2 What is primary key? What is PRIMARY KEY constraint?

Ans. A primary key is a unique identifier for a database record. When a table is created, one of the fields is

typically

assigned as the primary key. While the primary key is often a number, it may also be a text field or other data type.

The PRIMARY KEY constraint uniquely identifies each record in a database table.

3 What is NOT NULL constraint? What is DEFAULT constraint?

Ans. The not-null constraint is a restriction placed on a column in a relational database table. It enforces the

condition

that, in that column, every row of data must contain a value - it cannot be left blank during insert or update

operations. If this column is left blank, this will produce an error message and the entire insert or update operation

will fail.

The DEFAULT constraint is used to insert a default value into a column.

TYPE B: Short Answer Questions

1 What is foreign key? How do you define a foreign key in your table?

Ans. A foreign key is a field that points to the primary key of another table. The purpose of foreign key is to

ensure

referential integrity of the data.

Whenever two tables are related by a common column (or set of columns), then the related column(s) in the parent

table (or primary table) should be either declared a PRIMARY KEY or UNIQUE key and the related column(s) in

the

child table (or related table) should have FOREIGN KEY constraint.

For example, if there are two tables:

Items (Itemno, Description, Price, QOH)

Orders (Orderno, Orderdate, itemno, Qty)

Both the tables are related through common column Itemno.

The column Itemno is primary key in parent table Items and it should be declared as foreign key in the child table

Orders to enforce referential integrity.

Page 42: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to
Page 43: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

IT APPLICATIONS

Brief Summary

Three major groups of IT applications covered in this chapter are: egovernance, e-business,

and e- learning.

e-Governance involves applications which are used by government agencies/organizations to provide better

governance.

e-Business applications use technology to effectively access and deliver business related services and perform

various kinds of business transactions.

e-Learning applications use technology to effectively deliver and monitor learning and teaching processes. They

help the trainer to organize and manage his/her lesson plans, present them to students/learners, evaluate and take

the feedback to enhance & fine-tune this process in future.

An IT application has two major parts: Front-end (The user interface) and back-end (The database).

The front-end of an IT application is usually a group of one or more forms through which the user enters the input

values and is shown the corresponding output. A good front-end ensures the acceptance of the application in the

first go.

The back-end of an IT application is the database in which all the data is stored. This database resides in the server.

All the data which is requested by the front-end is supplied by back-end. A good back-end ensures sustainability,

efficiency and easy modification of the application.

Development of an IT application involves creation of front-end, back-end, and connecting these two. It also

involves testing the application and then implementing it.

Use of ICT has its social and economic impacts. Society is impacted as due to ICT people change their way of

conducting the transactions and thus save their time, money, and energy. Economy is impacted as ICT leads to fast

completion of data transfer and data processing jobs. ICT also brings transparency in the administration.

Key Points

Differentiate between front-end and back-end of an application.

Identify various components of the front-end of an application.

Page 44: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Design and develop simple IT applications.

List the impacts of ICT (Information & Communication Technology) on society

Solved Questions (MULTIPLE CHOICE QUESTIONS) - 1 M

1. A web site to provide online information and services to the citizens is an example of

a. e-Business b. e-Mail

c. e-Governance d. e-Learning

2. The web-site of an electricity supply company which allows its customers to pay bills online is an example of

a. e-Business b. e-Mail

c. e-Governance d. e-Learning

3. The web-site of a school which allows the students to go through various lessons in their subjects is an example

of

a. e-Business b. e-Mail

c. e-Governance d. e-Learning

4. Web address of national portal of India is:

a. India.gov.in b. GOI.gov.in

c. ncert.nic.in d .None of the above

5. A form through which users interact with an IT application is a part of

a. database b.front-end

c. back-end d. Java script

6. A good front-end is

a. consistent b. user friendly

c. neither of the above d. both a and b

7. Mr. X is an infomaniac. It means he

a. Uses information carefully b. Uses computers to get information.

c. Responds to almost all his SMSs, eMails etc. d. Tries to get correct information

8. Javascript is a

a. database b. front end c. back-end d. scripting language

Page 45: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Answers : 1.-c, 2-a,3-d,4-a,5-b,6-d,7-c,8-d

VERY SHORT QUESTIONS-ANSWERS - 1M

1. Give some examples of input values, where Radio Button and Check Boxes should be used for efficiency

in the application.

Answer : for selection criteria applying, Providing optional choices.

2. What are the important guidelines we should keep in mind while developing an efficient

application?

Answer : It should be user friendly, reliable and should be maintained database with consistency and

integrity with GUI.

3. Is it a good practice to take in the inputs using TextFields only? Justify your answer.

Answer : TextField is used to get small textual information like Name, RollNo, email address, quantity,

etc. Disabled/Uneditable TextFields are also used to display such information so it is a good practice to

take in the inputs using TextFields. But we may also use Dialog to take input.

Short Question-Answers -2M

Q. Write Short Notes on : e-Governance, e-Business, e-Learning.

Answer : e-Governance involves applications which are used by government agencies/organizations to provide

better governance. e-Business applications use technology to effectively access and deliver business related

services and perform various kinds of business transactions. e-Learning applications use technology to effectively

deliver and monitor learning and teaching processes. They help the trainer to organize and manage his/her lesson

plans, present them to students/learners, evaluate and take the feedback to enhance & fine-tune this process in

future.

Q. What are Front-end (The user interface) and back-end (The database) ?

Answer : An IT application has two major parts: Front-end (The user interface) and backend (The database) .The

front-end of an IT application is usually a group of one or more forms through which the user enters the input

values and is shown the corresponding output. A good front-end ensures the acceptance of the application in the

first go. The back-end of an IT application is the database in which all the data is stored. This database resides in

the server. All the data which is requested by the front-end is supplied by back-end. A good back-end ensures

sustainability, efficiency and easy modification of the application.

Q.What are the terms involved in Development of an IT application ?

Development of an IT application involves creation of front-end, back-end, and connecting these two. It also

involves testing the application and then implementing it.

Q. What social and economic impacts are found of ICT. ?

Answer : Society is impacted as due to ICT people change their way of conducting the transactions and thus save

their time, money, and energy. Economy is impacted as ICT leads to fast completion of data transfer and data

processing jobs. ICT also brings transparency in the administration.

Q. What do you mean by Infomania ?

Page 46: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Answer :Infomania is the condition of reduced concentration caused by continually responding to electronic

communications such as e-mail, SMSs, MMSs etc. ICT is making more and more people infomaniac. This is

making some people waste their productive time in the office, neglect their families and duties. Some people are

also in a habit of frequently checking their e-mails even when they are on vacation with their families. We have to

be careful in the use of ICT so that we use it constructively and not get obsessed with it and become infomaniacs.

Q. What OS and fonts are used for Indic Language Support ?

Answer : Mac OS 10.5 supports Devanagari, Gujarati, Gurmukhi and Tamil. Linux based desktops support

Bengali, Devnagari, Gujarati, Kannada, Malayalam, Oriya, Tamil, Telugu and Gurmukhi, Q. Write the steps for

enabling Indic Language Support in Windows. Answer :Windows 7 and Windows Vista include all the necessary

files to support Indic languages Complex(Indic) text support is automatically enabled. Therefore you just need to

enable the keyboard for the language that you want to use by following the steps in the Enable a keyboard layout

section.For Windows XP, some additional setup may be required to support Indic languages. Therefore you first

follow the steps given under Enabling International Language Support in Windows and then proceed with the steps

given under the Enable a keyboard layout section.

Q. How can be established Front-End and Database Connectivity ?

A database application consists of Front-End and Database (Back-end). These two entities cannot work in

isolation. Whatever data is entered by the user has to go to the database and whatever relevant data is extracted

from the database is to be shown to the user through the Front-End. Therefore, the Front-End and the Database of

an IT application must be connected. This connectivity is achieved as learnt in Chapter 6 (Database Connectivity).

If the application is web based then the connectivity is achieved using some scripting language (like vbScript or

JavaScript).

Q. What Components are used for creating Front-end of any software ?Give details about those components.

Answer : To create a front-end various components, like those studied in Java GUI application development, are

used. Some of the most commonly used components are discussed below.

TextField: TextField is used to get small textual information like Name, RollNo, email address, quantity, etc.

Disabled/Uneditable TextFields are also used to display such information.

TextArea: TextArea is used to get long textual information which may span multiple lines of text. E.g. to get

Address, Complaint, Suggestion etc. Disabled/ Uneditable TextAreas are also used to display such information.

Radio Button: Radio buttons are used to get an option out of several mutually exclusive (out of which only one can

be selected) options. Examples of such options are Gender (Male or Female or Other), Type of Credit Card

(Master or Visa or Other), Type of internet connection (DialUp or Braodband), etc.

CheckBox: Check boxes are used to get one or more options out of several given options which are not mutually

exclusive. These are the cases where multiple options are given to the user and the user can select zero or more out

of the given options. Examples of such options are Hobbies (a user may have zero or more hobbies), Magazines to

subscribe for (a user may subscribe to zero or more of the given magazines) etc.

Page 47: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

A list is used to get one or more options out of several given options which may or may not be mutually exclusive.

This may seem to be the case where CheckBoxes are to be used, but the difference is in the number of options

available. If the number of options is small, then CheckBoxes can be used. In case of large number of options,

using CheckBoxes may take up a lot of space on the form and it may also be inconvenient for the user to select the

desired options. In such cases Lists are preferred over checkboxes. Examples of such cases are: To select cities out

of a given list of cities, to select magazines out of a given list of magazines, etc.

ComboBox: A ComboBox is used to get an option out of several given options which are mutually exclusive. This

may seem to be the case where RadioButtons are to be used, but the difference is in the number of options

available. If the number of options is small, then RadioButtons can be used. In case of large number of options,

using RadioButtons may take up a lot of space on the form and it may also be inconvenient for the user to select

the desired option. In such cases ComboBoxes are preferred over radio buttons. Examples of such cases are: To

select a city out of a given list of cities, to select a train out of a given list of trains, etc. When the options are

mutually exclusive, then a List can also be used instead of a ComboBox. It all depends on the space available on

the form (a ComboBox consumes less space as compared to a List) and the look of the form (which the form

designer has to decide).

PasswordField: A PasswordField is used to get some secret textual information like Password, CVV number of a

credit card etc.

Q. What do you understand by e-Business ? Give Examples.

To reach the customers and business associates in an effective and fast manner business houses (now a days many

small shops like snacks corners and paan shops also) provide their services on the net. These ICT enabled counters

are used to get orders and feedbacks from the customers and also for inter-business transactions. This helps the

businesses to widen their customer base. nafedindia.com/ebusiness.asp (e-business site of NAFED) -Through this

URL NAFD (National Agricultural Cooperative Marketing Federation of India Ltd.) offers its e-business services

to various corporates and customers.

1. Amazon.com ( e-Business site of Amazon.com) - Amazon is the world's largest online store. Through this URL

Amazon does its online business

Q. How IT applications are created ? Write notes on Development of IT applications.

For developing such application, one needs to follow the following steps:

Step 1: Identify the problem for which the application is to be developed and discuss about its feasibility. If the

applications is technically and economically feasible (possible and profitable to carry out), then steps are taken for

its development, otherwise the project is scrapped.

Step 2: Identify and decide, which database tables and table structures will be required in the application. Make

sure that the data types and sizes of the columns in the tables are carefully planned and used. Create database and

tables as per the requirement of the application.

Step 3: Identify and decide, which all inputs are required to be taken from the user in the Front-End of the

application. Find out, where you can minimize the typing efforts of user by introducing known options using

RadioButton/CheckBox/ List/ComboBox etc. Develop the front-end of the application as per the requirement and

ease of use.

Page 48: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Step 4: Establish the data connectivity between the Front-End interface and Back-End Database.

Step 5: Test the full application (Front-End and Back-End) with multiple sample sets of data. It is always better if

the sample data are collected from potential users of the application randomly. Now, the application is ready for

implementation.

Q. Give examples to understand the process of IT application development.

Example 1 - e-Business : To expand its business, XYZ Mall plans to go online. Anyone who shops at the Mall

will be given a membership number and Password which can be used for online shopping. With this membership

number and password, customers can place their orders online. The mall will maintain the customers' data and

orders' data. A person is put on duty to keep constantly checking the Orders data. Whenever an order is received,

its processing has to start at the earliest possible.The Orders' data will be analyzed periodically (monthly, quarterly,

annually - whatever is suitable) to further improve business and customer satisfaction.

Example 2 - e-Governance : The state administration wants to make vehicles' data (RegNo, RegDate, Owner,

OwnerShipNumber, Address, HP) easily available to citizens. Each registration authority incharge will regularly

update the data. Citizens will be given read only access to this data.

Example 3 - e-Learning : An organization of dedicated teachers, 'Meticulous Teachers Consortium', decides to

invite computer aided teaching modules from individuals and organizations so that these can be put on the internet

for students' use free of cost. No money will be charged from users and no money will be paid to the developers.

Once the modules start pouring in, a front-end is created for the students where the students can select any of the

available modules to learn any topic.

Q. What is ICT ? Write Impact of ICT on society.

Answer : ICT stands for Information and Communication Technology. Like everything else that is used by

common man, ICT (Information and Communication Technology) also has impacted the society. ICT has

impacted the society in a much wider way than any other technology. Most of these impacts are positive, though

there are some negative impacts also. Social and Economic benefits of ICT:

Social networking sites help people remain in touch with their nears and dears even when they are staying on

opposite sides of the globe.

Social networking sites help like-minded people come together and work for some cause.

e-Governance sites help people save their productive time by performing various government related jobs like

getting some forms, depositing bills online.

ICT helps economy grow at a faster rate as it provides transparency in the processes and helps the government to

keep check on defaulters.

Due to e-Banking and use of plastic money more money is put in circulation leading to faster growth of GDP.

Q. What is cloud computing ?

Answer : This means that cloud computing is a type of Internet-based computing, and it consists of every situation

where the use of IT resources by an entity, including a person or an organization.

Page 49: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Q. What are the properties of cloud computing?

Answer : Properties of cloud computing are : Access to the resources is: o Controlled by the entity, and restricted

by them to their authorized users.

o Delivered via the Internet to all of these users.

The resources are: o Hosted by a service provider on behalf of the entity.

o Dedicated to their exclusive use.

Data processed by the resources is:

o Private to the entity and its associates.

o Entered or collected by them, or automatically produced for them.

How is an e‐commerce business more cost effective than traditional

business? Write two points.

Ans No infrastructure to be set up for shop.

Faster buying and selling procedure

( 1 mark each for any two valid points)

How is e‐learning beneficial for old people? Write one point.

Ans ● Learning from home

● Learning at own pace

● Learning any time

● Learning any topic

( 1 mark for any one valid point)

Ms. Ariya is creating a form for PAN CARD application. Help her to

choose most appropriate controls from ListBox, ComboBox, TextField,

TextArea, RadioButton, CheckBox, Label and Command Button for the

following entries.

S.No. Function

1 To enter NAME

2 To enter MOBILE NUMBER

3 To allow user to choose one CATEGORY out of the

categories : Company,Trust,Individual.

4 To enter NATURE OF BUSINESS/PROFESSION in the form

of a paragraph

Ans

S.No Function Control

1 To enter NAME TextField

2 To enter MOBILE NUMBER TextField

3 To allow user to choose one CATEGORY out

of the categories:

Company,Trust,Individual.

Page 50: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

RadioButton/

ComboBox

KENDRIYA VIDYALAYA SANGATHAN

Subject: Informatics Practices (065)

Blue Print

TOPICS SA(1) SA(2) LA(6) TOTAL

Networking & Open

Source software

4(4) 3(6) - 7(10)

Programming in Java

7(7) 6(12) 1(6) 14(25)

RDBMS

6(6) 6(12) 2(12) 14(30)

IT Applications

1(1) 2(4) - 3(5)

TOTAL

18(18) 17(34) 3(18) 38(70)

Page 51: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

KENDRIYA VIDYALAYA SANGATHAN

Subject: Informatics Practices (065)

Time allowed: 3 hours Class XII Maximum Marks: 70

I a Name the device that links two networks with different protocols and it uses logical address. 1

1. b Mr. Daya Shankar is planning in his office building to connect all computers, each spread

over within distance of 50 meters. Suggest the economical cable type having high speed data

transfer rate which can be used to connect these computers.

1

2. c Which of the following are open source software

Linux, MS-Office, BOSS, Windows OS

1

3. d Define the followings with reference to Threats to Network Security. ( 2 )

(i) Trojan Horse

(ii) Worm

2

4. e Define the term Snooping 1

5. f Mr. Mehra is confused between the terms Domain name and URL. Explain the difference

with the help of appropriate examples of each.

2

6. g Give one examples each for Open Source Software and Proprietary Software 1

7. h Differentiate IP address and MAC Address 1

8.

9. 2 a Define Data Encapsulation in context of Object Oriented Programming. 1

Page 52: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

10. b What will be the values of num and num1 after execution of the following code:

int num,num1=0;

for(num=100;num<=101;num++)

{

num1= num+2;

--num1;

}

1

11. c Zia is working with list box. She has placed a list control on her form to display the list of all

items available in her shop. She wants to allow the user to select multiple items from her list

control. Which property of jList should she use to do the same?

1

12. d What will be the content of the jtextArea1 after executing the following code(Assuming that

the jTextArea1 had no content before executing this code)?

for(int C=1; C<=4; C++)

{ jTextArea1.setText(jTextArea1.getText()+” “ +Integer.toString(C*C));

}

1

13. e Write the name of HTML tag used to include numbered list in a HTML webpage. 1

14. f Write HTML code for the following

To provide hyperlink to a website http://www.cbse.nic.in.

1

15. g Write any two advantages of xml over html. 2

16. h Write java code that take any three digit number from the user in jTextField1, calculate the

sum of the digits and display it in separate textfield named jTextField2.

For example If the number entered is 432, it should answers as 9 (i.e. 4+3+2).

2

17.

18. 3 a Roli wants to list the names of all the tables in her database named ‘Gadgets’. Which

command (s) she should use to get the desired result.

1

19. b Write the name of the clauses used with SELECT command for the followings. Give one

example of the use of each clause :

(i) To list the values with of a column without any repetition.

(j) To display the values that matches a particular pattern in a given column.

2

c Kuhu has already created a table ‘Hospital’ as shown below:

Now she wants to add a new column ‘Address’ in the above given table. Suggest to her

suitable MySQL command for the same.

Patient_No Patient_Name Disease Age Charges

P001 Alya Viral Fever 14 500

P002 Kavita Lung Infection 16 1500

P003 Manya Cough and Cold 20 500

P004 Amar Bone Fracture 22 2500

P005 Deep Viral Fever 15 500

1

20. d There is a column C1 in a table T1. The following two statements:

mysql>SELECT COUNT(*) FROM T1; and

mysql>SELECT COUNT(C1) from T1;

2

Page 53: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

are giving different output as 12 and 9 respectively. What may be the possible reason?

21. e A table named ‘GAMES’ has the following contents:

Write the output that will be displayed by statements (i) and (ii).

SELECT * FROM GAMES;

SET AUTOCOMMIT = 0;

INSERT INTO GAMES VALUES(105,'CHESS’,2,9000);

ROLLBACK;

SAVEPOINT S1;

SELECT * FROM GAMES; ------------ (i)

INSERT INTO GAMES VALUES(108,'LAWN TENNIS’,4,25000);

SAVEPOINT S2;

INSERT INTO GAMES VALUES(109,'CRICKET’,11,20000);

ROLLBACK TO S2;

SELECT * FROM ITEM; ------------ (ii)

GCode GameName Number_of_Players PrizeMoney

101 Carom Board 2 5000

102 Badminton 2 12000

103 Table Tennis 4 8000

2

22. f What is the purpose of GROUP BY clause? Differentiate between HAVING and WHERE

clauses

2

23. 4 a Define Polymorphism with reference to object oriented programming. 1

24. b Given a String object named 'code' having value as “1234” stored in it. What will be result of

the following?

JOptionPane.showMessageDialog(null, " " +(code.length( )+ Integer.parseInt(code)));

1

25. c What will be displayed in jTextField1 and jTextField2 after the following code is executed

int i = 5 ;

for ( int j = 1 ; j <= i ; j++ )

if ( j % 2 == 0 )

jTextField1.setText( j + " " ) ;

else

jTextField2.setText( j + " " ) ;

2

26. d Find output of the following java code snippet:

String word="Excellent";

String wordlc = word.toUpperCase();

for (int i = 0; i < wordlc.length(); i+=3)

{

String extract = wordlc.substring(i,i+2);

jTextArea1.append(extract+"\n");

}

2

27. e Rewrite the following code using for loop:

int i = 1 ;

2

Page 54: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

while( i < 5 )

{

System.out.println( "i = " + i ) ;

i++ ;

}

28. f The following code has error(s). Rewrite the correct code underlining all the corrections made

:

String one = KendriyaVidyalaya ;

int b;

for(int b = 0 ; b < 3 , b++ ) {

jTextArea1.showText(one+"\n" ) ;

one = one + b ; }

2

29. g

Mr. Vidyarthi works in AGC School as a programmer. In order to develop a student record

application, he has created the above GUI in NetBeans.

The school offers two different streams, commerce and science, with different grading

criteria. The school also offers incentive to the NCC cadets in the form of a 3%

increment in percentage for all the NCC cadets. The grading criteria for two streams is

given below :

Stream Percentage Grade

Commerce

>=80

60-79

<60

A

B

C

Science

>=75

50-74

<50

A

B

C

Write the code for the following :

(i) Write the code for “Calculate Percentage” button to calculate the percentage after

finding the total marks of first term and second term (assuming that both marks are out

5

Page 55: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

of 100). Also ensure that NCC Cadets get an increment of3% in their percentage

(ii) Write the code for “Calculate Grade” button to calculate the grade depending on the

stream selected according to the criteria given above.

(iii) Write the code for “Exit” button to terminate the application. Write the code for

“Clear” button to clear all the text fields and check box.

30.

31. 5a Differentiate Primary Key and Foreign Key 2

32. b Write the output of the following SQL queries:

(i) SELECT ROUND( 23.7589 , 2 ) ;

(ii) SELECT DAYOFMONTH(‘2014-01-30’);

(iii) SELECT TRUNCATE( 4.12345 , 2 ) ;

(iv) SELECT SUBSTRING(‘KVSANGATHAN’, 3 , 3 ) ;

2

33. c Consider the table TEACHER given below. Write commands in SQL for (i) to (iv) and output

for (v) to (viii)

i. To display all information about teachers of PGT category

ii. To list the names of female teachers of Hindi department

iii. To list names, departments and hiredates of all teachers in ascending order of

hiredate.

iv. To count number of teachers in English department

v. Select Max(Hiredate) from Teacher;

vi. Select Distinct(category) from Teacher;

vii. Select count(*) from Teacher where category=”PGT”;

viii. Select Gender, avg(Salary) from Teacher group by Gender;

6

34.

35. 6 a Create table Customer as per following 2

Page 56: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

36. b In a database there are two tables ‘Customer’ and Bill as shown below:

(i) What is the degree and cardinality in the Cartesian product of these two tables?

(ii) Which column in the Bill table is the foreign key?

2

Page 57: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

37. c In a database there are two tables :

Table STATIONERY:

S_ID SName Company Price

DP01 Dot Pen ABC 10

PL02 Pencil XYZ 6

ER05 Eraser XYZ 4

PL01 Pencil CAM 7

GP02 Gel Pen ABC 15

Table CONSUMER:

_ID CName Address S_ID

01 Good Learner Delhi PL01

06 Write Well Mumbai GP02

12 Topper Delhi DP01

15 Write & Draw Delhi PL02

16 Motivation Bangaluru PL01

Write MySQL queries for the following :

(i) To display the Stationery name, company, price and corresponding consumer name of

all the stationery items whose price is in the range 5 to 12 (both values inclusive).

(ii) To display consumer name, address and corresponding company name from the tables

CONSUMER and STATIONERY of all the stationeries whose consumer’s address is

Delhi.( 2)

(iii) To display Stationery name, company and discount (Note : Discount to be calculated as

20% of price) of all the Stationeries with appropriate column headings.

6

38. 7 a What is E-Business? Give an example for E-Business site 1

39. b Identify e-Governance and e-Learning applications from the following:

i) On-line experiments in a virtual laboratory of a college.

ii) On-line application submission for change of address in the passport.

iii) On-line bill payment of Water Charges to Jal Board of any state.

iv) On-line tutorials for physics.

2

40. c Mr. Paul is going to develop a front end for his school. Help him to choose most appropriate

controls from ComboBox, TextField, TextArea, RadioButton, CheckBox.Label and Command

Button for the following entries :

(i) To select a student from a list of class-XII Commerce students.

(ii) To enter the email-id.

(iii) To select the hobbies of the student out of 4 hobbies given

(iv) To choose the gender(male or female)

2

Page 58: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to
Page 59: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Marking Scheme

1 a Name the device that links two networks with different protocols and it uses logical address.

Ans Gateway ( 1 Mark)

41. b Mr. Daya Shankar is planning in his office building to connect all computers, each spread

over within distance of 50 meters. Suggest the economical cable type having high speed data

transfer rate which can be used to connect these computers.

Ans: Coaxial Cable (1 Mark)

42. c Which of the following are open source software

Linux, MS-Office, BOSS, Windows OS

Ans: Linux, Boss (1/2 Mark each)

43. d Define the followings with reference to Threats to Network Security. ( 2 )

(iii) Trojan Horse – looks harmless but harmful

(iv) Worm – program which replicates itself

(1 mark each)

44. e Define the term Snooping

snooping refers to gaining unauthorised access to another

person's or organization's data (1 Mark)

45. f Mr. Mehra is confused between the terms Domain name and URL. Explain the difference

with the help of appropriate examples of each.

Domain name refers name of Webserver eg: www.cbse.nic.in

URL refers the complete location of the document on web

eg: http://www.cbse.nic.in/welcome.htm

(1 Mark for explanation 1 mark for example)

46. g Give one examples each for Open Source Software and Proprietary Software

Open Source- Source code is open

Proprietary – Licenced

( ½ mark each)

47. h Differentiate IP address and MAC Address

IP address is assigned by the network administrator or the internet

service provider while the MAC address is assigned by the manufacturer

(1 mark for any 1 difference)

48. 2 a Define Data Encapsulation in context of Object Oriented Programming.

Ans: The wrapping up of data and methods into a single unit is called encapsulation

(1 Mark)

49. b What will be the values of num and num1 after execution of the following code:

int num,num1=0;

for(num=100;num<=101;num++)

{

num1= num+2;

--num1;

}

Ans: num=102 , num1= 102 (1 mark for correct answer, ½ mark for partial answer)

Page 60: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

50. c Zia is working with list box. She has placed a list control on her form to display the list of all

items available in her shop. She wants to allow the user to select multiple items from her list

control. Which property of jList should she use to do the same?

Ans: selectionMode (1 Mark )

51. d What will be the content of the jtextArea1 after executing the following code(Assuming that

the jTextArea1 had no content before executing this code)?

for(int C=1; C<=4; C++)

{jTextArea1.setText(jTextArea1.getText()+” “ +Integer.toString(C*C));

}

Ans: 1 4 9 16 ( 1 Mark)

52. e Write the name of HTML tag used to include numbered list in a HTML webpage.

Ans: <ol> (1 Mark)

53. f Write HTML code for the following

To provide hyperlink to a website http://www.cbse.nic.in.

Ans: < A href=http://www.cbse.nic.in”> cbse</A> (1 mark)

54. g Write any two advantages of xml over html.

Ans:

1) HTML has predefined tags. User can define tags in XML

2) All HTML tags are not having closing tags. All XML tags have opening and closings tags

(1 mark for each difference or any other difference)

55. h Write java code that take any three digit number from the user in jTextField1, calculate the

sum of the digits and display it in separate textfield named jTextField2.

For example If the number entered is 432, it should answers as 9 (i.e. 4+3+2).

( 2 mark for correct ans 1 mark for partial answer)

56. 3 a Roli wants to list the names of all the tables in her database named ‘Gadgets’. Which

command (s) she should use to get the desired result.

Ans: Show tables (1 mark)

57. B Write the name of the clauses used with SELECT command for the followings. Give one

example of the use of each clause :

(k) To list the values with of a column without any repetition.

(l) To display the values that matches a particular pattern in a given column.

Ans: (i) Distinct

(v) Like

(1 Mark each)

C Kuhu has already created a table ‘Hospital’ as shown below:

Now she wants to add a new column ‘Address’ in the above given table. Suggest to her

Patient_No Patient_Name Disease Age Charges

P001 Alya Viral Fever 14 500

P002 Kavita Lung Infection 16 1500

P003 Manya Cough and Cold 20 500

P004 Amar Bone Fracture 22 2500

P005 Deep Viral Fever 15 500

Page 61: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

suitable MySQL command for the same.

Ans: Alter table Hospital add (Address char(30)); (1 Mark)

58. D There is a column C1 in a table T1. The following two statements:

mysql>SELECT COUNT(*) FROM T1; and

mysql>SELECT COUNT(C1) from T1;

are giving different output as 12 and 9 respectively. What may be the possible reason?

( Correct answer 2 marks , Partial answer 1 mark)

59. e A table named ‘GAMES’ has the following contents:

Write the output that will be displayed by statements (i) and (ii).

SELECT * FROM GAMES;

SET AUTOCOMMIT = 0;

INSERT INTO GAMES VALUES(105,'CHESS’,2,9000);

ROLLBACK;

SAVEPOINT S1;

SELECT * FROM GAMES; ------------ (i)

INSERT INTO GAMES VALUES(108,'LAWN TENNIS’,4,25000);

SAVEPOINT S2;

INSERT INTO GAMES VALUES(109,'CRICKET’,11,20000);

ROLLBACK TO S2;

SELECT * FROM ITEM; ------------ (ii)

( 1 mark each)

GCode GameName Number_of_Players PrizeMoney

101 Carom Board 2 5000

102 Badminton 2 12000

103 Table Tennis 4 8000

60. f What is the purpose of GROUP BY clause? Differentiate between HAVING and WHERE

clauses

( 1 mark for explaining Group By, 1 mark for difference)

61. 4 a Define Polymorphism with reference to object oriented programming.

Ans: ability of a method to execute in many forms (1 Mark)

62. B Given a String object named 'code' having value as “1234” stored in it. What will be result of

the following?

JOptionPane.showMessageDialog(null, " " +(code.length( )+ Integer.parseInt(code)));

Ans: 1238 ( 1 Mark)

63. c What will be displayed in jTextField1 and jTextField2 after the following code is executed

int i = 5 ;

for ( int j = 1 ; j <= i ; j++ )

if ( j % 2 == 0 )

jTextField1.setText( j + " " ) ;

else

jTextField2.setText( j + " " ) ;

Page 62: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Ans jTextfield1= 4 jTextField2=5 (1 mark each)

64. d Find output of the following java code snippet:

String word="Excellent";

String wordlc = word.toUpperCase();

for (int i = 0; i < wordlc.length(); i+=3)

{

String extract = wordlc.substring(i,i+2);

jTextArea1.append(extract+"\n");

}

(2 marks for correct output, 1 mark for partial)

65. e Rewrite the following code using for loop:

int i = 1 ;

while( i < 5 )

{

System.out.println( "i = " + i ) ;

i++ ;

}

Ans:

i=1

i=2

i=3

i=4 (2 marks for correct output , 1 mark for partial)

66. f The following code has error(s). Rewrite the correct code underlining all the corrections made

:

String one = KendriyaVidyalaya ;

int b;

for(int b = 0 ; b < 3 , b++ ) {

jTextArea1.showText(one+"\n" ) ;

one = one + b ; }

( 2 marks for correct ans, 1 for partial answer)

67. g

Mr. Vidyarthi works in AGC School as a programmer. In order to develop a student record

Page 63: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

application, he has created the above GUI in NetBeans.

The school offers two different streams, commerce and science, with different grading

criteria. The school also offers incentive to the NCC cadets in the form of a 3%

increment in percentage for all the NCC cadets. The grading criteria for two streams is

given below :

Stream Percentage Grade

Commerce

>=80

60-79

<60

A

B

C

Science

>=75

50-74

<50

A

B

C

Write the code for the following :

(j) Write the code for “Calculate Percentage” button to calculate the percentage after

finding the total marks of first term and second term (assuming that both marks are out

of 100). Also ensure that NCC Cadets get an increment of3% in their percentage

(2 marks for correct code, 1 for partial)

(iv) Write the code for “Calculate Grade” button to calculate the grade depending on the

stream selected according to the criteria given above.

2 marks for correct code, 1 for partial)

(v) Write the code for “Exit” button to terminate the application. Write the code for

“Clear” button to clear all the text fields and check box.

(1 mark)

68. 5a Differentiate Primary Key and Foreign Key

Ans: Primary Key: Uniquely identifies the rows in table

Foreign Key: Non key attributes whose values are derived from primary key of other table

(1 Mark each)

69. B Write the output of the following SQL queries:

(v) SELECT ROUND( 23.7589 , 2 ) ;

Ans: 24

(vi) SELECT DAYOFMONTH(‘2014-01-30’);

Ans: 30

(vii) SELECT TRUNCATE( 4.12345 , 2 ) ;

Ans: 4.12

(viii) SELECT SUBSTRING(‘KVSANGATHAN’, 3 , 3 ) ;

Ans: SAN

( 1/2 mark each)

70. C Consider the table TEACHER given below. Write commands in SQL for (i) to (iv) and output

for (v) to (viii)

Page 64: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

ix. To display all information about teachers of PGT category

x. To list the names of female teachers of Hindi department

xi. To list names, departments and hiredates of all teachers in ascending order of

hiredate.

xii. To count number of teachers in English department

xiii. Select Max(Hiredate) from Teacher;

xiv. Select Distinct(category) from Teacher;

xv. Select count(*) from Teacher where category=”PGT”;

xvi. Select Gender, avg(Salary) from Teacher group by Gender;

Ans: i. Select * from Teacher where Category =”PGT”;

ii. Select Name from Teacher where Department=”Hindi”;

iii. Select Name, Department, Hiredate from Teacher orderby Hiredate;

iv. select count(*) from Teacher where Department=”English”;

v. 1994-09-02

vi. 3

vii. 1

viii. M 36000

F 61000

( For i to iv 1 mark each for correct answer ½ mark for partial answer)

(For v to vii ½ mark each)

71. 6 a Create table Customer as per following

( 2 mark for correct query, 1 Mark for Partial answer)

72. B In a database there are two tables ‘Customer’ and Bill as shown below:

Page 65: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

(i) What is the degree and cardinality in the Cartesian product of these two tables?

Ans: Degree 7, Cardinality 15 ( ½ mark for degree , ½ mark for cardinality)

(ii) Which column in the Bill table is the foreign key?

Ans: CustID ( 1 mark)

73. c In a database there are two tables :

Table STATIONERY:

S_ID SName Company Price

DP01 Dot Pen ABC 10

PL02 Pencil XYZ 6

ER05 Eraser XYZ 4

PL01 Pencil CAM 7

GP02 Gel Pen ABC 15

Table CONSUMER:

_ID CName Address S_ID

01 Good Learner Delhi PL01

06 Write Well Mumbai GP02

12 Topper Delhi DP01

15 Write & Draw Delhi PL02

16 Motivation Bangaluru PL01

Write MySQL queries for the following :

(i) To display the Stationery name, company, price and corresponding consumer

name ofall the stationery items whose price is in the range 5 to 12 (both values

inclusive).

Page 66: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to

Ans: select Sname, Company, Price, Cname from Stationery S, Consumer C where

S.S_ID=Consumer.S-ID;

(ii) To display consumer name, address and corresponding company name from the

tables ( 2)

CONSUMER and STATIONERY of all the stationeries whose consumer’s address is

Delhi.

Ans: Select CName, Address, Company from Consumer C, Stationery S where

Address=”Delhi” and S.S_iD=C.S_ID ;

(iii) To display Stationery name, company and discount (Note : Discount to be

calculated as 20% of price) of all the Stationeries with appropriate column

headings.

Ans: Select SName ,Company, Price * 0.20 as Discount from Stationery;

(2 Marks for each correct query, 1 mark for each partial answer)

74. 7 a What is E-Business? Give an example for E-Business site

Ans: Business through Electronic Media. www.amazon.com

( ½ Mark each )

75. B Identify e-Governance and e-Learning applications from the following:

i) On-line experiments in a virtual laboratory of a college.

ii) On-line application submission for change of address in the passport.

iii) On-line bill payment of Water Charges to Jal Board of any state.

iv) On-line tutorials for physics.

Ans:

E-Commerce:

iii) On-line bill payment of Water Charges to Jal Board of any state.

ii) On-line application submission for change of address in the passport.

E-Learning:

i) On-line experiments in a virtual laboratory of a college.

iv) On-line tutorials for physics.

( 1 Mark each)

76. c Mr. Paul is going to develop a front end for his school. Help him to choose most appropriate

controls from ComboBox, TextField, TextArea, RadioButton, CheckBox.

Label and Command Button for the following entries :

(v) To select a student from a list of class-XII Commerce students.

(vi) To enter the email-id.

(vii) To select the hobbies of the student out of 4 hobbies given

(viii) To choose the gender(male or female)

Ans:

i) jCombobox

ii) jTextfield

iii) jCheckbox

iv) jRadioButton

( ½ mark each )

Page 67: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to
Page 68: UNIT 1 COMPUTER NETWORKING, OPEN SOURCE SOFTWARE … · COMPUTER NETWORKING, OPEN SOURCE SOFTWARE NETWORKING CONCEPTS Brief Summary of the Chapter: In this chapter we are going to