You are on page 1of 88

1.

COMPUTER NETWORK
2. INTRODUCTION TO JAVA
3. INTRODUCTION TO HTML
4. OPERATING SYSTEM
5. COMPUTER SOFTWARES
6. CRYPTOGRAPHY AND MULTIMEDIA

COMPUTER DEPARTMENT
D.A.V ALOK PUBLIC SCHOOL, PUNDAG, RANCHI
Introduction To Computer Networks

Today the world scenario is changing. Data Communication and network have changed
the way business and other daily affair works. Now, they rely on computer networks and
internetwork. A set of devices often mentioned as nodes connected by media link is
called a Network. A node can be a device which is capable of sending or receiving data
generated by other nodes on the network like a computer, printer etc. These links
connecting the devices are called Communication channels.
Computer network is a telecommunication channel through which we can share our
data. It is also called data network. The best example of computer network is Internet.
Computer network does not mean a system with control unit and other systems as its
slave. It is called a distributed system
A network must be able to meet certain criteria, these are mentioned below:

1. Performance
2. Reliability
3. Scalability

Performance
It can be measured in following ways :

 Transit time : It is the time taken to travel a message from one device to another.
 Response time : It is defined as the time elapsed between enquiry and response.

Other ways to measure performance are :

1. Efficiency of software
2. Number of users
3. Capability of connected hardware

Reliability
It decides the frequency at which network failure take place. More the failures are, less
is the network's reliability.
Security
It refers to the protection of data from the unauthorised user or access. While travelling
through network, data passes many layers of network, and data can be traced if
attempted. Hence security is also a very important characteristic for Networks.

Properties of Good Network

1. Interpersonal Communication : We can communicate with each other efficiently


and easily example emails, chat rooms, video conferencing etc.
2. Resources can be shared : We can use the resources provided by network such
as printers etc.
3. Sharing files, data : Authorised users are allowed to share the files on the network.

Basic Communication Model


Communication model is used to exchange data between two parties. For example
communication between a computer, server and telephone (through modem).

Source
Data to be transmitted is generated by this device, example: telephones, personal
computers etc.
Transmitter
The data generated by the source system are not directly transmitted in the form they
are generated. The transmitter transforms and encodes the information in such a form
to produce electromagnetic waves or signals.
Transmission System
A transmission system can be a single transmission line or a complex network
connecting source and destination.
Receiver
Receiver accepts the signal from the transmission system and converts it to a form
which is easily managed by the destination device.
Destination
Destination receives the incoming data from the receiver.

Data Communication
The exchange of data between two devices through a transmission medium is Data
Communication. The data is exchanged in the form of 0’s and 1’s. The transmission
medium used is wire cable. For data communication to occur, the communication
device must be part of a communication system. Data Communication has two types
Local and Remote which are discussed below:
Local:
Local communication takes place when the communicating devices are in the same
geographical area, same building, face-to-face between individuals etc.
Remote:
Remote communication takes place over a distance i.e. the devices are farther.
Effectiveness of a Data Communication can be measured through the following
features:

1. Delivery : Delivery should be done to the correct destination.


2. Timeliness : Delivery should be on time.
3. Accuracy : Data delivered should be accurate.

Components of Data Communication

1. Message : It is the information to be delivered.


2. Sender : Sender is the person who is sending the message.
3. Receiver : Receiver is the person to him the message is to be delivered.
4. Medium : It is the medium through which message is to be sent for example
modem.
5. Protocol : These are some set of rules which govern data communication.
Types of Network Topology
Network Topology is the schematic description of a network arrangement, connecting
various nodes (sender and receiver) through lines of connection.

BUS Topology
Bus topology is a network type in which every computer and network device is
connected to single cable. When it has exactly two endpoints, then it is called Linear
Bus topology.

Features of Bus Topology

1. It transmits data only in one direction.


2. Every device is connected to a single cable

Advantages of Bus Topology

1. It is cost effective.
2. Cable required is least compared to other network topology.
3. Used in small networks.
4. It is easy to understand.
5. Easy to expand joining two cables together.
Disadvantages of Bus Topology

1. Cables fails then whole network fails.


2. If network traffic is heavy or nodes are more the performance of the network
decreases.
3. Cable has a limited length.
4. It is slower than the ring topology.

RING Topology
It is called ring topology because it forms a ring as each computer is connected to
another computer, with the last one connected to the first. Exactly two neighbours for
each device.

Features of Ring Topology

1. A number of repeaters are used for Ring topology with large number of nodes,
because if someone wants to send some data to the last node in the ring topology
with 100 nodes, then the data will have to pass through 99 nodes to reach the 100th
node. Hence to prevent data loss repeaters are used in the network.
2. The transmission is unidirectional, but it can be made bidirectional by having 2
connections between each Network Node, it is called Dual Ring Topology.
3. In Dual Ring Topology, two ring networks are formed, and data flow is in opposite
direction in them. Also, if one ring fails, the second ring can act as a backup, to keep
the network up.
4. Data is transferred in a sequential manner that is bit by bit. Data transmitted, has to
pass through each node of the network, till the destination node.

Advantages of Ring Topology

1. Transmitting network is not affected by high traffic or by adding more nodes, as only
the nodes having tokens can transmit data.
2. Cheap to install and expand

Disadvantages of Ring Topology

1. Troubleshooting is difficult in ring topology.


2. Adding or deleting the computers disturbs the network activity.
3. Failure of one computer disturbs the whole network.

STAR Topology
In this type of topology all the computers are connected to a single hub through a cable.
This hub is the central node and all others nodes are connected to the central node.
Features of Star Topology

1. Every node has its own dedicated connection to the hub.


2. Hub acts as a repeater for data flow.
3. Can be used with twisted pair, Optical Fibre or coaxial cable.

Advantages of Star Topology

1. Fast performance with few nodes and low network traffic.


2. Hub can be upgraded easily.
3. Easy to troubleshoot.
4. Easy to setup and modify.
5. Only that node is affected which has failed, rest of the nodes can work smoothly.

Disadvantages of Star Topology

1. Cost of installation is high.


2. Expensive to use.
3. If the hub fails then the whole network is stopped because all the nodes depend on
the hub.
4. Performance is based on the hub that is it depends on its capacity

MESH Topology
It is a point-to-point connection to other nodes or devices. All the network nodes are
connected to each other. Mesh has n(n-1)/2 physical channels to link n devices.
There are two techniques to transmit data over the Mesh topology, they are :

1. Routing
2. Flooding

Routing
In routing, the nodes have a routing logic, as per the network requirements. Like routing
logic to direct the data to reach the destination using the shortest distance. Or, routing
logic which has information about the broken links, and it avoids those node etc. We
can even have routing logic, to re-configure the failed nodes.
Flooding
In flooding, the same data is transmitted to all the network nodes, hence no routing logic
is required. The network is robust, and the its very unlikely to lose the data. But it leads
to unwanted load over the network.
Types of Mesh Topology

1. Partial Mesh Topology: In this topology some of the systems are connected in the
same fashion as mesh topology but some devices are only connected to two or
three devices.
2. Full Mesh Topology: Each and every nodes or devices are connected to each
other.

Features of Mesh Topology

1. Fully connected.
2. Robust.
3. Not flexible.

Advantages of Mesh Topology

1. Each connection can carry its own data load.


2. It is robust.
3. Fault is diagnosed easily.
4. Provides security and privacy.

Disadvantages of Mesh Topology

1. Installation and configuration is difficult.


2. Cabling cost is more.
3. Bulk wiring is required.
TREE Topology
It has a root node and all other nodes are connected to it forming a hierarchy. It is also
called hierarchical topology. It should at least have three levels to the hierarchy.

Features of Tree Topology

1. Ideal if workstations are located in groups.


2. Used in Wide Area Network.

Advantages of Tree Topology

1. Extension of bus and star topologies.


2. Expansion of nodes is possible and easy.
3. Easily managed and maintained.
4. Error detection is easily done.

Disadvantages of Tree Topology

1. Heavily cabled.
2. Costly.
3. If more nodes are added maintenance is difficult.
4. Central hub fails, network fails.
HYBRID Topology
It is two different types of topologies which is a mixture of two or more topologies. For
example if in an office in one department ring topology is used and in another star
topology is used, connecting these topologies will result in Hybrid Topology (ring
topology and star topology).

Features of Hybrid Topology

1. It is a combination of two or topologies


2. Inherits the advantages and disadvantages of the topologies included

Advantages of Hybrid Topology

1. Reliable as Error detecting and trouble shooting is easy.


2. Effective.
3. Scalable as size can be increased easily.
4. Flexible.

Disadvantages of Hybrid Topology

1. Complex in design.
2. Costly.
Advantages and Disadvantages of Computer Networking
Computer networking has become one of the most successful ways of sharing
information, where all computers are wirelessly linked together by a common network.
Now, businesses and organizations heavily rely on it to get messages and information
across to essential channels. Not only has that it benefited establishments, but also
individuals, as they also need to share important information every day. But no matter
how useful computer networking is, it does not come without drawbacks. Here are its
advantages and disadvantages:

List of Advantages of Computer Networking


1. It enhances communication and availability of information.
Networking, especially with full access to the web, allows ways of communication that
would simply be impossible before it was developed. Instant messaging can now allow
users to talk in real time and send files to other people wherever they are in the world,
which is a huge boon for businesses. Also, it allows access to a vast amount of useful
information, including traditional reference materials and timely facts, such as news and
current events.

2. It allows for more convenient resource sharing.


This benefit is very important, particularly for larger companies that really need to
produce huge numbers of resources to be shared to all the people. Since the
technology involves computer-based work, it is assured that the resources they wanted
to get across would be completely shared by connecting to a computer network which
their audience is also using.

3. It makes file sharing easier.


Computer networking allows easier accessibility for people to share their files, which
greatly helps them with saving more time and effort, since they could do file sharing
more accordingly and effectively.

4. It is highly flexible.
This technology is known to be very flexible, as it gives users the opportunity to explore
everything about essential things, such as software without affecting their functionality.
Plus, people will have the accessibility to all information they need to get and share.
5. It is an inexpensive system.
Installing networking software on your device would not cost too much, as you are
assured that it lasts and can effectively share information to your peers. Also, there is
no need to change the software regularly, as mostly it is not required to do so.

6. It increases cost efficiency.


With computer networking, you can use a lot of software products available on the
market which can just be stored or installed in your system or server, and can then be
used by various workstations.

7. It boosts storage capacity.


Since you are going to share information, files and resources to other people, you have
to ensure all data and content are properly stored in the system. With this networking
technology, you can do all of this without any hassle, while having all the space you
need for storage.

List of Disadvantages of Computer Networking


1. It lacks independence.
Computer networking involves a process that is operated using computers, so people
will be relying more of computer work, instead of exerting an effort for their tasks at
hand. Aside from this, they will be dependent on the main file server, which means that,
if it breaks down, the system would become useless, making users idle.

2. It poses security difficulties.


Because there would be a huge number of people who would be using a computer
network to get and share some of their files and resources, a certain user’s security
would be always at risk. There might even be illegal activities that would occur, which
you need to be careful about and aware of.

3. It lacks robustness.
As previously stated, if a computer network’s main server breaks down, the entire
system would become useless. Also, if it has a bridging device or a central linking
server that fails, the entire network would also come to a standstill. To deal with these
problems, huge networks should have a powerful computer to serve as file server to
make setting up and maintaining the network easier.

4. It allows for more presence of computer viruses and malware.


There would be instances that stored files are corrupt due to computer viruses. Thus,
network administrators should conduct regular check-ups on the system, and the stored
files at the same time.

5. Its light policing usage promotes negative acts.


It has been observed that providing users with internet connectivity has fostered
undesirable behavior among them. Considering that the web is a minefield of
distractions—online games, humor sites and even porn sites—workers could be
tempted during their work hours. The huge network of machines could also encourage
them to engage in illicit practices, such as instant messaging and file sharing, instead of
working on work-related matters. While many organizations draw up certain policies on
this, they have proven difficult to enforce and even engendered resentment from
employees.

6. It requires an efficient handler.


For a computer network to work efficiently and optimally, it requires high technical skills
and know-how of its operations and administration. A person just having basic skills
cannot do this job. Take note that the responsibility to handle such a system is high, as
allotting permissions and passwords can be daunting. Similarly, network configuration
and connection is very tedious and cannot be done by an average technician who does
not have advanced knowledge.

7. It requires an expensive set-up.


Though computer networks are said to be an inexpensive system when it is already
running, its initial set up cost can still be high depending on the number of computers to
be connected. Expensive devices, such as routers, switches, hubs, etc., can add up to
the cost. Aside from these, it would also need network interface cards (NICs) for
workstations in case they are not built in.
Conclusion
Computer networking will always be a fast and convenient means of transferring and
sharing information, but people should be aware of its consequences as well. They
should remember that often relying on this system can put them at certain risks that can
be cause by its flaws and other malfunctions.

KEY TERMS in Computer Networks


Following are some important terms, which are frequently used in context of Computer Networks.

Terms Definition

1. ISO The OSI model is a product of the Open Systems Interconnection project at the
International Organization for Standardization. ISO is a voluntary organization.

2. OSI Model Open System Interconnection is a model consisting of seven logical layers.

3. TCP/IP Model Transmission Control Protocol and Internet Protocol Model is based on four layer
model which is based on Protocols.

4. UTP Unshielded Twisted Pair cable is a Wired/Guided media which consists of two
conductors usually copper, each with its own colour plastic insulator

5. STP Shielded Twisted Pair cable is a Wired/Guided media has a metal foil or braided-
mesh covering which encases each pair of insulated conductors. Shielding also
eliminates crosstalk

6. PPP Point-to-Point connection is a protocol which is used as a communication link


between two devices.

7. LAN Local Area Network is designed for small areas such as an office, group of
building or a factory.
8. WAN Wide Area Network is used for the network that covers large distance such as
cover states of a country

9. MAN Metropolitan Area Network uses the similar technology as LAN. It is designed to
extend over the entire city.

10. Crosstalk Undesired effect of one circuit on another circuit. It can occur when one line picks
up some signals travelling down another line. Example: telephone conversation
when one can hear background conversations. It can be eliminated by shielding
each pair of twisted pair cable.

11. PSTN Public Switched Telephone Network consists of telephone lines, cellular networks,
satellites for communication, fiber optic cables etc. It is the combination of world’s
(national, local and regional) circuit switched telephone network.

12. File Transfer, Standard mechanism to access files and manages it. Users can access files in a
Access and remote computer and manage it.
Management (FTAM)

13. Analog The signal is continuously variable in amplitude and frequency. Power requirement
Transmission is high when compared with Digital Transmission.

14. Digital It is a sequence of voltage pulses. It is basically a series of discrete pulses.


Transmission Security is better than Analog Transmission.
Introduction to Java
It is one of the programming language or technology used for developing web applications. Using

this technology you can develop distributed application. A Java language developed at SUN Micro

Systems in the year 1995 under the guidance of James Gosling and their team. In other word It is

a programming language suitable for the development of web applications. It is also used for

developing desktop and mobile application.


Born
This language was developed at SUN Microsystems in the year 1995 under the guidance of James

Gosling and their team.


Overview of Java
Java is one of the programming language or technology used for developing web applications.

Java language developed at SUN Micro Systems in the year 1995 under the guidance of James

Gosling and there team. Originally SUN Micro Systems is one of the Academic University

(Standford University Network)

Whatever the software developed in the year 1990, SUN Micro Systems has released on the name

of oak, which is original name of java (scientifically oak is one of the tree name). The OAK has

taken 18 months to develop.

The oak is unable to fulfill all requirements of the industry. So James Gosling again reviews this

oak and released with the name of java in the year 1995. Scientifically java is one of the coffee

seed name.
Java divided into three categories, they are
 J2SE (Java 2 Standard Edition)
 J2EE (Java 2 Enterprise Edition)
 J2ME (Java 2 Micro or Mobile Edition)

J2SE
J2SE is used for developing client side applications.
J2EE
J2EE is used for developing server side applications.
J2ME
J2ME is used for developing mobile or wireless application by making use of a predefined protocol
called WAP (wireless Access / Application protocol).
Basic Points of Java

Java is a platform independent, more powerful, secure, high performance, multithreaded

programming language. Here we discuss some points related to Java.

Define byte

Byte code is the set of optimized instructions generated during compilation phase and it is more

powerful than ordinary pointer code.

Define JRE

The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK). It contains a

set of libraries and tools for developing Java application. The Java Runtime Environment provides

the minimum requirements for executing a Java application.

Define JVM

JVM is set of programs developed by sun Micro System and supplied as a part of the JDK for

reading line by line line of byte code and it converts into a native understanding form of operating

system. The Java language is one of the compiled and interpreted programming language.

Garbage Collector

The Garbage Collector is the system Java program which runs in the background along with a

regular Java program to collect un-Referenced (unused) memory space for improving the

performance of our applications.

Note: Java programming does not support destructor concept in place of destructor, we have

garbage collector program.

Define an API

An API (Application Programming Interface) is a collection of packages, a package is the

collection of classes, interfaces and sub-packages. A sub-package is a collection of classes,

Interfaces and sub sub packages etc.


Java programming contains user friendly syntax so that we can develop effective applications. in

other words if any language is providing user friendly syntax, we can develop error free

applications.

Definition of JIT

JIT is the set of programs developed by SUN Micro System and added as a part of JVM, to speed

up the interpretation phase.

Network based application

Network based application are mainly classified into two types.

 Centralized Applications

 Distributed Applications

Centralized applications

In this scenario multiple client system depends on single server system.

The major drawback in this architecture is if any problem occurred on server system that will be

reflected on every client system.


Distributed applications

In this scenario multiple client system are depends on multiple server system so that even problem

occurred in one server will never be reflected on any client system.

In this architecture same application is distributed in multiple server system.

Java is a very powerful language can be used to developed both client server architecture and

distributed architecture based application.


Features of Java
Features of a language are nothing but the set of services or facilities provided by the language

vendors to the industry programmers. Some important features of java are;

Important Features of Java

 Simple

 Platform Independent

 Architectural Neutral

 Portable

 Multi-Threading

 Distributed

 Networked

 Robust
 Dynamic

 Secured

 High Performance

 Interpreted

 Object Oriented

1. Simple

It is simple because of the following factors:

 It is free from pointer due to this execution time of application is improved.


[Whenever we write a Java program without pointers then internally it is converted
into the equivalent pointer program].
 It has Rich set of API (application protocol interface).
 It hs Garbage Collector which is always used to collect un-Referenced (unused)
Memory location for improving performance of a Java program.

 It contains user friendly syntax for developing any applications.

2. Platform Independent

A program or technology is said to be platform independent if and only if which can run on all

available operating systems with respect to its development and compilation. (Platform represents

O.S).
3. Architectural Neutral

Architecture represents processor.

A Language or Technology is said to be Architectural neutral which can run on any available

processors in the real world without considering their development and compilation.

The languages like C, CPP are treated as architectural dependent.


4. Portable

If any language supports platform independent and architectural neutral feature known as portable.

The languages like C, CPP, Pascal are treated as non-portable language. It is a portable language.

According to SUN microsystem.

5. Multithreaded

A flow of control is known as a thread. When any Language executes multiple thread at a time that

language is known as multithreaded e. It is multithreaded.

6. Distributed

Using this language we can create distributed applications. RMI and EJB are used for creating

distributed applications. In distributed application multiple client system depends on multiple server

systems so that even problem occurred in one server will never be reflected on any client system.
Note: In this architecture same application is distributed in multiple server system.

7. Networked

It is mainly designed for web based applications, J2EE is used for developing network based

applications.

8. Robust

Simply means of Robust are strong. It is robust or strong Programming Language because of its

capability to handle Run-time Error, automatic garbage collection, the lack of pointer concept,

Exception Handling. All these points make It robust Language.

9. Dynamic

It supports Dynamic memory allocation due to this memory wastage is reduce and improve

performance of the application. The process of allocating the memory space to the input of the

program at a run-time is known as dynamic memory allocation, To programming to allocate

memory space by dynamically we use an operator called 'new' 'new' operator is known as dynamic

memory allocation operator.

10. Secure

It is a more secure language compared to other language; In this language, all code is covered in

byte code after compilation which is not readable by human.

11. High performance

It have high performance because of following reasons;

 This language uses Bytecode which is faster than ordinary pointer code so
Performance of this language is high.
 Garbage collector, collect the unused memory space and improve the performance
of the application.
 It has no pointers so that using this language we can develop an application very
easily.
 It support multithreading, because of this time consuming process can be reduced
to executing the program.

12. Interpreted

It is one of the highly interpreted programming languages.

13. Object Oriented

It supports OOP's concepts because of this it is most secure language.

Application of Java
Java is widely used in every corner of world and of human life. Java is not only used in softwares but
is also widely used in designing hardware controlling software components. There are more than
930 million JRE downloads each year and 3 billion mobile phones run java.
Following are some other usage of Java :

1. Developing Desktop Applications

2. Web Applications like Linkedin.com, Snapdeal.com etc

3. Mobile Operating System like Android

4. Embedded Systems

5. Robotics and games etc.

What is JVM?
Java virtual Machine(JVM) is a virtual Machine that provides runtime environment to execute java
byte code. The JVM doesn't understand Java typo, that's why you compile your *.java files to
obtain *.class files that contain the bytecodes understandable by the JVM.
JVM control execution of every Java program. It enables features such as automated exception
handling, Garbage-collected heap.
JVM Architecture

Class Loader : Class loader loads the Class for execution.


Method area : Stores pre-class structure as constant pool.
Heap : Heap is in which objects are allocated.
Stack : Local variables and partial results are store here. Each thread has a private JVM stack
created when the thread is created.
Program register : Program register holds the address of JVM instruction currently being executed.
Native method stack : It contains all native used in application.
Executive Engine : Execution engine controls the execute of instructions contained in the methods
of the classes.
Native Method Interface : Native method interface gives an interface between java code and native
code during execution.
Native Method Libraries : Native Libraries consist of files required for the execution of native code.
Difference between JDK and JRE
JRE : The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and
other components to run applets and applications written in the Java programming language. JRE
does not contain tools and utilities such as compilers or debuggers for developing applets and
applications.

JDK : The JDK also called Java Development Kit is a superset of the JRE, and contains everything
that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets
and applications.
First Java Program
Let us look at a simple java program.
class Hello

public static void main(String[] args)

System.out.println ("Hello World program");

class : class keyword is used to declare classes in Java


public : It is an access specifier. Public means this function is visible to all.
static : static is again a keyword used to make a function static. To execute a static function you
do not have to create an Object of the class. The main() method here is called by JVM, without
creating any object for class.
void : It is the return type, meaning this function will not return anything.
main : main() method is the most important method in a Java program. This is the method which
is executed, hence all the logic must be inside the main() method. If a java class is not having a
main() method, it causes compilation error.
String[] args : This represents an array whose type is String and name is args. We will discuss
more about array in Java Array section.
System.out.println : This is used to print anything on the console like printf in C language.

Steps to Compile and Run your first Java program


Step 1: Open a text editor and write the code as above.
Step 2: Save the file as Hello.java
Step 3: Open command prompt and go to the directory where you saved your first java program
assuming it is saved in C:\
Step 4: Type javac Hello.java and press Return(Enter KEY) to compile your code. This
command will call the Java Compiler asking it to compile the specified file. If there are no errors
in the code the command prompt will take you to the next line.
Step 5: Now type java Hello on command prompt to run your program.
Step 6: You will be able to see Hello world program printed on your command prompt.
Now let us see what happens at Runtime
After writing your Java program, when you will try to compile it. Compiler will perform some
compilation operation on your program.
Once it is compiled successfully byte code (.class file) is generated by the compiler.

After compiling when you will try to run the byte code(.class file), the following steps are
performed at runtime:-

1. Class loader loads the java class. It is subsystem of JVM Java Virtual machine.

2. Byte Code verifier checks the code fragments for illegal codes that can violate access right to the

object.

3. Interpreter reads the byte code stream and then executes the instructions, step by step.
Decision Making Statement in Java

Decision making statement statements is also called selection statement. That is depending on

the condition block need to be executed or not which is decided by condition. If the condition is

"true" statement block will be executed, if condition is "false" then statement block will not be

executed. In java there are three types of decision making statement.

 if

 if-else

 switch

if-then Statement

if-then is most basic statement of Decision making statement. It tells to program to execute a certain

part of code only if particular condition is true.


Syntax

if(condition)

Statement(s)

Example if statement

class Hello
{
int a=10;
public static void main(String[] args)
{
if(a<15)
{
System.out.println("Hello good morning!");
}
}
}

Output

Hello good morning

if-else statement

In general it can be used to execute one block of statement among two blocks, in java

language if and else are the keyword in java.


Syntax

if(condition)

Statement(s)

else

Statement(s)

........
In the above syntax whenever condition is true all the if block statement are executed, remaining

statement of the program by neglecting. If the condition is false else block statement executed and

neglecting if block statements.

Example if else

import java.util.Scanner;
class Oddeven
{
public static void main(String[] args)
{
int no;
Scanner s=new Scanner(System.in);
System.out.println("Enter any number :");
no=s.nextInt();
if(no%2==0)
{
System.out.println("Even number");
}
else
{
System.out.println("Odd number");
}
}
}

Output

Enter any number :

10

Even number
Looping Statement in Java

Looping statement are the statements execute one or more statement repeatedly several number

of times. In java programming language there are three types of loops; while, for and do-while.

Why use loop?

When you need to execute a block of code several number of times then you need to use looping

concept in Java language.

Advantage with looping statement

 Reduce length of Code

 Take less memory space.

 Burden on the developer is reducing.

 Time consuming process to execute the program is reduced.

Difference between conditional and looping statement

Conditional statement executes only once in the program where as looping statements executes

repeatedly several number of time.

While loop

In while loop first check the condition if condition is true then control goes inside the loop body

otherwise goes outside of the body. while loop will be repeats in clock wise direction.
Syntax

while(condition)

Statement(s)

Increment / decrements (++ or --);

Example while loop

class whileDemo
{
public static void main(String args[])
{
int i=0;
while(i<5)
{
System.out.println(+i);
i++;
}

Output

for loop

for loop is a statement which allows code to be repeatedly executed. For loop contains 3 parts

Initialization, Condition and Increment or Decrements


Syntax

for ( initialization; condition; increment )

statement(s);

}
 Initialization: This step is execute first and this is execute only once when we are
entering into the loop first time. This step is allow to declare and initialize any loop
control variables.
 Condition: This is next step after initialization step, if it is true, the body of the loop
is executed, if it is false then the body of the loop does not execute and flow of control
goes outside of the for loop.
 Increment or Decrements: After completion of Initialization and Condition steps
loop body code is executed and then Increment or Decrements steps is execute. This
statement allows to update any loop control variables.
Flow Diagram

Control flow of for loop


 First initialize the variable

 In second step check condition

 In third step control goes inside loop body and execute.

 At last increase the value of variable

 Same process is repeat until condition not false.


Improve your looping conceptFor Loop

Display any message exactly 5 times.


Example of for loop

class Hello
{
public static void main(String args[])
{
int i;
for (i=0: i<5; i++)
{
System.out.println("Hello Friends !");
}
}
}

Output

Hello Friends !

Hello Friends !

Hello Friends !

Hello Friends !

Hello Friends !

do-while

A do-while loop is similar to a while loop, except that a do-while loop is execute at least one time.
A do while loop is a control flow statement that executes a block of code at least once, and then

repeatedly executes the block, or not, depending on a given condition at the end of the block (in

while).

When use do While loop

When we need to repeat the statement block at least one time then ues do-while loop. In do-while

loop post-checking process will be occur, that is after execution of the statement block condition

part will be executed.


Syntax

do

Statement(s)

increment/decrement (++ or --)

}while();

In below example you can see in this program i=20 and we chech condition i is less than 10, that

means conditon is false but do..while loop execute onec and print Hello world ! at one time.

Example do..while loop

class dowhileDemo
{
public static void main(String args[])
{
int i=20;
do
{
System.out.println("Hello world !");
i++;
}
while(i<10);
}
}

Output

Hello world !
Example do..while loop

class dowhileDemo
{
public static void main(String args[])
{
int i=0;
do
{
System.out.println(+i);
i++;
}
while(i<5);
}
}

Output

5
HTML Introduction
What is HTML?
HTML is the standard markup language for creating Web pages.

 HTML stands for Hyper Text Markup Language


 HTML describes the structure of Web pages using markup
 HTML elements are the building blocks of HTML pages
 HTML elements are represented by tags
 HTML tags label pieces of content such as "heading", "paragraph", "table",
and so on
 Browsers do not display the HTML tags, but use them to render the
content of the page

A Simple HTML Document


Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>

Try it Yourself »

Example Explained
 The <!DOCTYPE html> declaration defines this document to be HTML5
 The <html> element is the root element of an HTML page
 The <head> element contains meta information about the document
 The <title> element specifies a title for the document
 The <body> element contains the visible page content
 The <h1> element defines a large heading
 The <p> element defines a paragraph

HTML Tags
HTML tags are element names surrounded by angle brackets:

<tagname>content goes here...</tagname>

 HTML tags normally come in pairs like <p> and </p>


 The first tag in a pair is the start tag, the second tag is the end tag
 The end tag is written like the start tag, but with a forward
slash inserted before the tag name

Tip: The start tag is also called the opening tag, and the end tag the closing
tag.

Web Browsers
The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML
documents and display them.

The browser does not display the HTML tags, but uses them to determine how
to display the document:
HTML Page Structure
Below is a visualization of an HTML page structure:

<html>
<head>

<title>Page title</title>

</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

</body>
</html>

Note: Only the content inside the <body> section (the white area above) is
displayed in a browser.
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration represents the document type, and helps
browsers to display web pages correctly.

It must only appear once, at the top of the page (before any HTML tags).

The <!DOCTYPE> declaration is not case sensitive.

The <!DOCTYPE> declaration for HTML is:

<!DOCTYPE html>

HTML Versions
Since the early days of the web, there have been many versions of HTML:

Version Year

HTML 1991

HTML 2.0 1995

HTML 3.2 1997

HTML 4.01 1999

XHTML 2000

HTML5 2014
HTML Editors
Write HTML Using Notepad or TextEdit
Web pages can be created and modified by using professional HTML editors.

However, for learning HTML we recommend a simple text editor like Notepad
(PC) or TextEdit (Mac).

We believe using a simple text editor is a good way to learn HTML.

Follow the four steps below to create your first web page with Notepad or
TextEdit.

Step 1: Open Notepad (PC)


Windows 8 or later:

Open the Start Screen (the window symbol at the bottom left on your screen).
Type Notepad.

Windows 7 or earlier:

Open Start > Programs > Accessories > Notepad

Step 1: Open TextEdit (Mac)


Open Finder > Applications > TextEdit

Also change some preferences to get the application to save files


correctly. In Preferences > Format > choose "Plain Text"

Then under "Open and Save", check the box that says "Ignore rich text
commands in HTML files".

Then open a new document to place the code.


Step 2: Write Some HTML
Write or copy some HTML into Notepad.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

Step 3: Save the HTML Page


Save the file on your computer. Select File > Save as in the Notepad menu.

Name the file "index.htm" and set the encoding to UTF-8 (which is the
preferred encoding for HTML files).
You can use either .htm or .html as file extension. There is no difference, it is
up to you.

Step 4: View the HTML Page in Your Browser


Open the saved HTML file in your favorite browser (double click on the file, or
right-click - and choose "Open with").

The result will look much like this:


HTML Basic Examples

HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE
html>.

The HTML document itself begins with <html> and ends with </html>.

The visible part of the HTML document is between <body> and </body>.

Example
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>

Try it Yourself »

HTML Headings
HTML headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important
heading:

Example
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>

Try it Yourself »
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:

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

Try it Yourself »

HTML Links
HTML links are defined with the <a> tag:

Example
<a href="https://www.w3schools.com">This is a link</a>

Try it Yourself »

The link's destination is specified in the href attribute.

Attributes are used to provide additional information about HTML elements.

HTML Images
HTML images are defined with the <img> tag.

The source file (src), alternative text (alt), width, and height are provided as
attributes:

Example
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
Try it Yourself »

HTML Elements
An HTML element usually consists of a start tag and end tag, with the content
inserted in between:

<tagname>Content goes here...</tagname>

The HTML element is everything from the start tag to the end tag:

<p>My first paragraph.</p>


Start tag Element content End tag

<h1> My First Heading </h1>

<p> My first paragraph. </p>

<br>

HTML elements with no content are called empty elements. Empty elements do
not have an end tag, such as the <br> element (which indicates a line break).

Nested HTML Elements


HTML elements can be nested (elements can contain elements).

All HTML documents consist of nested HTML elements.

This example contains four HTML elements:

Example
<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>
</body>
</html>

Try it Yourself »

Example Explained
The <html> element defines the whole document.

It has a start tag <html> and an end tag </html>.

The element content is another HTML element (the <body> element).

<html>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>

The <body> element defines the document body.

It has a start tag <body> and an end tag </body>.

The element content is two other HTML elements (<h1> and <p>).

<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>

The <h1> element defines a heading.

It has a start tag <h1> and an end tag </h1>.

The element content is: My First Heading.

<h1>My First Heading</h1>

The <p> element defines a paragraph.

It has a start tag <p> and an end tag </p>.


The element content is: My first paragraph.

<p>My first paragraph.</p>

Do Not Forget the End Tag


Some HTML elements will display correctly, even if you forget the end tag:

Example
<html>
<body>

<p>This is a paragraph
<p>This is a paragraph

</body>
</html>

Try it Yourself »

The example above works in all browsers, because the closing tag is considered
optional.

Never rely on this. It might produce unexpected results and/or errors if


you forget the end tag.

Empty HTML Elements


HTML elements with no content are called empty elements.

<br> is an empty element without a closing tag (the <br> tag defines a line
break).

Empty elements can be "closed" in the opening tag like this: <br />.
HTML5 does not require empty elements to be closed. But if you want stricter
validation, or if you need to make your document readable by XML parsers, you
must close all HTML elements properly.

Use Lowercase Tags


HTML tags are not case sensitive: <P> means the same as <p>.

The HTML5 standard does not require lowercase tags, but


W3C recommends lowercase in HTML, and demands lowercase for stricter
document types like XHTML.

HTML Attributes
 All HTML elements can have attributes
 Attributes provide additional information about an element
 Attributes are always specified in the start tag
 Attributes usually come in name/value pairs like: name="value"

The lang Attribute


The language of the document can be declared in the <html> tag.

The language is declared with the lang attribute.

Declaring a language is important for accessibility applications (screen readers)


and search engines:

<!DOCTYPE html>
<html lang="en-US">
<body>

...

</body>
</html>
The first two letters specify the language (en). If there is a dialect, use two
more letters (US).

The title Attribute


Here, a title attribute is added to the <p> element. The value of the title
attribute will be displayed as a tooltip when you mouse over the paragraph:

Example
<p title="I'm a tooltip">
This is a paragraph.
</p>

Try it Yourself »

The href Attribute


HTML links are defined with the <a> tag. The link address is specified in
the href attribute:

Example
<a href="https://www.w3schools.com">This is a link</a>

Try it Yourself »

You will learn more about links and the <a> tag later in this tutorial.

Size Attributes
HTML images are defined with the <img> tag.

The filename of the source (src), and the size of the image (width and height)
are all provided as attributes:
Example
<img src="w3schools.jpg" width="104" height="142">

Try it Yourself »

The image size is specified in pixels: width="104" means 104 screen pixels
wide.

You will learn more about images and the <img> tag later in this tutorial.

The alt Attribute


The alt attribute specifies an alternative text to be used, when an image cannot
be displayed.

The value of the attribute can be read by screen readers. This way, someone
"listening" to the webpage, e.g. a blind person, can "hear" the element.

Example
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

Try it Yourself »

We Suggest: Use Lowercase Attributes


The HTML5 standard does not require lowercase attribute names.

The title attribute can be written with uppercase or lowercase


like title or TITLE.

W3C recommends lowercase in HTML, and demands lowercase for stricter


document types like XHTML.

Single or Double Quotes?


Double quotes around attribute values are the most common in HTML, but
single quotes can also be used.
In some situations, when the attribute value itself contains double quotes, it is
necessary to use single quotes:

<p title='John "ShotGun" Nelson'>

Or vice versa:

<p title="John 'ShotGun' Nelson">

HTML Headings
Headings are defined with the <h1> to <h6> tags.

<h1> defines the most important heading. <h6> defines the least important
heading.

Example
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>

Try it Yourself »

Note: Browsers automatically add some white space (a margin) before and
after a heading.

Headings Are Important


Search engines use the headings to index the structure and content of your web
pages.

Users skim your pages by its headings. It is important to use headings to show
the document structure.

<h1> headings should be used for main headings, followed by <h2> headings,
then the less important <h3>, and so on.

Note: Use HTML headings for headings only. Don't use headings to make
text BIG or bold.
HTML Horizontal Rules
The <hr> tag defines a thematic break in an HTML page, and is most often
displayed as a horizontal rule.

The <hr> element is used to separate content (or define a change) in an HTML
page:

Example
<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>

Try it Yourself »

The HTML <head> Element


The HTML <head> element has nothing to do with HTML headings.

The <head> element is a container for metadata. HTML metadata is data about
the HTML document. Metadata is not displayed.

The <head> element is placed between the <html> tag and the <body> tag:

Example
<!DOCTYPE html>
<html>

<head>
<title>My First HTML</title>
<meta charset="UTF-8">
</head>

<body>
.
.
.

Try it Yourself »
Note: Metadata typically define the document title, character set, styles, links,
scripts, and other meta information.

HTML Paragraphs
The HTML <p> element defines a paragraph:

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

Try it Yourself »

Note: Browsers automatically add some white space (a margin) before and
after a paragraph.

HTML Display
You cannot be sure how HTML will be displayed.

Large or small screens, and resized windows will create different results.

With HTML, you cannot change the output by adding extra spaces or extra lines
in your HTML code.

The browser will remove any extra spaces and extra lines when the page is
displayed:

Example
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>

<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>

Try it Yourself »

Don't Forget the End Tag


Most browsers will display HTML correctly even if you forget the end tag:

Example
<p>This is a paragraph.
<p>This is another paragraph.

Try it Yourself »

The example above will work in most browsers, but do not rely on it.

Note: Dropping the end tag can produce unexpected results or errors.

HTML Line Breaks


The HTML <br> element defines a line break.

Use <br> if you want a line break (a new line) without starting a new
paragraph:

Example
<p>This is<br>a paragraph<br>with line breaks.</p>

Try it Yourself »

The <br> tag is an empty tag, which means that it has no end tag.
The Poem Problem
This poem will display on a single line:

Example
<p>
My Bonnie lies over the ocean.

My Bonnie lies over the sea.

My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.


</p>

Try it Yourself »

The HTML <pre> Element


The HTML <pre> element defines preformatted text.

The text inside a <pre> element is displayed in a fixed-width font (usually


Courier), and it preserves both spaces and line breaks:

Example
<pre>
My Bonnie lies over the ocean.

My Bonnie lies over the sea.

My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.


</pre>

Try it Yourself »
HTML Styles
Example
I am Red

I am Blue

I am Big
Try it Yourself »

The HTML Style Attribute


Setting the style of an HTML element, can be done with the style attribute.

The HTML style attribute has the following syntax:

<tagname style="property:value;">

The property is a CSS property. The value is a CSS value.

You will learn more about CSS later in this tutorial.

HTML Background Color


The background-color property defines the background color for an HTML
element.

This example sets the background color for a page to powderblue:

Example
<body style="background-color:powderblue;">

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>

Try it Yourself »
HTML Text Color
The color property defines the text color for an HTML element:

Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

Try it Yourself »

HTML Fonts
The font-family property defines the font to be used for an HTML element:

Example
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>

Try it Yourself »

HTML Text Size


The font-size property defines the text size for an HTML element:

Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>

Try it Yourself »

HTML Text Alignment


The text-align property defines the horizontal text alignment for an HTML
element:

Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>

Try it Yourself »
HTML Tables
HTML Table Example
Company Contact Country

Alfreds Futterkiste Maria Anders Germany

Centro comercial Moctezuma Francisco Chang Mexico

Ernst Handel Roland Mendel Austria

Island Trading Helen Bennett UK

Laughing Bacchus Winecellars Yoshi Tannamuri Canada

Magazzini Alimentari Riuniti Giovanni Rovelli Italy

Try it Yourself »

Defining an HTML Table


An HTML table is defined with the <table> tag.

Each table row is defined with the <tr> tag. A table header is defined with
the <th> tag. By default, table headings are bold and centered. A table
data/cell is defined with the <td> tag.

Example
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>

Try it Yourself »

Note: The <td> elements are the data containers of the table.
They can contain all sorts of HTML elements; text, images, lists, other tables,
etc.

HTML Table - Adding a Border


If you do not specify a border for the table, it will be displayed without borders.

A border is set using the CSS border property:

Example
table, th, td {
border: 1px solid black;
}

Try it Yourself »

Remember to define borders for both the table and the table cells.

HTML Table - Collapsed Borders


If you want the borders to collapse into one border, add the CSS border-
collapse property:

Example
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}

Try it Yourself »
HTML Table - Adding Cell Padding
Cell padding specifies the space between the cell content and its borders.

If you do not specify a padding, the table cells will be displayed without
padding.

To set the padding, use the CSS padding property:

Example
th, td {
padding: 15px;
}

Try it Yourself »

HTML Table - Left-align Headings


By default, table headings are bold and centered.

To left-align the table headings, use the CSS text-align property:

Example
th {
text-align: left;
}

Try it Yourself »

HTML Table - Adding Border Spacing


Border spacing specifies the space between the cells.

To set the border spacing for a table, use the CSS border-spacing property:

Example
table {
border-spacing: 5px;
}

Try it Yourself »
Note: If the table has collapsed borders, border-spacing has no effect.

HTML Table - Cells that Span Many Columns


To make a cell span more than one column, use the colspan attribute:

Example
<table style="width:100%">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<tr>
<td>Bill Gates</td>
<td>55577854</td>
<td>55577855</td>
</tr>
</table>

Try it Yourself »

HTML Table - Cells that Span Many Rows


To make a cell span more than one row, use the rowspan attribute:

Example
<table style="width:100%">
<tr>
<th>Name:</th>
<td>Bill Gates</td>
</tr>
<tr>
<th rowspan="2">Telephone:</th>
<td>55577854</td>
</tr>
<tr>
<td>55577855</td>
</tr>
</table>

Try it Yourself »
HTML Table - Adding a Caption
To add a caption to a table, use the <caption> tag:

Example
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>

Try it Yourself »

Note: The <caption> tag must be inserted immediately after the <table> tag.

A Special Style for One Table


To define a special style for a special table, add an id attribute to the table:

Example
<table id="t01">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Now you can define a special style for this table:
table#t01 {
width: 100%;
background-color: #f1f1c1;
}

Try it Yourself »

And add more styles:


table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color: #fff;
}
table#t01 th {
color: white;
background-color: black;
}

Try it Yourself »
Computer - Software
Software is a set of programs, which is designed to perform a well-defined
function. A program is a sequence of instructions written to solve a particular
problem.

There are two types of software −

 System Software

 Application Software

System Software
The system software is a collection of programs designed to operate, control,
and extend the processing capabilities of the computer itself. System
software is generally prepared by the computer manufacturers. These
software products comprise of programs written in low-level languages,
which interact with the hardware at a very basic level. System software
serves as the interface between the hardware and the end users.

Some examples of system software are Operating System, Compilers,


Interpreter, Assemblers, etc.

Here is a list of some of the most prominent features of a system software −

 Close to the system

 Fast in speed

 Difficult to design

 Difficult to understand

 Less interactive

 Smaller in size
 Difficult to manipulate

 Generally written in low-level language

Application Software
Application software products are designed to satisfy a particular need of a
particular environment. All software applications prepared in the computer
lab can come under the category of Application software.

Application software may consist of a single program, such as Microsoft's


notepad for writing and editing a simple text. It may also consist of a
collection of programs, often called a software package, which work together
to accomplish a task, such as a spreadsheet package.

Examples of Application software are the following −

 Payroll Software

 Student Record Software

 Inventory Management Software

 Income Tax Software

 Railways Reservation Software

 Microsoft Office Suite Software

 Microsoft Word

 Microsoft Excel

 Microsoft PowerPoint

Features of application software are as follows −

 Close to the user

 Easy to design

 More interactive

 Slow in speed
 Generally written in high-level language

 Easy to understand

 Easy to manipulate and use

 Bigger in size and requires large storage space

Introduction of Operating Systems


A computer system has many resources (hardware and software), which may be require
to complete a task. The commonly required resources are input/output devices, memory,
file storage space, CPU etc. The operating system acts as a manager of the above
resources and allocates them to specific programs and users as necessary for their task.
Therefore operating system is the resource manager i.e. it can manage the resource of a
computer system internally. The resources are processor, memory, files, and I/O devices.

Two Views of Operating System

1. User's View
2. System View
User View:
The user view of the computer refers to the interface being used. Such systems are
designed for one user to monopolize its resources, to maximize the work that the user is
performing. In these cases, the operating system is designed mostly for ease of use, with
some attention paid to performance, and none paid to resource utilization.
System View:
Operating system can be viewed as a resource allocator also. A computer system
consists of many resources like - hardware and software - that must be managed
efficiently. The operating system acts as the manager of the resources, decides between
conflicting requests, controls execution of programs etc.

Operating System Management Tasks

1. Processor management which involves putting the tasks into order and pairing them
into manageable size before they go to the CPU.
2. Memory management which coordinates data to and from RAM (random-access
memory) and determines the necessity for virtual memory.
3. Device management which provides interface between connected devices.
4. Storage management which directs permanent data storage.
5. Application which allows standard communication between software and your
computer.
6. User interface which allows you to communicate with your computer.

Functions of Operating System

1. It boots the computer


2. It performs basic computer tasks e.g. managing the various peripheral devices e.g.
mouse, keyboard
3. It provides a user interface, e.g. command line, graphical user interface (GUI)
4. It handles system resources such as computer's memory and sharing of the central
processing unit(CPU) time by various applications or peripheral devices.
5. It provides file management which refers to the way that the operating system
manipulates, stores, retrieves and saves data.
6. Error Handling is done by the operating system. It takes preventive measures
whenever required to avoid errors.

Types of Operating Systems


Following are some of the most widely used types of Operating system.

1. Simple Batch System


2. Multiprogramming Batch System
3. Multiprocessor System
4. Distributed Operating System
5. Realtime Operating System

SIMPLE BATCH SYSTEMS

 In this type of system, there is no direct interaction between user and the computer.
 The user has to submit a job (written on cards or tape) to a computer operator.
 Then computer operator places a batch of several jobs on an input device.
 Jobs are batched together by type of languages and requirement.
 Then a special program, the monitor, manages the execution of each program in the
batch.
 The monitor is always in the main memory and available for execution.

Following are some disadvantages of this type of system:

1. Zero interaction between user and computer.


2. No mechanism to prioritize processes.
MULTIPROGRAMMING BATCH SYSTEMS

 In this the operating system, picks and begins to execute one job from memory.
 Once this job needs an I/O operation operating system switches to another job (CPU
and OS always busy).
 Jobs in the memory are always less than the number of jobs on disk(Job Pool).
 If several jobs are ready to run at the same time, then system chooses which one to
run (CPU Scheduling).
 In Non-multiprogrammed system, there are moments when CPU sits idle and does
not do any work.
 In Multiprogramming system, CPU will never be idle and keeps on processing.

Time-Sharing Systems are very similar to Multiprogramming batch systems. In fact time
sharing systems are an extension of multiprogramming systems.
In time sharing systems the prime focus is on minimizing the response time, while in
multiprogramming the prime focus is to maximize the CPU usage.

MULTIPROCESSOR SYSTEMS
A multiprocessor system consists of several processors that share a common physical
memory. Multiprocessor system provides higher computing power and speed. In
multiprocessor system all processors operate under single operating system. Multiplicity
of the processors and how they do act together are transparent to the others.
Following are some advantages of this type of system.

1. Enhanced performance
2. Execution of several tasks by different processors concurrently, increases the
system's throughput without speeding up the execution of a single task.
3. If possible, system divides task into many subtasks and then these subtasks can be
executed in parallel in different processors. Thereby speeding up the execution of
single tasks.
DISTRIBUTED OPERATING SYSTEMS
The motivation behind developing distributed operating systems is the availability of
powerful and inexpensive microprocessors and advances in communication technology.
These advancements in technology have made it possible to design and develop
distributed systems comprising of many computers that are inter connected by
communication networks. The main benefit of distributed systems is its low
price/performance ratio.
Following are some advantages of this type of system.

1. As there are multiple systems involved, user at one site can utilize the resources of
systems at other sites for resource-intensive tasks.
2. Fast processing.
3. Less load on the Host Machine.

REAL-TIME OPERATING SYSTEM


It is defined as an operating system known to give maximum time for each of the critical
operations that it performs, like OS calls and interrupt handling.
The Real-Time Operating system which guarantees the maximum time for critical
operations and complete them on time are referred to as Hard Real-Time Operating
Systems.
While the real-time operating systems that can only guarantee a maximum of the time,
i.e. the critical task will get priority over other tasks, but no assurity of completeing it in a
defined time. These systems are referred to as Soft Real-Time Operating Systems.
COMPUTER TRANSLATOR
A program written in high-level language is called as source code. To convert the
source code into machine code, translators are needed.
A translator takes a program written in source language as input and converts it into a
program in target language as output.
It also detects and reports the error during translation.
Roles of translator are:
• Translating the high-level language program input into an equivalent machine
language program.
• Providing diagnostic messages wherever the programmer violates specification of
the high-level language program.

Different type of translators


The different types of translator are as follows:
Compiler
Compiler is a translator which is used to convert programs in high-level language to
low-level language. It translates the entire program and also reports the errors in
source program encountered during the translation.

Interpreter
Interpreter is a translator which is used to convert programs in high-level language to
low-level language. Interpreter translates line by line and reports the error once it
encountered during the translation process.
It directly executes the operations specified in the source program when the input is
given by the user.
It gives better error diagnostics than a compiler.
Differences between compiler and interpreter

SI. Compiler Interpreter


No

1 Performs the translation of a Performs statement by statement


program as a whole. translation.

2 Execution is faster. Execution is slower.

3 Requires more memory as linking is Memory usage is efficient as no


needed for the generated intermediate object code is
intermediate object code. generated.

4 Debugging is hard as the error It stops translation when the first


messages are generated after error is met. Hence, debugging is
scanning the entire program only. easy.

5 Programming languages like C, C++ Programming languages like


uses compilers. Python, BASIC, and Ruby uses
interpreters.

Assembler
Assembler is a translator which is used to translate the assembly language code into
machine language code.

Programming Language
Definition of language
A language is defined as the medium of expression of thoughts. All the human beings in this world
communicate with each other by a language. Similarly, computer also needs some expression
medium to communicate with others
A computer follows the instructions given by the programmer to perform a specific job. To perform a
particular task, programmer prepares a sequence of instructions, know as programmed. A program
written for a computer is known as Software. The programmed is stored in RAM .The CPU takes one
instruction of the programmed at a time from RAM and executes it. The instructions are executed
one by one in sequence and finally produce the desired result.
The Journey of computer software machine language to high level languages to modern 4GL / 5GL
languages is an interesting one. Let us talk about the same in detail.
1)FIRST GENERATION LANGUAGES 1GLs (Machine language)
When the human being stared programming the computer the instruction were given to it in a
language that it could easily understand. And that language was machine language. The binary
language a language, a language of Is and Os is known as Machine language. Any instruction in this
language is given in the form of string of 1s and 0s. Where the symbol I stand for the presence of
electrical pulse and 0 stands for the absence of electric pulse. A set of 1s and 0s as 11101101 has a
specific meaning to a computer even through it appears as binary number to us.
The writing of programmer in machine language is very cumbersome and complicated and this was
accomplished by expert only. All the instruction and imp data are to fed to the computer in numeric
form that is binary form.

2)SECOND GENERATION LANGAUAGES 2GLs (Assembly Language)


Lots of efforts are made during last 50 years to obviate the difficulties faced for using the machine
language. The first language similar to English was developed in 1950 which was known as
Assembly Language or Symbolic Programming Languages. After 1960, the High Level Languages
were developed which bought the common man very to the computer. And this was the main reason
for tremendous growth in computer industry. The high level languages are also known as Procedure
Oriented Languages.
3)THIRD GENERATION LANGUAGES (3GLs ) (High Level Languages)
The assembly language was easier to use compared with machine la language as it relieved the
programmer from a burden of remembering the operation – codes and addresses of memory
location. Even though the assembly languages proved to be great help to the programmer, a search
was continued for still better languages nearer to the conventional English language. The languages
developed which were nearer to the English language, for the use of writing the programmer in 1960
were known as High Level languages. The different high level languages which can be used by the
common user are FORTRAN, COBOL, BASIC, PASCAL, PL-1 and many others. Each high level
language was developed to fulfill some basic requirements for particular type of problems. But
further developments are made in each language to widen its utility for different purposes.

4)FOURTH GENERATION LANGUAGES (4GLs)


The 3GLs are procedural in nature i.e., HOW of the problem get coded i.e., the procedures require
the knowledge of how the problem will be solved. Contrary to them, 4GLs are non procedural. That
is only WHAT of the problem is coded i.e., only ‘What is required’ is to be specified and rest gets
done on its own. Thus a big program of a 3GLs may get replaced by a single statement of a 4GLs.
The main aim of 4GLs is to be cut down on developed and maintenance time and making it easier
for users.
GUI BASED LANGAUAGES
With the invention and popularity of GUI based interfaces. GUI based languages are as follows:
1) Visual basic
2) Visual C++
3) C# (Pronounced as C sharp)
4) Visual basic.NET
5) Visual basic 2005

COMPUTER VIRUS AND CLEANER


A Computer Virus is a malicious software program “Malware” that can infect a
computer by modifying or deleting data files, boot sector of a hard disk drive or
causes a software program to work in an unexpected manner”.

A computer virus resides on a host computer and can replicate itself when
executed. Virus can steal user data, delete or modify files & documents, records
keystrokes & web sessions of a user. It can also steal or damage hard disk space,
it can slowdown CPU processing.

Definition of Computer Virus


“A computer virus is a program that may disturb the normal working of a
computer system”. Virus attaches itself to files stored on floppy disks, USBs, email
attachments and hard disks. A file containing a virus is called infected file. If this
file is copied to a computer, virus is also copied to the computer.

Activation of Virus
When the computer virus starts working, it is called the activation of virus. A virus
normally runs all the time in the computer. Different viruses are activated in
different ways. Many viruses are activated on a certain data. For example, a
popular virus“Friday, the 13th” is activated only if the date is 13 and the day is
Friday.

According to Wikipedia “Computer viruses cause billions of dollars’ worth


of economic damage each year, due to causing systems failure, wasting
computer resources, corrupting data, increasing maintenance costs,
etc”.

Damages caused by virus


Computer virus cannot damage computer hardware. IT may cause many damages
to a computer system. A virus can:

1. A computer virus can damage data or software on the computer.

2. It can delete some or all files on the computer system.


3. It can destroy all the data by formatting hard drive.

4. It may display a political or false message very few times.

Causes of Computer Virus


The following are the main causes of a Computer Virus.

Infected Flash Drives or Disks


Flash drives and disks are the main cause of spreading viruses. Flash drives and
disks are used to transfer data from one computer to other. A virus can also be
copied from one computer to other when the user copies infected files using flash
drives and disks.

Email Attachments
Most of the viruses spread through emails. Email attachment is a file that is sent
along with an email. An email may contain an infected file attachment. Virus can
spread if the users opens and downloads an email attachment. It may harm the
computer when it isactivated. It may destroy files on the hard disk or may send
the virus automatically to all email addresses saved in the address book.

Infected / Pornography websites


Thousands of insecure websites can infect computer with viruses. Most of the
websites with pornographic materials are infected, so by visiting these websites
the user’s computer also gets infected by virus. These websites are developed to
spread viruses or other unethical material. The virus is transferred to the user’s
computer when this material is downloaded. These websites may access the
computer automatically when the users visit them.

Networks
Virus can spread if an infected computer is connected to a network. The internet
is an example of such network. When a user downloads a file infected with virus
from the internet, the virus is copied to the computer. It may infect the files
stored on the computer.
Pirated Software
An illegal copy of software is called pirated software. Virus can spread if user
installs pirated software that contains a virus. A variety of pirated software is
available in CDs and from the internet. Some companies intentionally add virus
in the software. The virus is automatically activated if the user uses the software
without purchasing license.

Types of Computer Virus


The following are some well-known viruses.
Virus Type What It Does How Affects Our PC
Infects Destroys or alters
executables (other programs and data.
Program or programs, with
File Virus affixes such as
EXE, BIN, COM,
SYS)
Boot sector Infects boot Destroys or alters
Virus sectors on hard programs and data.
and floppy disks
Multipartite A hybrid of a Destroys or alters
Virus program and boot programs and data.
sector virus
Macro Virus Triggers on a Commonly affects
command Word & Excel
in Microsoft
Office
Stealth Uses various Destroys or alters
Virus tactics to avoid programs and data.
detection.
Uses encryption Destroys or alters
to foil detection, programs and data.
Polymorphic so that it appears
Virus differently in each
infection.

Protection from Computer Virus


Virus infects computer system if latest and updated version of an Antivirus program is
not installed. Latest Antivirus software should be installed on Computer to protect it
from viruses. A computer system can be protected from virus by following these
precautions.

1. The latest and updated version of Anti-Virus and firewall should be installed on
the computer.

2. The Anti-Virus software must be upgraded regularly.

3. USB drives should be scanned for viruses, and should not be used on infected
computers.

4. Junk or unknown emails should not be opened and must be deleted straightaway.

5. Unauthorized or pirated software should not be installed on the computer.

6. An important way of protection against virus is the use of back up of data. The
backup is used if the virus deletes data or modifies it. So back-up your data on
regular basis. There are some great softwares that can back up your data
automatically.

7. Freeware and shareware software from the internet normally contain viruses. It is
important to check the software before using them.

8. Your best protection is your common sense. Never click on suspicious links, never
download songs, videos or files from suspicious websites. Never share your
personal data with people you don’t know over the internet.

Encryption and decryption

Data that can be read and understood without any special measures is
called plaintext or cleartext. The method of disguising plaintext in such a way as to hide
its substance is called encryption. Encrypting plaintext results in unreadable gibberish
called ciphertext. You use encryption to ensure that information is hidden from anyone
for whom it is not intended, even those who can see the encrypted data. The process of
reverting ciphertext to its original plaintext is called decryption.
Figure 1-1 illustrates this process.
Multimedia

Multimedia is more than one concurrent presentation medium (for example, on CD-
ROM or a Web site). Although still images are a different medium than text, multimedia
is typically used to mean the combination of text, sound, and/or motion video. Some
people might say that the addition of animated images (for example, animated GIF on
the Web) produces multimedia, but it has typically meant one of the following:

 Text and sound

 Text, sound, and still or animated graphic images

 Text, sound, and video images

 Video and sound

 Multiple display areas, images, or presentations presented concurrently

 In live situations, the use of a speaker or actors and "props" together with sound,
images, and motion video

Multimedia can arguably be distinguished from traditional motion pictures or movies


both by the scale of the production (multimedia is usually smaller and less expensive)
and by the possibility of audience interactivity or involvement (in which case, it is usually
called interactive multimedia). Interactive elements can include: voice command, mouse
manipulation, text entry, touch screen, video capture of the user, or live participation (in
live presentations).

You might also like