0% found this document useful (0 votes)
4 views

12 Networking SQL

The document outlines the syllabus and fundamental concepts of computer networks, including the evolution of networking, data communication terminology, transmission media, network devices, and protocols. It discusses the advantages and drawbacks of computer networks, various types of transmission media (wired and wireless), and the significance of protocols in ensuring effective communication. Additionally, it covers key network devices such as modems and network interface cards, as well as the historical development of networks from ARPANET to the modern Internet.

Uploaded by

keshavsingh6495
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

12 Networking SQL

The document outlines the syllabus and fundamental concepts of computer networks, including the evolution of networking, data communication terminology, transmission media, network devices, and protocols. It discusses the advantages and drawbacks of computer networks, various types of transmission media (wired and wireless), and the significance of protocols in ensuring effective communication. Additionally, it covers key network devices such as modems and network interface cards, as well as the historical development of networks from ARPANET to the modern Internet.

Uploaded by

keshavsingh6495
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

COMPUTER NETWORKS

Syllabus:
Evolution of networking: introduction to computer networks, evolution of networking (ARPANET,
NSFNET, INTERNET)
● D t communic tion termino ogie concept of communic tion, component of d t communic tion
(sender, receiver, message, communication media, protocols), measuring capacity of
communication media (bandwidth, data transfer rate), IP address, switching techniques (Circuit
switching, Packet switching)
● Tr n mi ion medi Wired communic tion medi (Twi ted p ir c b e, o-axial cable, Fiber-optic
cable), Wireless media (Radio waves, Micro waves, Infrared waves)
● Network device (Modem, Ethernet c rd, RJ , Repe ter, Hub, Switch, Router, G tew y, W F c rd)
● Network topo ogie nd Network type type of network (PAN, LAN, MAN, WAN), networking
topologies (Bus, Star, Tree)
● Network protoco HTTP, FTP, PPP, SMTP, T P P, POP3, HTTPS, TELNET, Vo P
● ntroduction to web ervice WWW, Hyper Text M rkup L ngu ge (HTML), Exten ib e M rkup
Language (XML), domain names, URL, website, web browser, web servers, web hosting

Evolution of networking:

What is Network?
It is a collection of Inter-connected computers and other devices that are able to communicate with
each other i.e. it is a collection of hardware and software components that are connected together for
effective information interchange wherein, one system/device is the sender and the other is the
receiver.

Advantages of Computer Network:


a. Resource sharing
b. Remote access
c. Cost saving
d. Collaborative user interaction
e. Time saving
f. Enhanced storage
Drawbacks
a. Poor handling can cause chaos
b. If the files are stored centrally, it may sometimes become impossible to carry out any task
c. File security becomes high priority task in case of shared network
d. One may need specified staff to ensure data security
62
Evolution of Networking

Network Communication dates back to the earliest times since the evolution of human race on earth.
All the living organisms communicate with each other on one way or the other. The early man used to
communicate using the symbolic language, then with the development of modern languages and
intelligence, the communication media came into picture. And, with the advent of computer systems,
the data communication became important so as to take necessary decisions and pass the messages
quickly.
In year 1967, the very first network came into existence, namely-ARPANET.

ARPANET

(Advanced Research Project Agency Network) that was designed to survive any nuclear threat. It was the
first system to implement the TCP/IP protocol suite and was based on Client-Server architecture.

NSFNet

National Science Foundation Network, was started in 1980 with a view to enhance Academic and
Scientific Research. It connected its server with the ARPANET in year 1986. In the year 1990, the
NSFNet, ARPANET and other smaller networks clubbed together to form the INTERNET
(Interconnected Networks) and hence the foundation of modern INTERNET was laid down.

Internet:

It is the global network of interconnected devices that may/may not follow same set of rules, and connect
together for sharing information and establishing communication. It is made up of two parts:
a. IntraNet:
The word Intra means inside or within. Therefore, Intranet means
the network within an organization. It is created using the
protocols of LANs and PANs. Example: Wipro uses internal
network for business development
b. Extranet:
It is the network that lies outside the limits of the IntraNet. Dell
and Intel use network for business related operation.
c. Interspace:
It is the client-server software program that allows multiple users to communicate with each
other using real-time audio, video and text in a dynamic 3D environment.

63
Data communication terminologies:

COMMUNICATION

The exchange of information between two or more networked or interconnected devices is called
communication. These devices must be capable of sending /receiving data over a communication
medium.
Data:
It is raw facts and figures that are yet to get a defined meaning. Examples: 11, A123x@r67Y, etc.
Information:
The processed form of data that had a defined meaning is known as the information. Examples: Roll No.
11, Password: A123x@r67Y, etc.

COMPONENTS OF DATA COMMUNICATION

The five main components of data communication are as follows:


SENDER: Sender is a device which is capable of sending data over a communication network. In data
communication Sender is also called Source.
RECEIVER: Receiver is a device which is capable of receiving data over a communication network. In
data communication Receiver is also called Destination.
MESSAGE: message is the information being exchanged between a sender and a receiver over a
communication network.
COMMUNICATION MEDIUM: Communication medium is the path or channel through which the
information is moved from the sender to the receiver. A communication medium can be either
wired/guided or wireless/unguided.

PROTOCOLS: The set of standard rules which are followed in data communication are known as Data
Communication Protocols. All the communicating devices like sender receiver and other connected
devices in the network should follow these protocols.
Why Protocols are needed? The communicating devices may be in different geographical areas. The
speed of these devices may be different. Also, the data transfer rates of different networks may be
different. These complexities make it necessary to have a common set of rules to ensure the secure
communication of data.
Examples of some commonly used Protocols in data communication are given below:
∙Transmission Control Protocol (TCP)
∙Internet Protocol (IP)
∙File Transfer Protocol (FTP)
∙Simple Mail Transport Protocol (SMTP)
∙Hyper Text Transfer Protocol (HTTP)

MEASURING CAPACITY OF COMMUNICATION MEDIA

Capacity of a communication channel means the maximum quantity of signals that a communication
channel can carry. The capacity of a communication medium is measured by its bandwidth and data
transfer rate.
Data Channel:
It is a medium to carry information or data from one point to another.
Baud:
It is the measurement of the data transfer rate in a communication channel.
Bits per Second:
64
It is the rate by which the data transfer is measured. It is used to measure the speed of information
through high-speed phone lines or modems. It is denoted ad Bps, kbps, Mbps, Gbps, etc.
Bandwidth:
It is the difference between the highest and lowest frequencies in a channel. The high bandwidth
channels are known as Broadband Channels, and the low bandwidth channels are called as the
Narrowband Channels.
Data Transfer Rate:
It is the amount of data transferred per second by a communication channel or a computing storage
device. When applied to the data transmission rate, the abbreviations like K, M, G, T are added to the
data rate that denote Kilo, Mega, Giga, and Tera respectively. They work in the power of 1024.
Example 1 GB = 1024 MB, 1 TB = 1024 GB.

IP ADDRESS

IP address or Internet Protocol address is a unique numeric address assigned to every device
connected to a network. It uniquely identifies every node connected to a local network or internet. An
IP address allows computers to send and receive data over the internet. They can also be used to track
down a user's physical location.
There are two versions for IP address IPV4 and IPV6. IP addresses are binary numbers but are typically
expressed in decimal form (IPv4) or hexadecimal form (IPv6) to make reading and using them easily.
The commonly used IP address is IPV4. An IPv4 address consists of four numbers, each of which
contains one to three digits, with a single dot (.) separating each set of digits. Each of the four numbers
can range from 0 to 255. Example IP address: 24.171.248.170

Switching Techniques:

These are used for transmitting data across the networks. The various switching techniques are:
a. Circuit Switching:
Here, the connection between the sender and receiver is established first, and then the data is transmitted
from the source computer to destination computer. Before transferring the data, a call setup is required
for establishing connection between sender and receiver. It is best for connections that require consistent
bit rate for communication.
Advantages:
1. Since a dedicated communication channel is set up before communicating the message, the data
transmission is reliable and is suitable for long and continuous communication.
2. Circuit switching uses fixed bandwidth as well as data rates.
3. As the data is communicated continuously, no need of sequencing or re ordering it at the receiving
end.
Disadvantages:
1. Time required to setup a physical connection between the sender and the receiver makes delay in
communication
2. Since a communication channel is dedicated for a particular transmission, it cannot be utilized for
other communication, even if the channel is free.
3. More expensive since connection has to be established every time before communication.
b. Packet Switching:
It is the most efficient data communication technique used to send and receive data over the internet.
Instead of using the dedicated circuit for data communication, the data is independently routed through
the network and reassembled at the destination computer system. Data is divided into fixed size packets
before transmission. Each packet contains a fraction of data along with addressing information.
65
Advantages:
1. Packet switching is effective type of data transmission technique as it effectively utilizes the
communication channel. Multiple users can share the channel simultaneously utilizing the bandwidth
effectively.
2. It is cost effective and easy to implement compared to circuit switching.
3. As the messages are sent as small sized packets, the data transmission is quick and easy.

Disadvantages:
1. In packet switching the movement of packets may not be in correct order. Hence it is not suitable for
voice communication.
2. Unorganized movement of packets makes it necessary to implement proper sequencing and reordering
techniques.
3. As the packets flow through multiple paths from the source to the destination, complex security
protocols are required to ensure reliable communication.
c. Message Switching:
In this technique, the message is sent to the switching office first that stores the data in the buffer, and
then the switching office finds the free link to the receiver, and then sends the data to the receiver. There
is no limit to the size of the message block to be transmitted over the network.

Transmission media:
All the computers or connecting devices in the network, must be connected to each other by a
Transmission Media or channel. The selection of Media depends on the cost, data transfer speed,
bandwidth and distance.Transmission media may be classified as-
Guided Media (Wired )
Twisted Pair Cable
Coaxial Cable
Optical Fiber
Unguided Media (Wireless)
Microwave
Radio wave
Satellite
Others (Blue tooth, Infrared and Laser etc.)
66
1.Twisted Pair Cables
It is most common type of media consisting insulated pairs of wires twisted around each other. Twisting
helps to reduce crosstalk and Electro Magnetic Interference.
It comes in Shielded (STP) or Unshielded Twisted Pair (UTP) types. In UTP, pairs are covered by an
extra insulation to further reduce the signal interference.
CAT 5 and CAT 6 are commonly used in the networking.
Advantages:
It is simple, flexible, low weight and inexpensive.
It is easy to install and maintain and requires RJ-45 Connector.
Disadvantages:
Suitable for short distance (up to 100 mt.). For long distance Repeater is required.
It supports low bandwidth and offers up to 100 Mbps speed.

2.Coaxial cable
This types of cable consists a solid insulated wire core surrounded by wire mesh or shield, each
separated by some find of foil or insulator. The inner core carries the signal and mesh provides the
ground. Co-axial Cable or coax, is most common in Cable TV transmission. Generally it is used in Bus
topology network.
It is two type- Thinnet (185 mt), Thicknet(500 mt)
A connector known as a vampire tap or BNC connector to connect network devices.
Advantages:
• It offers high bandwidth and better speed than other cables.
• Suitable for Broadband transmission (cable TV) and can be used in shared cable
network.
Disadvantages:
• It is expensive compared to Twisted Pair cable.
• Not compatible with modern cables like UTP and STP

3. Fiber Optic

Optical Fiber consists of thin glass or glass like material and carry light. Signal are modulated and
transmitted in light pulses from source using Light Emitting Diode (LED) or LASER beam.
The Fiber cable consists Core (Glass or Plastic) covered by Cladding, which reflects light back to the
core. Also a Protective cover including Buffer Jacket is used for extra protection.
Two types of transmission i.e. Single mode (LESER) and Multimode (LED) is possible.
Advantages:
67
• It is free from EMI since no electrical signal are carried.
• Offers secure and high speed transmission up to a long distance.
Disadvantages:
• Expensive and quite fragile.
• Complicated Installation procedure and difficult to join two fiber or broken fiber.
• Not suitable for domestic purposes due to high maintenance cost.

Wireless Transmission Media


∙In wireless communication technology, information travels in the form of electromagnetic signals
through ir. ∙ E ectrom gnetic pectrum of frequency r nging from 3 KHz to 9 THz i v i b e for
wireless communication.
∙Radio Waves
1. Waves of frequency range 3 KHz - 1 GHz
2. Omni-directional, these waves can move in all directions
3. Radio waves of frequency 300KHz-30MHz can travel long distance
4. Susceptible to interference
5. Radio waves of frequency 3-300KHz can penetrate walls
6. These waves are used in AM and FM radio, television, cordless phones.

Microwaves
1. Electromagnetic waves of frequency range 1GHz - 300GHz.
2. Unidirectional, can move in only one direction.
3. Cannot penetrate solid objects such as walls, hills or
mountains.
4. Needs line-of-sight propagation i.e. both communicating
antenna must be in the direction of each other.
5. Used in point-to-point communication or unicast communication such as radar and
satellite.
6. Provide very large information-carrying capacity.

Infrared waves
1. Electromagnetic waves of frequency range 300GHz - 400THz.
2. Very high frequency waves.
3. Cannot penetrate solid objects such as walls.
4. Used for short-distance point-to-point communication such as mobile-
to mobile, mobile- to-printer, remote-control-to-TV,

68
Bluetooth:
Bluetooth is a short-range wireless technology commonly used for
connecting devices like smartphones, laptops, and peripherals (e.g., wireless
keyboards, mice, and headphones). It
operates in the 2.4 GHz frequency band and supports relatively low data transfer
rates compared to Wi-Fi.

Satellite Communication:
Satellite communication involves transmitting data to and from
Earth through communication satellites. It is used for long-distance
communication in remote areas or where traditional wired
communication is not feasible.

Network devices
For smooth functioning of computer network, other than computers and wirings, many devices play an
important role. These devices are known as the Network Devices.

Modem:
Modulator-Demodulator allows us to reach the global network with ease. It is used to send and receive
the data over the telephone lines or cable connections. Since, the ordinary telephone lines cannot carry
the digital information, a modem changes the data from analog to digital format and vice versa.
Modems are of two types:
• Internal modems: The modems that are fixed in the computer systems are Internal Modems.
• External Modems: The modems that are connected externally are called External Modems.

Registered Jack-45 (RJ-45):


Registered Jack-45 of Rj-45 is an 8-wire connector that is
commonly used on computers in a local area network. It looks
similar to a standard phone connector (RJ-11), but is wider than
the RJ-11 connector, as it uses 8 wires instead of 4. These are
used to connect computers in Ethernet LAN.
NIC:
Network Interface Card (NIC) is a device used to connect the network with the Internet. It is sometimes
called ad the TAP (Terminal Access Point). Since different manufacturers give different names to this
device, hence, it is sometimes referred to as NIU (Network Interface Unit).
The NIC has a unique physical address to each card, and it is known as MAC (Media Access Control)
Address.
MAC Address:
It is a b-byte address assigned to each NIC card and is separated by a colon. Example:
10 : E8 : 05 : 67 : 2A : GS
Manufacturer ID Card No.

Ethernet Card:
It is a LAN architecture developed by Xerox Corp along with the DEC
and Intel. It uses a bus or star topology for data transfer and can attain a

69
speed of up to 10 Gbps. It can connect devices in both wired and wireless
LAN or WAN.
Router:
It is responsible for forwarding data from one network to another. The main purpose of router is sorting
and distribution of the data packets to their destination based on the IP address. The router uses the
Logical address scheme.

Hub:
It is a device that connects several devices to a network and transmits the information to all the connected
devices via broadcast mode.
The hubs are of two types:
Active hubs: these electrically amplify the signal as it moves from one
connected device to another.
Passive hubs: these allow the signals to pass from one device to another
without any change.

Switch:
It is a device that is used to divide network into smaller networks
called subnets or LAN segments. This helps to avoid network traffic
as it divides the traffic into smaller parts. It is responsible for
filtering of data packets and then transmission over the network.

Repeaters:
A repeater is a network device that amplifies, restores and re-broadcasts signals for long-distance
transmission.

Bridge:
It is a device that links two networks. It is smart system that knows which system lies on which side and
in which network. These can handle the networks that follow different protocols.

Gateway:
It connects two dissimilar networks and establishes an intelligent connection between local and external
networks with completely different architecture. It is also known as protocol translator.

Wi-Fi Card:
It is the LAN adapter whether external or internal with a built-in antenna and
wireless radio. Its main benefit is that it allows a computer to setup the system
as workstation without considering the availability of hard- line access.

Network topologies and Network types:


Network Topologies
The term topology means the way of connecting different systems to form a network. Some of the
commonly used topologies are as follows:
Bus Topology:
• In a bus topology, all devices are connected to a single communication line called the bus or
backbone.

70
• Data is transmitted from one end of the bus to the other, and all devices receive the data
simultaneously.
• It is relatively easy to implement and works well for small networks. However, a single break in
the bus can disrupt the entire network.
Star Topology:
• In a star topology, all devices are connected to a central hub or
switch.
• Each device has a dedicated point-to-point connection to the
central hub.
• If one device or cable fails, only that specific connection is
affected, and the rest of the network remains operational.
• It is straightforward to add or remove devices, making it scalable.
Ring Topology:
• In a ring topology, devices are connected in a closed loop,
forming a ring.
• Each device is connected to exactly two other devices, creating
a continuous circular pathway for data transmission.
• Data travels in one direction around the ring until it reaches the
intended recipient.
• Failure of any single device or connection can disrupt the entire
network.
Mesh Topology:
• In a mesh topology, every device is connected to every other device
in the network. It provides multiple redundant paths for data
transmission, ensuring high reliability and fault tolerance.
• Mesh topologies are commonly used in critical applications where
network uptime is crucial. However, the extensive cabling and
complex connections can be expensive and challenging to manage.

Hybrid Topology:
• A hybrid topology is a combination of two or more basic topologies
(e.g., star- bus or star-ring).
• It leverages the advantages of different topologies and can be
designed to suit specific networking needs.
• Hybrid topologies are commonly used in large networks or in
scenarios with diverse connectivity requirements.

Tree Topology:
Tree topology is a network design where devices are organized in a hierarchical structure, resembling a
tree with a root node at the top and branches of nodes extending downward.

71
The root node acts as the central hub, and devices are connected to it directly or through intermediary
devices like switches or hubs.

This creates a multi-level structure, with each level representing a different generation of devices. Tree
topology is commonly used in wide area networks (WANs) to interconnect different local area networks
(LANs) or subnets in a hierarchical manner. It is also found in some enterprise networks and
telecommunications networks.

Advantages of Tree Topology:


Scalability: The network can be easily expanded by adding more devices or branches.
Centralized Management: The root node allows for centralized control and easy network
management.
Fault Isolation: Issues in one branch do not affect the rest of the network, simplifying troubleshooting.
Point-to-Point Connections: Devices have dedicated connections, reduced data collisions and
improving performance.
Disadvantages of Tree Topology:
Dependency on Root Node: The network's functionality relies on the root node, and its failure can
disrupt the entire network.
Cost: Implementing tree topology can be expensive, especially for larger networks.
Complex Cabling: As the network grows, the cabling can become more complex and difficult to
manage.

Types of Networks:

The computer networks are divided into the following parts based on the network span and number of
systems connected.
1. PAN - Personal Area Network
2. LAN - Local Area Network
3. MAN - Metropolitan Area Network
4. WAN - Wide Area Network
PAN – Personal Area Network:
A personal area network (PAN) is designed for interconnection between devices typically located
72
within the range of 10 meters approx. These are used to connect personal use devices like
smartphones, laptops, tablets, wearable devices and other peripherals.
Bluetooth and Wi-Fi are the commonly used technologies for establishment of PANs. PANs find
applications in various scenarios, such as:
• Wireless Headsets: For establishing connections between computers/smart phones with
headsets/head phones.
• Personal health Devices: For pairing fitness related trackers/ smart phones for monitoring
health and workout timings.
• Home automation: For connecting home use and safety devices
to a central controller such as smart phone.
• File Transfer: For ensuring smooth and fast transfer of files
between laptops, tablets etc.
• Security: To enhance and implement security protocols like
encryption to ensure data privacy and prevent unauthorized
access to the connected devices.
• Ad-Hoc Networking: These are often used as Ad-Hoc networks for use as and when required.
These networks are established and disbanded as per the requirement. Also, the devices can
quickly connect to the network and disconnect whenever they are in or out of range.
LAN – Local Area Network
A local area network (LAN) is designed for implementation between devices that are located within a
limited geographical area generally within the range of approximately 1 – 10 KM. this network can be
setup using wired or wireless transmission medias, and can be controlled by an individual or an
organization. It is also known as Intranet as it is a network within an organization.
• These can use various topologies such as star, bus, ring, or mesh. The most commonly used
topology for LANs is the Star topology, where all the devices are connected to a central switch
or hub.
• LANs offer high data transfer rates as the network has a limited span enabling fast
communication and resource sharing.
• The network administrator can easily manage and monitor
devices in a LAN.
• The LANs are commonly used in offices, homes, and
educational institutions.
• LANs implement security measure such as Firewalls, access
controls, and encryption to protect data and unauthorized
access to the network at a much cheaper cost.
MAN – Metropolitan Area Network:
It is a network infrastructure that covers a larger geographical area than a Local Area Network (LAN) but
smaller than the Wide area Network (WAN). These use various connectivity technologies including
fiber-optic cables, microwave links and wireless technologies to interconnect devices and networks
within the area of a city and ranges between 5 – 100 KMs.
• MANs often use high speed technologies like fiber- optic
cables, microwave links to provide fast and reliable data
transmission between network nodes.
• These are often used by government agencies and large
educational institutions to interconnect LANs and share
resources like files, databases, and applications.
• They often use different Internet Service Providers
• (ISPs) for effective data communication thereby strengthening the backbone of the Internet.
• These can be either privately owned, cooperative, or government owned to provide services to

73
the public.
• These networks have grown rapidly in the past few years as the spans of cities have increased
rapidly.
• The network security plays a crucial role in the MANs and increases the cost incurred due to
wide area coverage.
• They play a significant role in interconnecting local networks within a city, enabling efficient
data exchange and facilitating communication among various entities in the metropolitan
region.
WAN – Wide Area Network:
It is a type of computer network that covers a vast geographical area spanning among cities, countries,
or even continents.
• These use various technologies like leased lines, fiber optic cables,
and satellite links.
• Since it is the expanded form of MAN, it is considered as the
backbone.

• These allow the efficient transfer of data, voice, and videos between different nodes thereby
enabling communication and resource sharing between devices at far away distances.
• These are designed with redundancy and backup links to ensure high fault tolerance thereby
minimizing disruptions and maintaining connectivity even if some network segment fails.
• Data Security becomes the key issue as it becomes essential to protect data from unauthorized
access and cyber threats. Thus encryption, firewalls and virtual
• private Networks (VPNs) play an important role in ensuring data security.
• These may have varying speeds and bandwidth depending upon the technology used and the
distance between network nodes.
Note:
Virtual Private Network: It is used to access the public network as a private network.
It ensures enhances security, and safety of data.
Difference between LAN, MAN, and WAN

74
NETWORK PROTOCOL:
A protocol means the rules that are applicable for a network. Protocols define standardized formats for
data packets, techniques for detecting and correcting errors etc.
HTTP - Hyper Text Transfer Protocol
• HTTP is used to transfer data across the web. HTTP specifies how to transfer hypertext (linked
web documents) between two computers.
• It allows users of the World Wide Web to exchange information found on web pages.
• When accessing any web page entering http:// in front of the address tells the browser to
communicate over HTTP.
• Clients (web browsers) send requests through request object of http to web servers for web
pages, resources etc

FTP- (File Transfer Protocol)


It is a standard internet protocol provided by TCP/IP used for transmitting the files from one host to
another. It is mainly used for transferring the web page files from their creator to the computer that acts
as a server for other computers on the internet. It is also used for downloading the files to computer from
other servers.
PPP- Point-to-Point Protocol
(PPP) is protocol that is used to connect one computer system to another. Computers use PPP to
communicate over the telephone network or the Internet. A PPP connection exists when two systems
physically connect through a telephone line. You can use PPP to connect one system to another.
SMTP (Simple Mail Transfer Protocol.)
SMTP is a set of communication guidelines that allow software to transmit an electronic mail over the
internet is called Simple Mail Transfer Protocol.
• It is a program used for sending messages to other computer users based on e-mail addresses.
• It provides a mail exchange between users on the same or different computers, and it also
supports:
• It can send a single message to one or more recipients.
• Sending message can include text, voice, video or graphics.
• It can also send the messages on networks outside the internet.
• The main purpose of SMTP is used to set up communication rules between servers.
TCP/IP (Transmission Control Protocol/ Internet Protocol)
• It is a set of standardized rules that uses a client-server model of communication in which a user
or machine (a client) requests a service by a server in the network.
• The IP protocol ensures that each computer or node connected to the Internet is assigned an IP
address, which is used to identify each node independently.
• TCP ensures that the message or data is broken into smaller chunks, called IP packets. Each of
these packets are routed (transmitted) through the Internet, along a path from one router to the
next, until it reaches the specified destination. TCP guarantees the delivery of packets on the
designated IP address. It is also responsible for ordering the packets so that they are delivered in
sequence.
POP3
Post Office Protocol version 3 (POP3) is a standard mail protocol used to receive emails from a remote
server to a local email client. POP3 allows you to download email messages on your local computer and
read them even when you are offline
HTTPS
The more secure and advanced version is HTTPS. It is used for secure communication over a computer
network.
HTTPS provides,
• Encryption: Encrypting the exchanged data to keep it secure from eavesdroppers.
• Data integrity: Data cannot be modified or corrupted during transfer.
• Authentication: Proves that your users communicate with the intended website.

75
Telnet
• The main task of the internet is to provide services to users. For example, users want to run
different application programs at the remote site and transfers a result to the local site. This
requires a client-server program such as FTP, SMTP. But this would not allow us to create a
specific program for each demand.
• The better solution is to provide a general client-server program that lets the user access any
application program on a remote computer. Therefore, a program that allows a user to log on to a
remote computer
VoIP
VoIP stands for Voice over Internet Protocol. It is also referred to as IP telephony, internet telephony, or
internet calling. It's an alternative to a public switched telephone network (PSTN)

INTRODUCTION TO WEB SERVICES

World Wide Web (WWW):


It is a global system of interconnected documents and resources that are accessible over the internet.
It operates on the basis of hypertext links which allows the users to navigate between different
documents and multimedia content.

Hypertext:
The web is built on the concept of hypertext where documents are linked to each other through
hyperlinks. These allow the users to navigate from one place to another.
URL:
Each web page and the resource on the web can be accessed using the unique address called as the URL
(Uniform Resource Locator).

Web Browser:
To access and view web pages on the internet (WWW), we need to have an application named as Web
Browser. There are many web browsers available on the internet like Google Chrome, Microsoft Edge,
and Mozilla Firefox etc.

Web Servers:
These are the computers that host websites and web applications. These respond to requests from
web browsers, and provide the requested web pages and resources back to the users.

Weblinks:
These are the links available within the web pages that allow the users to access the pages that contain
the topic related content.

HTML:
Hyper Text Markup Language (HTML) was developed with a view to structure and organize the static
web pages. These are the symbols and codes that allow the used to develop web pages that can run
over the internet. These define the layout, format, and linking of text, multimedia, and other elements
within a web page. It uses tags for presentation of content.

XML:
Extensible Markup Language (XML) is designed to carry and store data in a structured and platform-
independent format. These use the user-defined custom tags to represent specific data fields and
structures. These are self-descriptive and make it easier for different applications to understand and
interpret data.
76
Websites:
These are the collections of various web pages and data that are accessible for all, and are available on
the internet. Many types of restrictions such as screenshot protections, copying of data can be
implemented on the websites for data protection.

Web Hosting:
This refers to the service of providing storage space, server resources, and internet connectivity to
make websites and web applications accessible to users over the internet. It allows individuals,
businesses, and organizations to publish their websites on the World Wide Web, making them
available to visitors and users worldwide.
• Web hosting companies maintain powerful servers designed to store website files, databases,
and other contents required for website operations.
• These typically handle the maintenance tasks of the registered websites.
• These ensure proper backup and recovery of the lost data (if any) while accessing it, and cope
up with potential threats that can destroy data.

Domain Name Service (DNS):


It is a vital internet infrastructure that converts domain names into IP addresses, thereby enabling the
users to navigate the web using easily recognizable and memorable names instead of numerical IP
addresses.

Internet Protocol (IP) Address:


It is a unique serial number assigned to devices on a network, facilitating communication and data
exchange between them over the internet, and other IP based networks. These are of two types:
• IPv4:
These are the addresses that consist of 32-bit addressing scheme. Example:
192.168.0.24
• IPv6:
This uses 128 bit addressing scheme represented by eight groups of hexadecimal digits separated
by colons. Example: 2001:0db8:85a3:0f00:00a0:8a2e:0370:7334.

The potential growth of internet-connected devices led to exhaustion of available IPv4 addresses. To
cope up with this problem, the IPv6 addressing scheme was introduces that provides a significantly
large pool of IP addresses to accommodate the expansion of internet.

77
EXPANDED FORMS
ARPANET - Advance Research Project Agency Network
NIU - Network Interface Unit
LAN - Local Area Network
MAN - Metropolitan Area NetworkWAN= Wide Area NetworkISP
- Internet Service ProviderOSS= Open Source Software ISDN
- Integrated Service Digital Network
FLOSS - Free Libre Open Source Software
NIC - Network Interface Card
UTP - Unshielded Twisted Pair
STP - Shielded Twisted Pair
MODEM - Modulator Demodulator
RJ-45 - Registered Jack -45
XML - Extensible Markup Language
FTP - File Transfer Protocol
TCP - Transmission Control Protocol
SMTP - Simple Mail Transfer Protocol
POP3 - Post Office Protocol 3 (Version 3)
IMAP - Internet Message Access Protocol
IP - Internet Protocol
SLIP - Serial Line Internet Protocol
PPP - Point To Point Protocol
PDA - Personal Data Assistant
GSM - Global System For Mobile
SIM - Subscriber Identity Module
CDMA - Code Division Multiple Access
WLL - Wireless In Local Loop
WWW - World Wide Web
URL - Uniform Resource Locator
DHTML - Dynamic Hyper Text Markup Language
OSS - Open Source Software
GNU - GNU’s Not Unix
FSF - Free Software Foundation
OSI - Open Source Initiative
HTTP - Hyper Text Transfer Protocol
HTTPS - Hyper Text Transfer Protocol Secure
HTML - Hyper Text Markup Language
W3C - World Wide Web Consortium
ASP - Active Server Pages
JSP - Java Server Pages

78
Model Questions

Multiple Choice Questions

1. Which one of the following devices will you suggest for connecting all the computers within
each block of a building?
a. Switch/Hub b. Modem
c. Telephone d. Repeater
2. XYZ company is planning to link its head office situated in New Delhi with the offices in hilly
areas. Suggest a way to connect it economically:
a. Micro waves b. Coaxial cable
c. Fibre optic d. Radio waves
3. Which of the following is/are not communication media?
a. Microwaves b. Optical Fiber cable
c. Node d. Radio waves
4. The ……………….. is over which the messages are sent.
a. Signal b. Channel
c. Protocol d. Sender
5. Which of the following is not a unit of data transfer rate?
a. Abps b. Bps
c. Kbps d. Gbps
6. The number of bits transmitted per second is called .
a. Bit rate b. Baud rate
c. Data rate d. Transfer rate
7. The messages sent over a network are divided into small pieces called .
a. Units b. Chunks
c. Packets d. Bits
8. A ………………… is established in circuit switching before actual communication.
a. Switch b. Link
c. Protocol d. Hub
9. The is the difference between upper and lower frequencies of a communication medium.
a. Bandwidth b. Data rate
c. Latency d. communication speed
10. The unit of Bandwidth is?
a. Khz b. Hz
c. Watt d. KW
11. For every device connected to a network, there will be a unique _ _.
a. Name b. ID
c. IP Address d. IC

12. Raw data is processed to get .


a. File b. Information
c. Communication d. Message
13. Which of the following is/are true regarding packet switching?
1. The packets of data are sent simultaneously through different paths.
2. The free communication channel is utilized properly.
79
3. Protocols are used for the reliable receipt of data at the receiver end.
4. Sequence numbers are assigned to the data packets.
a. Only 1 b. Both 1 & 4
c. Both 2 & 4 d. All of the above.
14. is applicable in the case of long voice data communication.
a. Protocols b. Circuit Switching
c. Packet Switching d. None of these.
15. Which of the following is/are true in the case of IP address?
1. IP address can be used to trace the actual physical location of a device in the network.
2. A printer connected to a network will also have an IP Address.
3. Two devices can have same IP Address.
4. The IP Address can be formed of any number.
a. Only 1 is true b. Only 1 & 2 are true
c. Options 1, 2 and 4 are true. d. All the options are true.
16. Selecting a communication path among multiple available paths is termed as:
a. Transmission b. Reception
c. Switching d. multiplexing
17. The other name for communication medium is:
a. Channel b. Source
c. Hub d. Switch
18.

The above procedure occurs in the case of .


a. Packet Switching b. Circuit Switching
c. Both a and b d. None of these.
19. What are the three common types of computer networks?
a. ROM, MAN, LAN b. RAM, WAN, LAN
c. MAN, LAN, WAN d. None of the above
20. What is the acronym for LAN?
a. Local Area Network b. Local Access Network
c. Line And Networking d. Line-less Networking

21. Define what a LAN is?


a. Connected devices share the resources of a single processor or server within a small
geographic area
b. Normally find within a business and school
c. These are computers that share resources over a large area
d. None of the above
22. Mr. John is a small businessman who runs Hardware. He has been experiencing problems with
his small accounting department, which he depends on to provide sales reports. Mr. John wants
to share information between his 7 computer stations and have one central printing area. What
type of network would you recommend to Mr. John?
a. MAN b. LAN
80
c. WAN d. SAN
23. WAN covers a larger geographical area than MAN?
a. True b. False
24. A network that consists of both LANs and MANs is called a Wide area network?
a. True b. False
25. Arrange the Following Types of Networks according to their size, from largest to smallest?
a. LAN, WAN, MAN b. WAN, LAN, MAN
c. MAN, LAN, WAN d. WAN, MAN, LAN
26. You are a member of a club that deals with computer networks. The club has to take a project to
build a MAN. Where would this project likely take place?
a. A small building/organization b. University or college
c. Home d. None of the above
27. What is the acronym MAN stand for?
a. Magnetic Access Network b. Metropolitan Area Network
c. Multi-Area Network d.. Multi-Access net
28. In your school there is a library, and you can use the internet to do research, this library will
most likely be a WAN network?
a. True b. False
29. Types of Networks are Categories by their Geographical Area cover?
a. True b. False
30. Metropolitan Area Network Normally Require an Internet connection?
a. True b. False
31. What’s a web browser?
a) A kind of spider
b) A computer that store www files
c) A person who likes to look at websites
d) A software program that allows you to access sites on the World Wide Web
32. A ………………… is a document commonly written and is accessible through the internet or
other network using a browser?
a) Accounts b) Data c) Web page d) Search engine

33. Which of the following is used to read HTML code and to render Webpage?
a) Web Server b) Web Browser
c) Web Matrix d) Weboni
34. Which of these tech company owns Firefox web browser?
a) Lenovo b) IBM
c) Apple d) Mozilla
35. Which of the following browsers were/are available for the Macintosh?
a) Opera b) Safari
c) Netscape d) All of these
36. What is the name of the browser developed and released by Google?
a) Chrome b) Googly
c) Heetson d) Titanium
37. Which of the following is a Web Browser?
a) MS-office b) Notepad
c) Firefox d) Word 2007

81
38. Which of the following is not a web browser?
a) Chrome b) Microsoft Edge
c) Safari d) Ubuntu
39. URL stands for
(a) Uniform Research Limited (b) Uniform Resource Locator
(c) Uniform Resource Labs (d) Uniform Research Locator
40. LinkedIn is an example for ……….. website.
(a) E-learning (b) E-commerce
(c) Video conferencing (d) Social networking
41. Which of the following is not a web service?
(a)Distance Learning (b) E-mailing
(c) Video conferencing (d) Social networking
42. Web browsers are also called as …………………
(a) Web Servers (b) Web Clients
(c) Web Hosting (d) Web Designing
43. W43orking of WWW based on …………………. architecture.
(a) Peer-To-Peer architecture (b) Client-Client architecture
(c) Client-Server architecture (d) Server-Server architecture
44. ………………….. is a computer software capable of requesting, receiving & displaying
information in the form of webpages.
(a) Web Servers (b) Web Browsers
(c) Web Designers (d) Web Camera
45. A ………………. is a program or automated script which browses the World Wide Web in a
methodical, automated manner.
(a) Web Servers (b) Web Browsers
(c) Web Designers (d) Web Crawler

46. ………………. is a mark-up language that helps in developing web pages.


(a) HTTP (b) HTML
(c) XML (d) C++
47. ………………. is a language used to transport data over internet.
(a) HTTP (b) HTML
(c) XML (d) C++
48. ……………………. is a set of rules for communication between two computers over a network.
(a) Modem (b) Protocol
(c) Switch (d) IP address
49. In web services, the communication takes place between
(a) Two electronic devices (b) Two human beings
(c) Two spiders (d) None of the above
50. Web services means services provided by
(a) Microsoft (b) Google
(c) BSNL (d) World Wide Web

82
VERY SHORT ANSWER TYPE QUESTIONS(1-MARK)

• Give examples for Wired media and Wireless media.


• Name the device which connects multiple nodes to form a network. It redirects the received
information only to the intended node(s).
• Identify odd one out of the following:
Optical Fiber/Coaxial Cable/ Bluetooth/Twisted Pair Cable. Give reason for your answer.
• Ms. Emily is planning to connect 20 computers in her computer lab to form a local area network.
Suggest an intelligent network device to connect all the computers.
• Which communication channel is/are suitable in each of the following situations?
Transfer of data from one mobile to another.
Communication in a hilly area.
• Tagore Consultancy is planning to link its head office at Kolkata with the offices at Ernakulam.
Suggest an economic way to set up a connection between these offices. The company is ready to
compromise on the speed of the connectivity.
• Mr. Roy, General Manager of Infopark Solutions discovered that the communication between his
comp ny’ main office and HR office is extremely slow and signals drop quite frequently. These
offices are 150 meters away from each other and connected by an Ethernet cable. Suggest him a
device which can be installed between the offices for smooth communication.
• Name the transmission media best suitable for connecting to hilly areas.
• How many pair of wires is there in twisted pair cable (Ethernet)?
• Name a device that forwards data packets along networks.
• What is the full form of WWW?
• What is the full form of Internet?
• Who invented the WWW in 1989?

• Special oftw re’ that is used to view webpages are
• are used to store webpages, so whenever a request, it will serve the request.
• re progr m computer u ed to tore inform tion’ in the form of webpages.
• Web pages that are linked to each other via _
• _ protocol is used to transfer web pages over internet.
• Full form of HTTP?
• is a massive collection of digital pages to access information over the Internet
• Write any 2 differences between HTML & XML?
• is a real-time communication between two or more users via computer.
• helps us to learn anywhere using Internet.
• allows customers to conduct financial transactions on a secure Website.
• Internet can be used to get reservation of trains and air planes through
service.
• helps to create and maintain social relationship over web.
• Expand the following abbreviations:
HTTP
XML
HTTPS
HTML

83
VoIP
• Name any two common web browsers.
• Full form of Email is
• What out of the following, you will use to have an audio visual chat with an expert
sitting in a faraway place to fix-up technical issues?
• (i) E-mail (ii) VoIP (iii) FTP
• Match the following

Web Services Description


A Video conferencing P Without ever having to go booking office
B E-Shopping Q Self-paced learning modules allow students to
work at their own speed
Each of the end user has a camera as well as
C E-mail R microphone to capture video and audio in real
time and it will be transmitted over internet
D E-reservation S Purchasing products through computers/mobile
devices
E E-learning T Messages normally reaches a recipients account
within seconds

• Match the following

Web Services Applications


A Video conferencing P IRCTC
B E-Shopping Q Diksha App
C E-mail R GEM
D E-reservation S Gmail
E E-learning T Instagram
F Social Networking U VConSol

SHORT ANSWER TYPE (THEORY WITH ANSWERS)

1 Your friend wishes to install a wireless network in his office. Explain him the difference between
guided and unguided media.
Ans Guided media uses cables to connect computers, whereas unguided media uses
waves
2 What are Protocols? Name the protocol used to transfer a file from one device to the other.
Ans Protocols are set of rules that are followed while transmitting data through a computer network.
Protocols determines how to data can be moved securely from a source device to a destination
device. The protocol used for transferring a file from one device to another is the File Transfer
Protocol (FTP)
3 Define communication channel.
Ans A communication channel is the medium through which data is moved from the source to
destination. The communication channel can be either wired or wireless. Wired communication
channel is also called guided medium while wireless communication channel is also called
84
unguided medium.
4 What do you mean by an IP Address? Give an example for IP Address.
Ans An IP Address is a numerical address that uniquely identifies every device connected to a
network or internet. The user’s physical location can be tracked by using an IP Address. IP V4
(IP Version 4) is a popular version of IP Address. IP Address (in IP V4) consists of four set of
numbers separated by a dot. These numbers can range from 0 to 255.
An example IP Address format is given below: 192.158.12.38
5 Differentiate between Circuit Switching and Packet Switching.
Ans In Circuit Switching a physical connection between the sender and the receiver is set up first.
Then, through that physical link, the complete message is communicated continuously. After
completion of the transmission, the physical connection is terminated. In Packet Switching, the
message is split into small units called packets. Then these packets are passed from source to
destination simultaneously through different routes in the network. As the flow of packets are
asynchronous, sequence numbers are assigned to
each packet to facilitate re-ordering of packets at the destination.
6 Define the following: a. Bandwidth b. Data rate
Ans Bandwidth: It is the range of frequencies that can be carried through a communication channel.
The bandwidth of a channel determines its capacity. It is the difference between the highest and
lowest frequencies that can be carried through the channel. The unit of Bandwidth is Hertz (Hz).

Data transfer rate: It is the amount of data moved through a communication channel per unit
time. The units of Data transfer rate are Bits per second (Bps), Kilobits per second (Kbps) ,
Megabits per second (Mbps) or Gigabits per second (Gbps).
7 Explain the components of data communication.
Ans The components of data communication are: Sender, Receiver, Message, Communication
Medium and Protocols.
Sender: The device which sends data through a network is called sender or source.
Receiver: The device which receives data through a network is called receiver or destination.
Message: The data that is communicated between the source and the destination is called
message.
Communication channel: The medium through which the data is carried from the source to
destination is called a communication medium.
Protocols: The set of rules followed while communicating data over a network are called
Protocols.
8 What are the advantages of Packet switching over Circuit switching.
Ans In Packet Switching the communication channel is utilized completely whenever it is free.
Where as in Circuit Switching, once the connection is assigned for a particular communication,
the entire channel cannot be used for other data transmissions even if the channel is free.
Data packets moves simultaneously through different paths in a Packet Switched network,
making the transmission quick and easy. But in the case of Circuit Switched network, there is a
delay in setting up a physical connection between the source and destination before
communicating the actual message.
Packet Switching is cost effective compared to Circuit Switching as there is no need to set up a
connection between the communicating parties every time before the actual communication.
9 Explain why Circuit Switching is not cost effective compared to Packet Switching?
Ans The Circuit Switching is not cost effective like Packet Switching because, in Circuit Switching,
every time there is a need to set up a connection between the sender and the receiver before
communicating the message.
10 Explain how an IP Address become helpful in investigating cyber-crimes.
Ans IP address can be used to trace the physical location of a user connected to a network. By this
many cyber crime can be investigated and traced out efficiently tracking the exact location from
where the cybercrime is carried out.
11 Why Protocols are needed in the case of Data Communication?
85
Ans The communicating devices may be in different geographical areas. The speed of these devices
may be different. Also, the data transfer rates of different networks may be different. These
complexities make it necessary to have a common set of rules i.e., Protocols to ensure the secure
communication of data
12 What is the difference between World Wide Web & Internet?
Ans Internet means interconnected networks that spread all over the world (i.e. the physical
infrastructure), while WWW means the information’s (available in the form of webpages) that
can be accessed through internet.
13 What is a protocol, give some examples?
Ans Protocols are set of rules that are followed while transmitting data through a computer network.
Protocols determines how to data can be moved securely from a source device to a destination
device. The protocol used for transferring a file from one device to another is the File Transfer
Protocol (FTP)

14 What is the difference between E-mail and chat?


Ans In order to chat, you need to have an account on the same service as the person you are chatting
with. e.g. on the other hand, in case of E-mail, it is not necessary, i.e. you can have an account
from any provider and you can establish your own.
15 What are cookies?
Ans Cookies are files stored temporarily on www browser’s computer, which allow the www server
to store persistent information associated with browsing user on user’s system.
16 What is the difference between domain name and IP address?
Ans IP addresses look like this: 192.168.12.134.
Domain names look like this: “www.google.com”
Domain names are easier for us to remember and use, while computers are quite handy with
numbers. Thus, we use DNS (Domain Naming System) to translate domain names into the IP
addresses.
IP address is a unique identifier for a computer or device on internet. A domain name (website
name) is a name that identifies one or more IP addresses (when hosted at different servers for
load balancing).
17 Give one suitable example of each URL and domain name?
Ans URL: https://kvsangathan.nic.in/hq-gyan-kosh
Domain name: kvsangathan.nic.in
18 Differentiate between XML and HTML.
Ans XML was designed to describe data and to focus on what data is. HTML was designed to display
data and to focus on how data looks.
HTML is about displaying information while XML is about describing information.
19 Distinguish between website and web browser.
Ans Website:- It is a collection of inter-linked web pages stored in a server.
Web Browser:- It is a software application for retrieving, presenting and traversing through
information resources in the form of web pages available on the World Wide Web.
20 Differentiate between the terms Domain Name and URL in context of web services. Also write
one example of each to illustrate the difference.
Ans
Domain Name URL
A domain name or website name URL is a string that represents the complete web
is a human-friendly text form of address of any web page. It’s used to locate a
the IP address. webpage.
It is the part of the URL that is It is the string that represents a complete web
more human friendly. address that contains the domain name.

86
Example: kvsangathan.nic.in Example: https://kvsangathan.nic.in/contact-us
21 Differentiate between communication using Optical Fiber and Ethernet Cable in context of wired
medium of communication technologies.
Ans Optical Fibre - Very Fast - Expensive - Immune to electromagnetic interference Ethernet Cable -
- Slower as compared to Optical Fiber - Less Expensive as compared to Optical Fiber - prone to
electromagnetic interference

PREVIOUS CBSE BOARD QUESTIONS

1) Ravi was trying to log-in to his internet-banking account. He noticed that the URL of the net
banking starts with 'https'. The 's' in 'https' stands for ……………………….
(i) Simple (ii) Smart (iii) Secure (iv) Strength
2) What is mean by the homepage of a website?
3) What is the significance of the URL?
4) Which of the following is not a network protocol?
(i) HTML (ii) HTTP (iii) SMTP (iv) FTP
5) Which of the following internet protocols provides secure data transmission between server and
browser with the help of encryption?
a) HTTP b) HTTPS c) TELNET d) ARPANET
6) Devanand, a student of Class XII, is not able to understand the difference betweenweb client and
web-server. Help him in understanding the same by explaining their role and giving suitable
example of each.
7) Write the full form of Cc and Bcc (used in email communication). Explain the difference between
them.
8) Define Internet and write its two uses in our daily life. How is it different from the World Wide
Web (WWW).
9) Web _ is a software used to view web pages.
10) In a network, _ is a computer that provides data and resources toother
computers.
11) How is a website and a webpage related?
12) Microsoft Edge, Apple Safari are examples for
13) What is the use of a server in a computer network?
14) Among the following service available on the World Wide Web are?
i) Email ii) HTML iii) XML iv) Video conferencing
(a) (i) and (ii) (b) (i) and (iv)
(c) (ii) and (iii) (d) None of the above
15) HTML and XML are _
(a) Programming Languages (b) Scripting Languages
(c) Mark-up Languages (d) None of the above
16) XML uses
(a) User defined tags (b) Predefined Tags
(c) Both user defined and predefined tags (d) None of the above XML was not designed to _
(a) store the data (b) present the data
(c) carry the data (d) both a & c

87
17) Which of the following will you suggest to establish the online face to face communication
between the people in the Regional Office Ernakulum and Delhi Headquarter?
(a) Cable TV (b) Email
(c) Text chat (d) Video Conferencing
18) What kind of data gets stored in cookies and how is it useful?
19) What do the following top level domains signify?
a) .com b).org
20) “With ML you invent your own t g ”, Exp in thi t tement with the he p of example.
21) Define Domain Name Resolution?
22) …………………. tags are case sensitive nd …………………… t g are not casesensitive.
(a) HTML, XML (b) HTTP, XML
(c) XML, HTTP (d) XML,HTML
23) Which of the following is not a web browser ?
(a) Google Chrome (b) Internet Explorer
(c) Mozilla Firefox (d) Photoshop
24) Which protocol helps us to browse through web pages using internet browsers?
25) Name any one internet browser.
26) XML stands for
a) Xtra Markup Language
b) Extensible Markup Language
c) Extensible Marking Language
d) Extensive Marked Language
27) We can upload a file to a web server using a protocol called …………………..
(A) FPT (B) IP (C) TCP (D) FTP
28) …………………. de iver the requested web page to web browser.
29) MyPace University is setting up its academic blocks at Naya Raipurand is planning to set up a
network. The University has 3 academicblocks and one Human Resource Center as shown in the
diagram below: Study the following structure and answer questions (a) to (e)

Center to Center distances between various blocks/center is as follows:


Law Block to business Block 40m
Law block to Technology Block 80m
Law Block to HR center 105m
Business Block to technology Block 30m
Business Block to HR Center 35m
Technology block to HR center 15m
Number of computers in each of the blocks/Center is as follows:
88
Law Block 15
Technology Block 40
HR center 115
Business Block 25

a) Suggest the most suitable place (i.e., Block/Center) to install the server of this University with
a suitable reason.
b) Suggest an ideal layout for connecting these blocks/centers for a wiredconnectivity.
c) Which device will you suggest to be placed/installed in each of these blocks/centers to
efficiently connect all the computers within these blocks/centers?
d) Suggest the placement of a Repeater in the network with justification.
e) The university is planning to connect its admission office in Delhi, which is more than 1250km
from university. Which type of network out of LAN, MAN, or WAN will be formed? Justify
your answer.

Test Your Self : PART I

1. Write any 1 advantage and 1 disadvantage of Bus topology.


2. What happens to the Network with Star topology if the following happens:
(i) One of the computers on the network fails?
(ii) The central hub or switch to which all computers are connected, fails?
3. Two doctors have connected their mobile phones to transfer a picture file of a person
suffering from a skin disease. What type of network is formed?
4. SunRise Pvt. Ltd. is setting up the network in the Ahmadabad. There are four departments
named as MrktDept, FunDept, LegalDept, SalesDept.

Distance between various buildings is given as follows:

MrktDept to FunDept 80 m
MrktDept to LegalDept 180 m
MrktDept to SalesDept 100 m
LegalDept to SalesDept 150 m
LegalDept to FunDept 100 m
FunDept to SalesDept 50 m
89
Number of Computers in the buildings

MrktDept 20
LegalDept 10
FunDept 8
SalesDept 42

(i) Suggest a cable layout of connections between the Departments and specify topology.
(ii) Suggest the most suitable building to place the server with a suitable reason.
(iii) Suggest the placement of i) modem ii) Hub /Switch in the network.
(iv) The organization is planning to link its sale counter situated in various part of the same
city/ which type of network out of LAN, WAN, MAN will be formed? Justify.
5. Name the protocol Used to transfer voice using packet switched network.
6. What is HTTP?
7. Write the purpose of the following devices:
(i). Network Interface Card (ii). Repeater

TEST YOURSELF: PART II

1. The ‘Gr nd Plaza ’ Mall has a computer network. The network is in one building. Name this type
of network( out of LAN/MAN/WAN).

2. Identify the type of topology on the basis of the following:


a) Since every node is directly connected to the server, a large amount of cable is needed which
increases the installation cost of the network.
b) It has a single common data path connecting all the nodes

3. The following is a 32 bit binary number usually represented as 4 decimal values, each
representing 8 bits, in the range 0 to 255 (known as octets) separated by decimal points.
192.158.1.38 What is it? What is its importance?

4. Dinesh has to share the data among various computers of his two offices branches situated in
the same city. Name the network (out of LAN, WAN, PAN and MAN) which is being formed in
this process.

5. Global Pvt. Ltd. is setting up the network in the Bangalore. There are four departments
Distances between various buildings are as follows:
Accounts to Research Lab 55 m
Accounts to Store 150 m
Store to Packaging Unit 160 m
Packaging Unit to Research Lab 60 m
Accounts to Packaging Unit 125 m
Store to Research Lab 180 m
90
Number of Computers
Accounts 25
Research Lab 100
Store 15
Packaging Unit 60

i) Suggest a cable layout of connections between the buildings.

ii) Suggest the most suitable place (i.e. buildings) to house the server of this organization.
iii) Suggest the placement of the following device with justification:

a) Repeater b) Hub/Switch
6. Write one example each of URL and IP address.

91
ANSWER KEY

Multiple Choice Questions(MCQ)

1. a 2. d 3. c 4. b 5. a
6. a 7. c 8. b 9. a 10. b
11. c 12. b 13. d 14. b 15. c
16. c 17. a 18. b 19. c 20. a
21. a 22. b 23. a 24. a 25. d
26. d 27. b 28. a 29. a 30. a
31. d 32. c 33. b 34. d 35. b
36. a 37. c 38. d 39. b 40. d
41. a 42. b 43. c 44. b 45. d
46. b 47. c 48. b 49. a 50. d

Very Short Answer Type Questions(1-mark)

1. Wired media: Optical Fiber cable Wireless media: Microwaves, Radio waves
2. Switch
3. Odd one: Bluetooth(Reason: Bluetooth is a wireless/unguided communication
media while others are wired/guided communication media)
4. Switch
5. (i) Bluetooth (ii). Radio waves
6. Satellite
7. Repeater
8. Microwave / Radio wave
9. Two insulated copper wires
10. Router
11. World Wide Web
12. Interconnected Networks
13. Tim Berners-Lee
14. Web browsers
15. Web servers
16. Web servers
17. hyperlinks
18. HTTP- HyperText Transfer Protocol

92
19. HyperText Transfer Protocol
20. World Wide Web(WWW) or Web
21. Refer comparison table
22. Chat
23. E-learning
24. Internet banking
25. E-reservation
26. Social networking websites
27.
a. HTTP- HyperText Transfer Protocol
b. XML – eXtensible Mark-up Language
c. HTTPS - HyperText Transfer Protocol Secure
d. HTML - HyperText Mark-up Language
e. VoIP-Voice over Internet Protocol
28. Google Chrome, Mozilla Firefox
29. Electronic mail
30. Ii.VoIP
31.
A Video P Each of the end user has a camera as well asmicrophone to capture video
conferencing and audio in real time and it will be transmitted over internet

B E-Shopping Q Purchasing products through computers/mobile devices


C E-mail R Messages normally reaches a recipients account within seconds
D E-reservation S Without ever having to go booking office
E E-learning T Self-paced learning modules allow students to work at their own speed

32.
Web Services Applications
A Video conferencing P VConSol
B E-Shopping Q GEM
C E-mail R Gmail
D E-reservation S IRCTC
E E-learning T Diksha App
F Social Networking U Instagram

93
Previous CBSE Board Questions - Answers

1. (iii) Secure
2. The default (first) page of a website is called a Homepage.
3. URL specifies unique address of each document on the internet.
4. (i) HTML
Internet Protocols for communication over the Internet, the communicating devices must follow
certain rules. These rules are called Internet protocols.
For email communication, we use SMTP and POP.
For communication between browser and server HTTP and HTTPS protocols are used. We can use
TELNET to access services available on a remote computer.
5. b) HTTPS
6. Web-Client: An application that requests for services from a webserver.
Example:Web Browsers, Chatting Applications
Web-Server: Web-server is a software (or any dedicated computer running this software) that
serves the request made by web-clients. Example: Apache Server.
7. Cc : Carbon Copy: every recipient can check who else has received the mail.
Bcc : Blind Carbon Copy: no recipient can check who else has received the mail.
8. The Internet is a worldwide network that links many smaller computer-networks.
Uses of the Internet 1. E-learning 2. E-commerce
The difference between the internet and www:
Internet means interconnected networks that spread all over the world (i.e. the physical
infrastructure), while WWW means the information’s (available in the form of webpages) that can be
accessed through internet.
9. Web Browser
10. Server
11. A website is a collection of interlinked webpages.
12. Web Browsers
13. Role of server is to serve various clients (sharing data or resources among multipleclients)
14. (b) (i) and (iv)
15. (c) Mark-up Languages

94
16. (a) User defined tags
17. (b) present the data
18. (d) Video Conferencing
19. Cookies can store a wide range of information, including personally identifiableinformation
(such as your name, home address, email address, or telephone number). Cookies often
store your settings for a website, such as your preferred language orlocation. When you
return to the site, browser sends back the cookies that belong to the site. This allows the site
to present you with information customized to fit your needs.
20. (a) .com - commercial
(b) .org - organization
21. XML tags are created by the user as there are no standard tags. Ex
: <name>Nayana<name>
22. The process of converting domain names (website names) into corresponding IPaddress
with the help of DNS servers is called domain name resolution.
23. (d) XML,HTML
24. (d) Photoshop
25. HTTP - Hyper Text Transfer Protocol
26. Google Chrome or any other valid browser name
27. (B) Extensible Markup Language
28. (D) FTP
29. Web Server
30 a. Most suitable place to install the server is HR center, as this center has maximumnumber of
computers.
b.

c. Switch
95
d. Repeater may be placed when the distance between 2 buildings is more than 70 meter.
e. WAN, as the given distance is more than the range of LAN and MAN.

TEST YOURSELF: PART I

1. Advantage: Since there is a single common data path connecting all the nodes, thebus topology
uses a very short cable length which considerably reduces the installation cost.
Disadvantage: Fault detection and isolation is difficult. This is because control of the network is
not centralized in any particular node. If a node is faulty on the bus, detection of fault may have to
be performed at many points on the network. The faulty node has then to be rectified at that
connection point.
2. (i). failure in one cable will not affect the entire network
(ii). If the central hub or switch goes down, then all the connected nodes will not be able to
communicate with each other.
3. PAN
4. i. Star Topology should be used.

ii) As per 80 – 20 rule, SalesDept because it has maximum no. of computers.


iii) Each building should have hub/switch and Modem in case Internet connection is required.
iv) MAN (Metropolitan Area Network)

5. VoIP

6. HTTP is a protocol that is used for transferring hypertext(i.e. text, graphic, image,
sound, video, etc,) between 2 computers and is particularly used on the World Wide
Web (WWW)
7.
(i) Network Interface Card (NIC) is a network adapter used to set up a wired
network. Itacts as an interface between computer and the network.
(ii) A repeater is a device that amplifies a signal being transmitted on the network.

96
TEST YOURSELF: PART II

1. LAN
2. a.Star Topology
b.Bus Topology
3. It is an IP Address. It is used to identify the computers on a network
4. MAN
5. (i)

(ii) The most suitable place/ building to house the server of this organization would be building
Research Lab, as this building contains the maximum number of computers
(iii). a)Repeater : distance between Store to Research Lab is quite large, so a repeater would
ideally be placed.
b)Hub/Switch : Each would be needed in all the buildings to interconnect the group of
cables from the different computers in each building.

6. IP address 192.168.1.1
URL : https://www.apple.com/

97
DATABASE
A database is an organised collection of interrelated data that serves many applications.
Its is generally a computer record keeping system. In a database we can not only store the data but we
can also change the data as per the user requirement.
These databases are generally managed by special software called DBMS (Database Management
System)

Database Management System (DBMS):


It is software which is responsible for storing, manipulating, maintaining and utilizing the databases.

Database System:
A database along with the DBMS is referred to as database system

V s DB s fw ’s v b h m k :
Oracle, MySQL Server, MySQL, Sybase, SQLite, PostgreSQL, FoxPro, SAP , dBase

Need for DBMS:


1. Databases reduce redundancy i.e. it removes the duplication of data.
2. Database controls inconsistency i.e. when two copies of the same data do not agree to each
other it is called inconsistency. By controlling redundancy, the inconsistency is also controlled
3. Databases allows sharing of data
4. Database ensures data security by the process of authentication and does not allow unauthorized
access.
5. Database Maintains integrity
6. Database is maintained in a standard format which helps to interchange the data between two
systems.

Relational Database Model


In Relational Database Model the data is stored in the form of tables i.e. rows and columns.
In Relational Database Model a table is referred to as a Relation.
In Relation Database Model a column is referred to as an attribute
In relational database model a row is referred to as a tuple.

98
Eg.
Table: Student (Relation)
Attributes

Rollno Name Marks


Tuples
101 Manish 34

102 Mohit 37

103 Aryan 23

104 Ruhi 56

Various other terminologies used in relational data model


Domain: The pool of all the possible values that a column can have is referred to as a domain.
Degree of a Relation: Number of attributes/columns in a relation is referred to as degree of a
relation. For example if a table has 6 columns then the degree of a table will be 6

Cardinality of a Relation: Number of rows /tuples in a relation is referred to as the cardinality of a


relation.

KEYS:

In a relation each record should be unique i.e. no two records can be identical in a database. A key
attribute identifies the record and must have unique values

Keys are of four types:


1. Primary Key
2. Candidate Key
3. Alternate Key
4. Foreign Key
99
Primary Key:
A primary key uniquely identifies each row in a table. A primary key cannot have NULL value. In a table
we can only have one primary key. Eg. in the above table empno is the primary key.
Candidate Key:
All the attributes in a table which have the capability to become a primary key are referred to as a
candidate key.eg. in the above table empno and ename are the attributes which have the capability to
become the primary key so, empno and ename are the candidate keys
Alternate key:
One of the candidate key is made a primary key and all the other remaining candidate keys are called
alternate keys
Eg. if empno is the primary key then the remaining candidate key ename is the alternate key.
Foreign key:
A foreign key is a non key attribute whose values are derived from the primary key of another table.
It is basically used to set the relationship among two tables.
Eg.

100
SQL COMMANDS
DATA DEFINITION LANGUAGE

CREATE DATABASE<DATABASENAME>; To create a database in the system


SHOW DATABASES; To view the names of all databases in the
system
USE<DATABASENAME>; To open a particular database
DROP DATABASE<DATABASENAME>; To remove a database from the system
DESCRIBE TABLE<TABLENAME>; To view the structure of a table
SHOW TABLES; To view the names of tables in current
database
CREATE TABLE<Tablename> To create a new table in the current
( database:
attributename1 datatype(size) constraint, For example :
attributename2 datatype(size) constraint, CREATE TABLE EMP
. (
. EMPID INT PRIMARY KEY,
); ENAME CHAR(30) NOT NULL,
POST VARCHAR(15)
);
ALTER TABLE To modify the structure of a table
ALTER TABLE<TABLE NAME> ADD ATTRIBUTENAME For adding attributes
DATATYPE(SIZE);
ALTER TABLE<TABLENAME>DROP <ATTRIBUTENAME>; For deleting attribute
ALTER TABLE<TABLENAME>MODIFY For changing datatype, size etc. of an
attribute
DROP TABLE<TABLENAME> To remove a table from the databse

DML: DATA MANIPULATION LANGUAGE

< ABL A > VAL VAL1,VAL2… ; To add new record/row/tuple/ in the


table
DELETE FROM <TABLENAME> WHERE<CONDITION>; to remove tuples from a table
UPDATE <TABLENAME> To modify or change the data in the table
SET<ATTRIBUTENAME>=NEWVALUE
WHERE <CONDITION>;
SELECT <ATTRIBUTE LIST> To view / extract rows from a table
FROM <TABLENAME>
WHERE <CONDITION>;
MYSQL : MATH FUNCTIONS

POW(X,Y) - x raise to the power of y Se ect Pow(8, ); → 6


MOD(X,Y) - Remainder of X/Y Select MOD(3 1 ) → 6
ROUND(N,D) - Rounds number N upto given D no. of digits Se ect Round( 1 3.7898, ); → 1 3.79
SQRT(X) – Returns square root of X Se ect SQRT(1 ) → 1

MYSQL : STRING FUNCTIONS


101
LENGTH(STR) : Se ect LENGTH(‘SPA E’)
Find Number of characters in given string. →5
A 1, 2, …. : Select CONCAT('Wel', 'come');
Joins the given strings one after the other. → 'W c m '
UPPER(STR)/UCASE(STR): Select UPPER('Kendriya')
Converts lower case alphabets of given string alphabets to → 'K D YA'
Upper case. Other charters remain as it is. Se ect UPPER('or nge') → 'ORANGE'
LOWER(STR)/LCASE(STR) : Select LOWER('Kendriya')
Converts Upper case alphabets of given string alphabets to → 'kendriya'
lower case. Other charters remain as it is. Select LOWER('ORANGE')
→ 'orange'
LTRIM(STR): Se ect LTR M(‘ I am learning ‘);
Removes Spaces on left side of given string. →‘ m g ‘
RTRIM(STR) : Se ect RTR M(‘ I am back ‘);
Removes Spaces on Right side of given string →‘ m b ck‘
TRIM(STR) : Se ect TR M(‘ ROSE IS RED ‘)
Removes both leading (left) and Trailing (right ) Spaces →‘ D‘
from given string.
LEFT(STR,N) : Select LEFT('GREAT WORK',4)
extract N characters from left side of given String → 'G A'
RIGHT(STR,N) : Select RIGHT('PYTHON',4)
extract N characters from right side of given String →' H '
INSTR(STR,SUBTRING) : Select INSTR("apple", "p");
returns the position of the first occurrence of a string in →2
another string.
SUBSTR(STR, position, no. of characters) or MID(STR, Select MID('Kendriya',4,2)
position, no. of characters) →' '

102
Multiple Choice Questions
1 Fill in the blank:
_____ is a non-key attribute, whose values are derived from the primary key of some other
table.
(A) Primary Key (B) Candidate Key (C) Foreign Key (D) Alternate Key
2 An Attribute in a relations a foreign key if it is the _____ key in any other relation.
(A) Candidate Key (B) Foreign Key (C) Primary Key (D) Unique Key
3 An attribute in a relation is a foreign key if it is the ________ key in any other relation.
(A) Candidate Key (B)Foreign Key (C) Primary Key (D)Unique Key
4 _________ is an attribute, whose values are Unique and not null.
(A) Primary Key (B)Foreign Key (C)Candidate Key (D)Alternate Key
5 Select the correct statement, with reference to RDBMS:
a) NULL can be a value in a Primary Key column
b) ' ' (Empty string) can be a value in a Primary Key column
c) A table with a Primary Key column cannot have an alternate key.
d) A table with a Primary Key column must have an alternate key.

6. Layna creates a table STOCK to maintain computer stock in vidyalaya. After creation of the table, she
has entered data of 8 items in the table.

Based on the data given above answer the following questions:


(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) What is the degree and cardinality of the given table.
(iii) If three columns are added and 5 rows are deleted from the table stock, what will be the new
degree and cardinality of the above table?
7. What is the difference between primary, candidate and alternate key? Explain with the help of an
example.
8. Name any two RDBMS software.
9. Rahul is confused between tuple and attributes help him to define Tuple and Attribute with
appropriate example.
10. What is the difference between the cardinality and degree of a relation?

103
STRUCTURED QUERY LANGUAGE (SQL)
Structured query language (SQL) is a programming language for storing and processing information in a
relational database. A relational database stores information in tabular form, with rows and columns
representing different data attributes and the various relationships between the data values.
By using SQL commands, one can search for any data in the database and perform other functions like
creating tables, adding records, modifying data, removing rows, dropping tables etc.
Relational Data Model
In this model data is organized into tables. These tables are called relations. Rows of table are known as
tuples and columns are known as attribute.
Domain:
It is a pool of values from which the actual values appearing. For example if there 40 students having
rollno 1 to 40 and we assigning work to these students then domain for rollno is 1 to 40
Tuple: Tuples are row of a table.
Attribute: Attributes are column of relation.
Degree: Total number of attributes (Column) in a table are known as Degree.
Cardinality:
Total number of tuples (Row) in a table are known as Cardinality. Heading row is not included while
calculating cardinality of a table
Candidate Key:
A Candidate Key is the one that is capable of becoming Primary key i.e., a column that has unique value
for each row in the relation and that can not be NULL.
For example if there is a table student having columns (Rollno , AdmNo, Name , fees ,city and DOB) . In
this table Rollno and AdmNo both columns have all the properties to become primary key of table. That
is why Rollno and AdmNo are known as Candidate key.
Primary Key:
It is set of one or more columns that can uniquely identify tuples with in the relation. It cannot be null.
For example in student table RollNo is selected as Primary key.
Alternate Key:
A candidate key that is not primary key is called alternate key. Example is AdmNo because it is candidate
key but not selected as primary key.
Foreign Key:
A non-key attribute of a table , which is primary key in another table. The values of foreign key are
derived from the primary key of base table. For example we are having a table Library having columns
BookNo, BName, RollNo)
Here Bookno is Primary key
RollNo is Foreign key in Library table as it is primary key in student table.

104
SQL Commands

SQL commands are instructions. It is used to communicate with the database. It is also used to perform
specific tasks, functions, and queries of data.
SQL can perform various tasks like create a table, add data to tables, drop the table, modify the table, set
permission for users.
Types of SQL Commands. There are four types of SQL commands: DDL, DML, DCL, TCL

DDL :- Create , Drop, Alter , Describe

DML-Insert, Update, Delete , Select

DCL- Grant , Revoke

TCL- Commit , Rollback


DDL or Data Definition Language

DDL or Data Definition Language actually consists of the SQL commands that can be used to define the
database schema. It simply deals with descriptions of the database schema and is used to create and
modify the structure of database objects in the database. DDL is a set of SQL commands used to create,
modify, and delete database structures but not data.
List of DDL commands:

CREATE: This command is used to create the database or its objects (like table, index, function, views,
store procedure, and triggers).
DROP: This command is used to delete objects from the database.

ALTER: This is used to alter the structure of the database.

DESC: This is used to DESCRIBE the structure of table.

DML (Data Manipulation Language):

The SQL commands that deals with the manipulation of data present in the database belong to DML or
Data Manipulation Language and this includes most of the SQL statements. It is the component of the SQL
statement that controls access to data and to the database. Basically, DCL statements are grouped with
DML statements.
List of DML commands:

INSERT : It is used to insert data into a table.


UPDATE: It is used to update existing data within a table.
DELETE : It is used to delete records from a database table.
SELECT: It is used to display records on screen.

105
DATA TYPES
Data types are means to identify the type of data and associated operations for handling it.
MySQL data types are divided into following categories:

Data type Description

CHAR(size) A FIXED length string its size can be from 0 to 255. Default is 1

VARCHAR(size) A VARIABLE length string, its size can be can be from 0 to 65535

INT(size)/ Integer Number without decimal point. Example int(11) or integer

FLOAT(size, d) / A floating point number. The total number of digits is specified in size. The
Decimal number of digits after the decimal point is specified in the d parameter.
Example float(10,2) . Example 3455738.50

A date. Format: YYYY-MM-DD.


DATE
Example DOB date
v ue hou d be given ike ‘ 6 ’

DATABASE COMMANDS
1. VIEW EXISTING DATABASE
To view existing database names, the command is:
SHOW DATABASES;
2. CREATING DATABASE IN MYSQL
For creating the database in MySQL, we write the following command:
CREATE DATABASE <databasename>; e.g.In order to create a database Student, command is:
CREATE DATABASE Student;
3. ACCESSING A DATABASE
For accessing already existing database,we write:
USE<databasename>;
e.g.to access a database named Student, we write command as:
USE Student;

4. DELETING DATABASE
106
For deleting any existing database,the command is:
DROP DATABASE <databasename>;
e.g.to delete a database, say student, we write command as:
DROP DATABASE Student;
5. VIEWING TABLE IN DATABASE
In order to view tables present in currently accessed database, command is:
SHOW TABLES;
DDL COMMANDS :-
CREATING TABLES IN MYSQL
Syntax of CREATE TABLE command is:
CREATE TABLE <table-n me>(<co n me> d t type,<co n me> d t type,…);
E.g. In order to create table EMPLOYEE given below:
ECODE ENAME GENDER GRADE GROSS

Create table employee (ecode integer, ename varchar(20),gender char(1),grade char(2),gross integer);
ALTER TABLE
ALTER TABLE command is used to change the structure of the existing table. It can be used to add or drop
new columns or modify the existing columns of table.
Eg. 1. Alter table Employee Add email char(20);
2. ALTER TABLE Employee MODIFY (ename varchar(60));
2. Alter table employee drop email;

DROP TABLE:
DROP TABLE command allows to remove a table from database. Once the DROP command is issued, the
table will no longer be available in the database.
Eg. DROP TABLE employee;
DESC TABLE:
DESC TABLE command display the structure of table on screen.
Eg. DESC employee;

DML Commands

107
INSERTING DATA INTO TABLE:
Syntax:
n ert into <t b en me> v ue (<v1>,<v >,…);
Or
Insert into <tablename>(<column list> )values(<values list>);
Eg in ert into emp oyee v ue (1 1,‘Atu ’,‘M’,‘E ’, );
Or
n ert into emp oyee(ecode,en me) v ue (1 ,’Meen ’);
The left out columns will be filled with null values.
DELETE Command
This command removes rows from a table.
Syntax: DELETE FROM <tablename> [WHERE <cond>];
Eg: To remove all the contents of items table, the query is:
DELETE from items;
Eg: To remove the tuples from employee that have gross less than 20000 is :
DELETE from employee WHERE gross<20000;
UPDATE Command
Update Command allows to change some or all the values in an existing rows. Update command specifies
the rows to be changed using the WHERE clause and the new data using the SET keyword.
Eg. UPDATE employee SET gross= 25000;
The above query sets the gross of all records as 25000.
UPDATE emp oyee SET gro = , gr de=’A’ WHERE ecode=1 1;
The above query changes the gross and grade values for the record with ecode 1001.
SELECT COMMAND:
It helps to display the records as per our requirement.
Different forms of select command:
1. Select * from employee;
It displays all rows and columns from the table.
2. SELECT ECODE, ENAME FROM EMPLOYEE;
It displays selected columns from the table.

3. FOR DISPLAYING PARTICULAR ROWS.


Synt x e ect * from <t b en me> where <cond>; Eg. Se ect * from emp oyee where gender=’M’;

108
4. ELIMINATING REDUNDANT DATA

The distinct keyword is used to eliminate duplicate records from the table. Eg. Select distinct (gender)
from employee;

DISTINCT(GENDER)

5. USING COLUMN ALIASES


The columns that we select in a query can be given a different name, i.e.column alias name for output
purpose.
Syntax: SELECT <columnname>AS column alias ,<columnname>AS column alias
…..FROM<t b en me>;
Eg. e ect ecode “EMP_ ode” from emp oyee;

CONDITION BASED ON A RANGE


The BETWEEN operator defines a range of values that the column values must fall into make the
condition true. The range include both lower value and upper value.
e.g.To display ECODE,ENAME and GRADE of those employees whose salary is between 40000 and
50000,command is:
SELECT ECODE , ENAME ,GRADE FROM EMPLOYEE WHERE GROSS BETWEEN 40000 AND 50000;
NOTE: For displaying records not in the specified range, we have to use not between operators.

CONDITION BASED ON A LIST

The in operator is used to display records based on a list of values.


Eg. To display details of employees who have scored A,B and C grades.
c * f m m y wh g ‘A’,’B’,’ ’ ;
Note: For displaying records that do not match in the list, we have to use not in operator.
CONDITION BASED ON PATTERN MATCHES
LIKE operator is used for pattern matching in SQL. Patterns are described using two special wildcard
characters: % and _ (underscore)
1. Percent ( % )– The % character matches any substring.
2. Underscore ( _ )– The _ character matches any single character.

e.g.To display names of employee whose name starts with R in EMPLOYEE table, the command is:
s c m f m m y wh m k “ %”;
e.g. To display details of employee whose second character in name is:
109
s c *f m m y wh m k ‘_ %’;
SEARCHING FOR NULL

The NULL value in a column can be searched for in a table using IS NULL in the WHERE clause. E.g. to list
employee details whose salary contain NULL, we use the command:
Select * from employee where gross is null;

Note: For listing employees who earn salary, then it is:

Select * from employee where gross is not null;

Relational Operators

• To compare two values, a relational operator is used. The result of the comparison is true or false.
Relational Operators recognized by SQL: =, >, <, <=, >=, <> (not equal or !=)
Eg. Select * from employee where ecode <> 1001;
Above query will not display those employee details whose ecode column value is 1001.
Logical Operators- (OR, AND, NOT)
1. To list the employee details having grades E2 or E3.
Se ect ecode, en me, gr de, gro from emp oyee where (gr de=‘E ’ OR gr de=‘E3’);
2. To list the emp oyee ’ det i h ving gr de ‘E ’ but with gro < 9 .
Se ect ecode, en me, gr de, gro from emp oyee where gr de=‘E ’ nd gro < 9 ;
3. To i t the emp oyee ’ det i who e gr de re other th n ‘G1’.
Select ecode, en me, gr de, gro from emp oyee where (NOT gr de= ‘G1’);
Sorting Results- ORDER BY clause
Results of SQL query can be sorted in a specific order using ORDER BY clause.
The ORDER BY clause allows sorting of query results by one or more columns. The sorting can be done
either in ascending or descending order.
Eg. Select * from emp order by ename;
Above query arranges the records in alphabetical order of ename value. By default order by clause
arranges in ascending order.
• Select * from employee order by ename desc;
Above query gives output in descending order of ename.

• Select * from employee ORDER BY ename ASC;


• Above query gives output in ascending order of ename.

SQL AGGREGATE FUNCTIONS:

110
FUNCTIONS: In MYSQL function is a special type of predefined command set that perform some
operation and return a single value. The value that are provided to functions are called parameters or
arguments.
Functions can be divided into two categories.
1. Single row function :- This type of function can apply on each row of table.Example are
(a ) Lower/Lcase: This function convert a string into lower case. Example :
Select Lower(name) from student;

2. Group Row Function : These function can work on group of rows and give you a single result.
(1) AVG ( ) – This function computes the average of given data.

Example : Select avg(fees) from student ;

Avg – to compute average value


Min – to find minimum value
Max – to find maximum value Sum – to find total value
Count – to count non-null values in a column
Count( *) – to count total number of rows in a table including null values.
All the aggregate functions ignore null values except count(*).
Examples:
Select avg(gross) from employee;
Select min(gross) from employee where deptno= 10;
Select count(*) from emp where gross> 10000;
Select count (DISTINCT gender) from employee;
GROUP BY Clause
GROUP BY clause is used in SELECT statements to display the table contents based on similar values in a
column into groups.
Eg: To calculate the number of employees in each grade, the query is:
SELECT grade, count(*) from employee group by grade;
Placing conditions on Groups HAVING Clause
• The HAVING clause places conditions on groups in contrast to WHERE clause that places conditions on
individual rows.
• WHERE conditions cannot include aggregate functions but HAVING conditions can do so.

Eg: SELECT avg(gross), sum(gross) from employee GROUP BY grade HAVING gr de= ‘E ’ ;
INTEGRITY CONSTRAINTS

111
A constraint is a condition or check applicable on a field or set of fields. Common types of constraints
include:

S.No.Constraints Description

1 NOT NULL Ensures that a column cannot have NULL value

2 DEFAULT Provides a default value for a column when none is Specified

3 UNIQUE Ensures that all values in a column are different

4 PRIMARY KEY Used to uniquely identify a row in the table

5 FOREIGN KEY Used to ensure referential integrity of the data

ADDING CONSTRAINT TO A TABLE


ALTER TABLE statement can be used to add constraints to your existing table by using it in following
manner:
Eg: alter table employee add primary key(ecode);
REMOVING CONSTRAINTS FROM A TABLE
Eg: alter table employee drop primary key;
SETTING PRIMARY AND FOREIGN KEY CONSTRAINT:
Eg: CREATE TABLE STUDENT(ROLL_NO integer PRIMARY KEY ,NAME VARCHAR(30),CLASSVARCHAR(3));
CREATE TABLE SCORE(ROLL_NO integer ,MARKS integer, FOREIGN KEY(ROLL_NO) REFERENCES
STUDENT(ROLL_NO));
SQL JOINS
SQL Joins are essential to display data from more than one table. SQL JOIN clause is used to combine rows
from two or more tables, based on a common field between them.
SQL provides various types of joins:
1. Cartesian Product or Cross Join
2. Equi-Join
3. Natural Join.
Cartesian Product (Cross Join)
Cartesian product of two tables is obtained by pairing up each row of one table with each row of the
other table.
• The number of columns in the Cartesian product is the sum of the number of columns in both the
tables.
• The number of rows in the Cartesian product is the product of rows of the tables.

Example:
112
If A table has 3 Rows and 4 columns and B table has 6 rows and 7 columns then write No of rows and
columns in C table which is Cartesian product of Table A and B
Answer is Rows = 3 X6= 18
Columns = 4+7=11
Equi-Join
A join which is obtained by putting a condition of equality on cross join is called an 'equi join'.
We can extract meaningful information from the Cartesian product by placing some conditions in the
statement.
The join in which columns are compared for equality is called equi-join.
In this type of join we put * in the select list therefore the common column will appear twice in the
output.
Example: Consider the 2 tables emp and dept.

On performing equi-join, the result is as follows:

Note: We see that deptno column appears twice in output.


Natural Join

113
• The join in which only one of the identical columns exists is called natural join.
• It is similar to equi-join except that duplicate columns are eliminated in natural join that would
otherwise appear in equi-join.
Example:

Note: We see that deptno column appears only once in output.

MULTIPLE CHOICE QUESTIONS (MCQS)

Q1. Which clause is used for Pattern Matching -


(a) between (b) in (c) like (d) Compare
Q2. The default date format in MySQL is:
(a) DD/MM/YYYY (b) YYYY/MM/DD c) MM-DD-YYYY (d) YYYY-MM-DD
Q3. Which is not a way to represent comment in MySQL?
(a) /* */ (b) -- (c) # (d) //
Q4. The command is used to access database in MySQL is-
(a) Open <databasename>; (b) USE <databasename>;
(c) Access <databasename>; (d) (a)&(b) both
Q.5. Which is a valid CREATE TABLE statement?
(a) Create table emp add(id integer(3)); (b) Create table emp(id integers(3));
(c) Create table emp modified(id integer(3)); (d) Create table emp(id integer(3));
Q.6. How c n you in ert new row into the “STORE” t b e.
(a) NSERT ROW(1,‟RAMS NGH‟) NTO STORE; (b) NSERT VALUES(1,‟RAMS NGH‟) NTO STORE;
(c) NSERT NTO(1,‟RAMS NGH‟)STORE; (d) NSERT NTO STORE VALUES(1,‟RAMS NGH‟);
Q.7. which keyword is used to retain duplicate value in select command
(a) distict (b) show (c) all (d) like
Q.8 Conditionally retrieval of rows from a table with SELECT, which clause is used?
(a) Where (b) Having (c) Group By (d) Order by
114
Q.9. The key word eliminates duplicate rows from the result of a SELECT statement.
(a) All (b) Unique (c) Distinct (d) IN
Q10. Which operator defines a range of values that the column values must fall in?
(a) In (b) Like (c) Between (d) Is
Q11. To pecify i t of v ue ………………..Oper tor i u ed.
(a) In (b) Like (c) Between (d) Is
Q12. We use operator with select for condition based on pattern matching.
(a) In (b) Like (c) Between (d) Is

Q13. To see all the databases which command is used?

(a)Show database; (b) Show databases; (c) Show database(); (d) Show_all database;

Q1 .To di p y the det i of emp oyee h ving ‘e’ in their name in descending order of salary. The correct
SQL statement is:
(a) SELE T*FROM emp WHERE en me L KE “e%” ORDER BY SAL;
(b) SELE T*FROM emp ORDER BY SAL DES WHERE en me L KE “%e%”;
(c) SELE T*FROM emp WHERE en me L KE “%e%” ORDER BY DES SAL;
(d) SELE T*FROM emp WHERE en me L KE “%e%” ORDER BY SAL DES ;

Q. 15. In which form MYSQL query results are displayed?

(a) LIST (b)TUPLE (c) ROWS AND COLUMNS (d) LIST AND TUPLES BOTH

ANSWERS
Q.No. Answers Q.No. Answers
1 c 8 a
2 d 9 c
3 d 10 c
4 b 11 a
5 d 12 b
6 d 13 b
14 d
7 c
15 c

VERY SHORT ANSWER QUESTIONS (VSA)


115
(1 Mark each)
Q1. Answer the following questions:
I. Differentiate between DDL and DML?
II. What is a constraint?
III. What are single row functions ?
IV. Compare CHAR and VARCHAR data types.
V. What are the differences between DELETE and DROP commands of SQL?
VI. What do you understand by MySQL Client?
VII. Differentiate between WHERE and HAVING clause.
VIII. A table "Animals" in a database has 3 columns and 10 records. What is the degree and cardinality
of this table?
IX. What is the difference between commit and rollback command.
X. Which keyword is used to remove redundant data from a relation?
ANSWERS:
(i) Data Definition Language (DDL): This is a category of SQL commands. All the commands which are used
to create, destroy, or restructure databases and tables come under this category. Examples of DDL
commands are - CREATE, DROP, ALTER.
Data Manipulation Language (DML): This is a category of SQL commands. All the commands which are
used to manipulate data within tables come under this category. Examples of DML commands are -
INSERT, UPDATE, DELETE.
(ii) A constraint is a condition or check application on a field or set of fields.
Example: NOT NULL (ensure that column con not have null value), CHECK (make sure that all value
satisfy certain criteria), UNIQUE (ensure that all values in a column are different) etc.
(iii) Single Row Function work with a single row at a time. A single row function returns a result for every row
of a quired table
Examples of Single row functions are Sqrt(), Concat(), Lcase(), Upper(), Day(), etc.
(iv) The CHAR data-type stores fixed length strings such that strings having length smaller than the field size
are padded on the right with spaces before being stored. The VARCHAR on the other hand supports
variable length strings and therefore stores strings smaller than the field size without modification.
(v) DELETE is DML command while DROP is a DDL command. Delete is used to delete rows from a table while
DROP is used to remove the entire table from the database.
(vi) MySQL Clients are programs that connect to MySQL Server and issue queries in predefined format.
(vii) WHERE clause is used to select particular rows that satisfy the condition where having clause is used
in connection with the aggregate function GROUP BY clause. FOR EXAMPLE-
select * from student where marks >80;
Select * from student group by stream having marks>90;
(viii) Degree 3 and Cardinality=10
(ix) COMMIT command permanently saves the changes made during the transaction execution. ROLLBACK
command undoes the changes made during transaction execution.
(x) DISTINCT

116
SHORT ANSWER QUESTIONS
(2 Marks Each)
Q1. Differentiate between Candidate Key and Primary Key in the context of Relational Database Model.
Ans. A table may have more than one or a combination of attribute(s)that identifies a tuple uniquely. All
such attribute(s) are known as Candidate Keys.
Out of all the Candidate keys, the most appropriate one, which is used for unique identification of the
Tuples, is called the Primary Key.
Q2. Sreenath created the following table STUDENT in his database.
Table : STUDENT

Rollno Name CLASS Mark

1 Ritika 12 40

2 Angad 12 35

3 Kaveri 11 42

4 Lalitha 12 21

5 Daniel 11 44

6 Rabindra 11 39

7 Rabia 11 28

He wants to now count number of students in each CLASS where the number of students is more than 3.
He has executed the following query.
SELECT MAX(MARKS) FROM STUDENT WHERE COUNT(*)>3 GROUP BY CLASS;
But, he got an error. Identify the error and rewrite the query.
Ans. To filter more condition with group by clause HAVING clause is used in place of WHERE clause.
Correct query is
SELECT MAX(MARKS) FROM STUDENT GROUP BY CLASS HAVING COUNT(*)>3;
Q.3. Difference between Where and Having Clause
Answer : WHERE Vs HAVING: WHERE is used to put a condition on individual row of a table whereas
HAVING is used to put condition on individual group formed by GROUP BY clause in a SELECTstatement.
Q.4. Difference between alter command and update command
Ans: 1. Alter is a DDL command while update is a DML command
2 Alter command is used to change the structure of table while update is used to change in records
Q.5. Difference between drop command and drop clause of Alter table .
Ans:- Drop command is used to delete the entire table along with its structure while drop clause is used
with alter table command to drop a column or constraints
Q.6. Difference between Unique and Primary Key

Ans. Primary Key: In a table there can be one primary key with one column or one combination of
column. It cannot be Null.
117
Unique: In a table there can be Unique constraints can be applied to any number of columns . It
can have Null values.

Q.7. Define Commit and Rollback Commands


Answer : COMMIT-This statement is used to end a transaction and make all changes permanent. Until
atransaction 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
user.
Q.8. Difference between Count(*) and Count(name) Functions.
Answer : COUNT(*) will count all rows in the table. It also include rows having NULL value for the
column.
COUNT(NAME) will count only those rows where value of Name is given. If for any row Name
is NULL/ empty then it will not count it.

Q9. Mr. Roger is using a table LIBRARY. It has the following columns:
BCode, BName, Price, author.
He wants to display maximum price Author wise. He wrote the following command:
SELECT Author, Max(Price) FROM LIBRARY;

But he did not get desired result. Rewrite the above query with necessary change to help him get the
desired output and explain the reason.

Ans. SELECT Author, Max(Price) FROM LIBRARY GROUP BY AUTHOR;

Group By clause is used to group the rows together that contain the same values in a specified
column.so to display maximum price of each author , the table must be grouped author wise using
group by clause.

Q10. Differentiate ORDER BY and GROUP BY with an example.


Ans. Order By: Order by keyword sort the result-set either in ascending or in descending order. This
clause sorts the result-set in ascending order by default. In order to sort the result-set in descending
order DESC keyword is used.
Group By: Group by statement is used to group the rows that have the same value. It is often used
with aggregate functions for example: AVG(), MAX(), COUNT(), MIN() etc.

118
LONG ANSWER QUESTIONS (6 MARKS)

Q.1. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to(viii), which are basedon the
tables.
TRAINER

TID TNAME CITY HIREDATE SALARY


101 SUNAINA MUMBAI 1998-10-15 90000
102 ANAMIKA DELHI 1994-12-24 80000
103 DEEPTI CHANDIGARG 2001-12-21 82000
104 MEENAKSHI DELHI 2002-12-25 78000
105 RICHA MUMBAI 1996-01-12 95000
106 MANIPRABHA CHENNAI 2001-12-12 69000

COURSE
CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105

(i) Display the Trainer Name, City & Salary in descending order of their Hiredate.
(ii) To display the TNAME and CITY of Trainer who joined the Institute in the
month of December 2001.
(iii) To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and COURSE
of all those courses whose FEES is less than or equal to 10000.
(iv) To display number of Trainers from each city.
(v) SELECT TID, TNAME, FROM TRAINER WHERE CITY NOT N(‘DELH ’, ‘MUMBA ’);
(vi) SELECT DISTINCT TID FROM COURSE;
(vii) SELECT TID, COUNT(*), MIN(FEES) FROM COURSE GROUP BY TID HAVING COUNT(*)>1;
(viii) SELECT COUNT(*), SUM(FEES) FROM COURSE WHERE STARTDATE< ‘ 18-09-1 ’;

ANSWER:

(i) SELECT TNAME, CITY, SALARY FROM TRAINER ORDER BY HIREDATE;


(ii) SELE T TNAME, TY FROM TRA NER WHERE H REDATE BETWEEN ‘ 1-12- 1’AND ‘ 1-12-31’;
(iii) SELECT TNAME,HIREDATE,CNAME,STARTDATE FROM TRAINER, COURSE WHERE
TRAINER.TID=COURSE.TID AND FEES<=10000;
(iv) SELECT CITY, COUNT(*) FROM TRAINER GROUP BY CITY;

v) TID TNAME
103 DEEPTI
106 MANIPRABHA

119
vi) DISTINCT TID
101
103
102
104
105
vii) TID COUNT(*) MIN(FEES)
101 2 12000
Viii) COUNT(*) SUM(FEES)
4 65000
Q2. Consider the following tables GAMES and PLAYER. Write SQL commands for the statements to (iv)
and give outputs for SQL queries (v) to (viii).
Table: GAMES

GCode GameName Number PrizeMoney ScheduleDate


101 Carom Board 2 5000 23-Jan-2004
102 Badminton 2 12000 12-Dec-2003
103 Table Tennis 4 8000 14-Feb-2004
105 Chess 2 9000 01-Jan-2004
108 Lawn Tennis 4 25000 19-Mar-2004
Table: PLAYER
PCode Name Gcode
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103
I. To display the name of all Games with their Gcodes.
II. To display details of those games which are having PrizeMoney more than 7000.
III. To display the content of the GAMES table in ascending order of ScheduleDate.
IV. To display sum of PrizeMoney for each of the Number of participation groupings (as shown in
column Number 2 or 4)
V. SELECT COUNT(DISTINCT Number) FROM GAMES;
VI. SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;
VII. SELECT SUM(PrizeMoney) FROM GAMES;
VIII. SELECT DISTINCT Gcode FROM PLAYER;
ANSWER
I. SELECT GameName,Gcode FROM GAMES;
II. SELECT * FROM GAMES WHERE PrizeMoney>7000;
III. SELECT * FROM GAMES ORDER BY ScheduleDate;
IV. SELECT SUM(PrizeMoney),Number FROM GAMES GROUP BY Number;
V. 2
120
VI. 19-Mar-2004 12-Dec-2003
VII. 59000
VIII. 101
103
108
Q3. Consider the following tables FACULTY and COURSES. Write SQL commands for the statements (i) to
(iv) and give outputs for SQL queries (v) to (vi).

FACULTY

F_ID Fname Lname Hire_date Salary

102 Amit Mishra 12-10-1998 12000

103 Nitin Vyas 24-12-1994 8000

104 Rakshit Soni 18-5-2001 14000

105 Rashmi Malhotra 11-9-2004 11000

106 Sulekha Srivastava 5-6-2006 10000

COURSES

C_ID F_ID Cname Fees

C21 102 Grid Computing 40000

C22 106 System Design 16000

C23 104 Computer Security 8000

C24 106 Human Biology 15000

C25 102 Computer Network 20000

C26 105 Visual Basic 6000

I. To display details of those Faculties whose salary is greater than 12000.


II. To display the details of courses whose fees is in the range of 15000 to 50000 (both values
included).
III. To incre e the fee of cour e by of “Sy tem De ign” our e.
IV. To di p y det i of tho e cour e which re t ught by ‘Su ekh ’ in de cending order of cour e ?
V. Select COUNT(DISTINCT F_ID) from COURSES;
VI. Select Fname,Cname from FACULTY,COURSE where COURSE.F_ID=FACULTY.F.ID;

121
ANSWER
I. Select * from faculty where salary > 12000;
II. Select * from Courses.where fees between 15000 and 50000;
III. Upd te cour e et fee = fee + where n me = “Sy tem De ign”;
IV. Select * from faculty fac,courses cour where fac.f_id = cour.f_id and fac.fname = 'Sulekha' order by
cname desc;
V. 4
VI.

Amit Grid Computing

Rakshit Computer Security

Rashmi Visual Basic

Sulekha Human Biology

Q-4 Write SQL Command for (a) to (e) and output of (f)
TABLE : GRADUATE

S.NO NAME STIPEND SUBJECT AVERAGE DIV


1 KARAN 400 PHYSICS 68 I
2 DIWAKAR 450 COMP Sc 68 I
3 DIVYA 300 CHEMISTRY 62 I
4 REKHA 350 PHYSICS 63 I
5 ARJUN 500 MATHS 70 I
6 SABINA 400 CHEMISTRY 55 II
7 JOHN 250 PHYSICS 64 I
8 ROBERT 450 MATHS 68 I
9 RUBINA 500 COMP Sc 62 I
10 VIKAS 400 MATHS 57 II
a) List the names of those students who have obtained DIV I sorted by NAME.
b) Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in a year
assuming that the STIPEND is paid every month.
c) To count the number of students who are either PHYSICS or COMPUTER SC graduates.
d) To in ert new row in the GRADUATE t b e 11,”KAJOL”, 3 , “computer c”, 7 , 1
e) Add a new column GRADE of character type.
f) Give the output of following sql statement based on table GRADUATE:
I. Se ect M N(AVERAGE) from GRADUATE where SUBJE T=”PHYS S”;
II. Select SUM(STIPEND) from GRADUATE WHERE div=2;
III. Select AVG(STIPEND) from GRADUATE where AVERAGE>=65;
IV. Select COUNT(distinct SUBJECT) from GRADUATE;

122
ANSWER
a) SELE T NAME from GRADUATE where D V = ‘ ’ order by NAME;
b) SELECT NAME,STIPEND,SUBJECT, STIPEND*12 from GRADUATE;
c) SELECT SUBJECT,COUNT(*) from GRADUATE group by SUBJECT having
SUBJE T=’PHY S S’ or SUBJE T=’ OMPUTER S ’;
d) NSERT NTO GRADUATE v ue (11,’KAJOL’,3 ,’ OMPUTER S ’,7 ,1);
e) ALTER TABLE GRADUATE ADD(GRADE CHAR(2));
f) (i) 63
ii. 800
iii. 475
iv. 4
Q.5. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the
tables.
Table : VEHICLE
CODE VTYPE PERKM
101 VOLVO BUS 160
102 AC DELUXE BUS 150
103 ORDINARY BUS 90
105 SUV 40
104 CAR 20
Note : PERKM is Freight Charges per kilometer , VTYPE is Vehicle Type
Table : TRAVEL
NO NAME TDATE KM CODE NOP
101 Janish Kin 2015-11-13 200 101 32
103 Vedika Sahai 2016-04-21 100 103 45
105 Tarun Ram 2016-03-23 350 102 42
102 John Fen 2016-02-13 90 102 40
107 Ahmed Khan 2015-01-10 75 104 2
104 Raveena 2016-05-28 80 105 4
• NO is Traveller Number
• KM is Kilometer travelled
• NOP is number of travellers travelled in vehicle
• TDATE is Travel Date
(i) To display NO, NAME, TDATE from the table TRAVEL in descending order of NO.
(ii) To display the NAME of all the travellers from the table TRAVEL who are travelling by vehicle
withcode 101 or 102.
(iii) To display the NO and NAME of those travellers from the table TRAVEL who travelled
between ‘ 1 -12-31’ and ‘ 1 -04- 1’.
(iv) To display all the details from table TRAVEL for the travellers, who have travelled distance
more than 100 KM in ascending order of NOP.
(v) Modify the definition of column VTYPE. Increase its size to 20.
(vi) SELECT COUNT (*), CODE FROM TRAVEL GROUP BY CODE HAVING COUNT(*)>1;
(vii) SELECT DISTINCT CODE FROM TRAVEL;
(viii) SELECT A.CODE,NAME,VTYPE FROM TRAVEL A,VEHICLE B WHERE A.CODE=B.CODE ANDKM<90;
123
ANSWER
(i) SELECT NO, NAME, TDATE FROM TRAVEL ORDER BY NO DES ;
(ii) SELECT NAME FROM TRAVEL WHERE ODE=‘1 1’ OR ODE=’1 ’; or
SELECT NAME FROM TRAVEL WHERE ODE N (‘1 1’,’1 ’)
(iii) SELECT NO, NAME from TRAVEL WHERE TDATE >= ‘ 1 1’ AND TDATE <= ‘ 1 1 31’;
OR
SELECT NO, NAME from TRAVEL WHERE TDATE BETWEEN ‘ 1 -04- 1’ AND ‘ 1 -12-31’;
(iv) SELECT * FROM TRAVEL WHERE KM > 100 ORDER BY NOP;
(v) ALTER TABLE VEHICLE MODIFY VTYPE VARCHAR(20);

(vi) COUNT(*) CODE


2 101
2 102
(vii) DISTINCT CODE
101
102
103
104
105
(viii) CODE NAME TYPE
104 Ahmed Khan CAR
105 Raveena SUV

124

You might also like