Friday, January 29, 2016

DLE QBASIC PROGRAMMING SET -1

DLE QBASIC PROGRAMMING
Set 1
1. Write a program to calculate the sum of two numbers.
REM to calculate the sum of two numbers
CLS
INPUT “Enter the first number”; A
INPUT “Enter the second number”; B
SUM = A + B
PRINT “The sum is=”; SUM
END

2. Write a program to calculate simple interest and amount
REM to calculate simple interest and amount
INPUT “Enter the principal amount”; P
INPUT “Enter the rate”; R
INPUT “Enter the time”; T
INTEREST = (P*T*R)/100
AMOUNT = P + INTEREST
PRINT “The Simple Interest is = “; INTEREST
PRINT “The Amount is = “; AMOUNT
END

3. Write a program to calculate area of rectangle.
REM to calculate area of rectangle
INPUT “Enter length of rectangle”;L
INPUT “Enter breadth of rectangle”; B
AREA = L * B
PRINT “The Area of rectangle is=”;AREA
END

4. Write a program to calculate perimeter of rectangle.
REM to calculate perimeter of rectangle
INPUT “Enter length of rectangle”; L
INPUT “Enter breadth of rectangle”; B
PERIMETER = 2*(L+B)
PRINT “The perimeter of rectangle is = “; PERIMETER
END

5.  Write a program to calculate area of a circle.
REM to calculate area of a circle
INPUT “Enter radius of a circle”; R
CONST PI = 22/7
AREA = PI * R ^ 2
PRINT “The area of circle is = “; AREA
END

6. Write a program to calculate perimeter of a circle.
REM to calculate perimeter of a circle
INPUT “Enter radius of a circle”; R
CONST PI = 22/7
PERIMETER  = 2 * PI * R
PRINT “The perimeter of circle is = “; PERIMETER
END

7. Write a program to calculate and display area of four walls. [Hint: Area = 2H(L+B)]
REM to calculate area of four walls
INPUT “Enter length of room”; L
INPUT “Enter breadth of room”; B
INPUT “Enter height of room”; H
AREA = 2 * H * (L +B)
PRINT “Area of four walls of a room is = “; AREA
END

8. Write a program to calculate and display volume of a room.
REM to calculate volume of a room
INPUT “Enter length of room”; L
INPUT “Enter breadth of room”; B
INPUT “Enter height of room”; H
VOLUME = L * B * H
PRINT “Volume of a room is = “; VOLUME
END

9. Write a program to accept temperature in Celsius and convert into Fahrenheit. [Hint: F=9C/5+32]
REM to convert Celsius into Fahrenheit
INPUT “Enter temperature in Celsius”; C
F = 9 * C / 5 + 32
PRINT “Temperature in Fahrenheit = “; F
END


10. Write a program to accept a temperature in Fahrenheit and convert it into Celsius. [Hint: C = (F-32)5/9 ]

REM to convert Fahrenheit into Celsius
INPUT “Enter temperature in Fahrenheit”; F
C = (F - 32) * 5 / 9
PRINT “Temperature in Celsius = “; C
END




**************

Networking and Telecommunication:


Networking and Telecommunication:


Introduction:
Communication:

Communication is simply the act of transferring information from 
one place to another.



Types of Communication:
i) Telecommunication: Telecommunication is the transmission of messages, over significant distance, for the purpose of communication.
ii) Data communication: The process of transferring data or information between computers is called data communication.

Data Transmission Modes
There are three modes for transmitting data from one device to another. They are:
i) Simplex     ii) Half Duplex       iii) Full Duplex
i) Simplex: A simplex communication system can transmit data in one direction only. Devices connected to such a circuit are either send-only or receive-only data. Example : Television, Radio etc.
ii) Half Duplex: A half duplex communication system can transmit data in both directions, but in only one direction at a time. Example: Walkie-Talkie.
iii) Full-Duplex: A full duplex communication system can transmit data in both directions simultaneously. It is a faster mode for transmitting data because no time wastes in switching directions. Example: Telephone, mobile etc.
Computer Network
A computer network is a logical or physical interconnection between two or more computers such that they could communicate with each other.  It is used to provide users with the access to share resources such as data files, application software and hardware.
OR
A computer network is a network of computers that are geographically distributed, but connected in a manner to enable meaningful transmission and exchange of data among them. Sharing of information, resources and processing load is the main objective of a computer network.
OR
Computer network is a group of interconnected computers through transmission media in order to communicate and share resources like hardware, data and software.

Advantages of computer network:
   i) It allows the sharing of resources such as disk storage, printers, image scanners, modem and central servers.
  ii) It allows sharing of information held on disk accessible by all users.
 iii)We can easily send and receive messages by networking .
 iv) It allows the connection of different types of computer which can communicate with each other.

Disadvantages of computer network:
 i) Possible loss of privacy through hacking.
ii) Computer virus spreading each mostly through the network.
iii) Computers on the network have to depend on the server computer for resources.
iv) Data and information may be stolen by computer hacker if the security of network is not reliable.

Band Width:
Band width is the amount of data that can be transmitted through communication channels in a fixed time period.
The Bandwidth of digital signal is measured in bits per second (bps) whereas the bandwidth of analog signal is measured in cycle per second or Hertz.

Communication Media/Transmission Media:
A communication medium or transmission channel is the electronic path through which data information and files transfer from one computer to other computers in the form of electromagnetic wave.

Types of Communication Channel:
There are two main types of communication channels. They are:
 i) Guided Transmission media / Wired Media
ii) Unguided Transmission media / Wireless Media

Guided Transmission Media:

It is the transmission media in which signals are confined to a specific path using wire or cable
Basically three types of guided are used in computer networking they are:
 (i) Twisted Pair Cable
       Twisted pair cable consists of two insulated strands of copper wire twisted around each other. The reason for twisting is to reduce electrical interference. It is the cheapest and easily available wire, which can carry data/information to a large distance without data loss. Twisted pair can be categorized into two types – Shielded Twisted Pair (STP) and Unshielded Twisted Pair (UTP).

 a) Unshielded Twisted Pair :-  UTP cable consists of a number of twisted pairs of wires with a simple plastic casing. UTP is commonly used in telephone systems.



b) Shielded Twisted Pair :-STP cable is similar in construction to UTP except that the twisted pairs are enclosed in a woven copper and foil wrap shield for providing extra protection from external interference.

 (ii) Coaxial Cable

A coaxial cable consists of a thick copper wire in the core, surrounded by an insulating plastic with a net of thin copper wires used as earthing and in the outermost part – it is insulated by a thick plastic cover. It generally comes in two categories – thin coax and thick coax. It is the most popular cable which is being used in TV in our homes. It is better than twisted pair cables and has higher degree of noise immunity and high bandwidth but are expensive than twisted pairs.

(iii) Fiber optic Cable
Fiber-optic cable is made of a light-conducting glass or plastic core surrounded by more glass, called cladding, and a tough outer sheath. A fire-optic cable consists of a bundle of glass threads, each of which is capable of transmitting messages modulated onto light waves.

Unguided Transmission Media:
Unguided transmission media relates to data transmission through the air and is commonly referred to as wireless.

(i) Microwave:
In the microwave system, a high frequency radio signals are used to transfer data through the space. These signals can travel only on the straightway and they cannot bend. The hills and mountains can block the signals. The transmitter and receiver of a microwave system should be in a line of sight so, they are mounted on very high towers.

(ii)Communication Satellite:
A communication satellite is an artificial satellite stationed in space for the purpose of telecommunications. It is placed in outer space and moves its own orbit. The satellite is visible from any point of the earth so the sender and receiver can easily communicate with each other by using antenna aiming the satellite. Placing the satellite along the earth’s orbit takes very high cost.

Network Connecting Devices
 (a) Network Adapter:
Network Interface Card is the computer circuit board or card that is installed in a computer so that it can be connected to a network by using physical channel. Each NIC is assigned a unique MAC (Media Access Control) address by the manufacturer through which data is sent to the destination. The main function of NIC is to convert data into electrical signals and transfer them through cable and vice versa.


(b) Hub:
Hubs are centrally connectivity devices that connect computers in a star topology. Hub contains multiple ports for connecting to network components. It amplifies (/increase) the signals and sends them to all connected devices. Use of hub has become very common in most of the computer networking as it cost lower and easier to install.

 (c) Switch:
Switches are similar to bridge but offer a more direct network connection between the source and destination computers. The main difference between bridge and switch is the way that filtering happens. With a switc0h, filtering and performance better than bridge.

 (d) Bridge:
A bridge is a device that passes data packets between multiple network segments that use the same communication protocol. A bridge passes one signal at a time. It filters the data or inspects incoming signals and decides whether to forward the signals or discard them.
 (e) Router:
Router is a device that acts like a bridge or switch but provides more functionality. It uses addresses for filtering and forwarding the data. Router enable all user in a network to share a single connection to the Internet or a WAN.

 (f) Gateway:
A gateway is a device that enables communication between different network architecture. A gateway takes the data from one network and repackages it, so that each network can understand the other network’s data.

 (g) Repeater:
A repeater is a physical layer device used to interconnect the media segments of an extended network. It amplifies the incoming signals, creates a new copy of it and transmits the signals on the network. A repeater essentially enables a series of cable segment to be treated as a single cable.
 (h) Modem:
A modem is a communication device that enables a computer to transmit information over a standard telephone line. A modem is required when connecting to the Internet using telephone line. It is an essential link between the computer running browser and dial up service providers. A modem is needed to convert digital signal to analog signal and vice versa. During the modulation phase, it is used to translate digital signals of a computer to analog signals, which are then transmit across the standard telephone line. The reverse takes place during its demodulation phase, as the MODEM receives analog signals from a phone line and converts them into digital signals for the computer.
Network Architecture:
The Network Architecture can be broadly classified into two types:
 (i) Peer to Peer Network
In a peer to peer network, there are no central authority server, no network administration who handles security, user accounts, passwords, management and so on. It can take both a client and server role. Each workstation has equal responsibilities. There is no centralized control over shared resources.
Advantages of Peer to Peer Network
(a)  It is easy to set up.
(b)  In this network, users at each computer can determine the resources to be shared among other computers.
(c)  Any required software can be installed on individual computers, so they don’t have to depend on the server.
Disadvantages of Peer to Peer Network
(a)  It tends to slowdown with heavy use.
(b)  It is suitable for only small geographical area.
(c)  The network expansion is limited and cannot be expanded as we wish.
 (ii) Client Server Network
The client server network consist at least one server and one or more clients or workstations, where user does their work. The server is the main computer which gives services to the workstation. It stores and protects the user files and security of entire network.
Advantages of Client-server Network
(a)  The network can be expanded to any size as we wish.
(b)  It is administrated centrally so unauthorized user cannot access network.
(c)  Any required software can be installed in the server so it reduces the cost and time for installation on individual computer.
(d)  It provides high level of security.
Disadvantages of Client-server Network
(a)  It is difficult to setup and trained network administrators are required to handle the system.
(b)  It is expansive as compared to peer to peer network.
Differences between client-server network and Peer-To-Peer network:
Client-Server Network
Peer-To-Peer Network
It is a network model where there is at least one server and one or more client computers.
It is a network architecture where there is no server computer. All the computers on this network are workstations.
Cabling Scheme is difficult and network administrator is required
Cabling scheme is simple.
In this network architecture, all the rights are with the server computer.
In this network architecture, each computer has equal responsibilities.
In this network, the server computer controls and provides resources to client computers.
In this network, there is no computer that controls other workstations. All computers can provide resources to other workstations.
It provides high level of security.
It has low level of security.

Types of Computer Network:
The Different types of computer network are:
 (i) Local Area Network (LAN)
Local Area Network is a network of computers located relatively near to each other connected in such a way to enable communication by means of high-speed cable or wireless link. The main purpose of LAN is to share resources like high-speed laser printer and to facilitate communication among computers.
Features of LAN:
§  It is normally owned by single organization.
§  It offers the higher bandwidth for transferring data. The data can transmit at the rate of 10 to 100 mbps.
§  It is unaffected by environment factors.
(ii) Metropolitan Area Network (MAN)
The interconnection of computers through phone line, co-axial cable or wireless communication system to share data and information within a large geographical area is called MAN.
Features of MAN:
§  It may be owned by single or multiple organizations.
§  It uses cable or wireless connection.
§  It uses private or public connection mediums.
 (iii) Wide Area Network (WAN)
The network that connects two or more LANs together generally across a wide geographical area is called WAN. It is the largest network in the world. The connection mediums used in WAN are telephone lines, microwaves and satellite links. The Internet is an example of a WAN.
Features of WAN:
§  It is not restricted to a geographical location. It covers whole world.
§  It uses satellite links or microwave system to connect several LANs and WANs.
§  It is owned by multiple organizations.
Network Topology (LAN Topology)
The cabling structure or geographical arrangement of computers in Local Area is known as Network Topology or LAN Topology. There are several types of topology used in networking some of them are :
Bus Topology
In bus topology all workstations are connected to a single communication cable called bus or common back bone. Computer and other devices are arranged in linear format. Data are transmitted on the network through the back bone using the computer destination address.
Advantages of Bus Topology:
(a)  It is simple, reliable and easy to use.
(b)  It is easy to add more stations without disrupting the network.
Disadvantages of Bus Topology:
(a)  The whole network goes down if the main cable fails at any point.
(b)  Cable faults is difficult to identify and isolate.
 (ii) Ring Topology
In a ring topology all the nodes are connected to each-other in such a way that they make a closed loop. Each workstation is connected to two other components on either side and it communicates with these two adjacent neighbours. Data travel around the network, in one direction that is clockwise or anti-clockwise.
Advantages of Ring Topology
(a)  Very high transmission rates of data are possible.
(b)  It has short cable connection, which increases in network reliability.
Disadvantages of Ring Topology
(a)  If a single computer fails, at least a portion of the network will not work.
(b)  It is difficult to change network structure.
 (iii) Star Topology
In star topology all computer or network devices are connected through a central device. The common devices used for the central connection are hub and switch.
Advantages of Star Topology
(a)  It is easy to add or remove computers from this topology.
(b)  If one cable fails, the other workstations are not affected.
Disadvantages of Star Topology
(a)  If the central hub fails, the whole network goes down.
(b)  It may be costly to install since long cable length is required.
Communication Protocol
The term communication protocol refers to the set of rules and procedures that govern the transmission of message over a physical networking medium.

Some common protocols are
Protocol
Full Form
Use
TCP / IP
Transmission Control Protocol / Internet Protocol
Deal with slicing the data into small sized packets and routing them along the communication channel
SMTP
Simple Mail Transfer Protocol
Sending e-mail messages between servers
FTP
File Transfer Protocol
File Transfer
HTTP
HyperText Transfer Protocol
Fetching pages on the WWW
POP
Post Office Protocol
Collect incoming mails and store to mailbox.
IPX/SPX
Internet Packet Exchange / Sequential Packet Exchange

NetBEUI
NetBIOS Extended User Interface