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

CSC 101 Note

Computer science

Uploaded by

faithojonimi335
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

CSC 101 Note

Computer science

Uploaded by

faithojonimi335
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

CHAPTER ONE

GENERATIONS OF COMPUTERS: FIVE GENERATIONS OF


COMPUTERS

FIRST GENERATION: VACUUM TUBES (1940-1956)


The first computer systems used vacuum tubes for circuitry and magnetic
drums for memory, and were often enormous, taking up entire rooms. These
computers were very expensive to operate and in addition to using a great deal of
electricity, the first computers generated a lot of heat, which was often the cause of
malfunctions.

First generation computers relied on machine language, the lowest-


level programming language understood by computers, to perform operations, and
they could only solve one problem at a time. It would take operators days or even
weeks to set-up a new problem. Input was based on punched cards and paper tape,
and output was displayed on printouts.

The UNIVAC and ENIAC computers are examples of first-generation computing


devices. The UNIVAC was the first commercial computer delivered to a business
client, the U.S. Census Bureau in 1951.

1
A UNIVAC computer at the Census Bureau. Image
Source: United States Census Bureau

SECOND GENERATION: TRANSISTORS (1956-1963)

The world would see transistors replace vacuum tubes in the second generation of
computers. The transistor was invented at Bell Labs in 1947 but did not see
widespread use in computers until the late 1950s.

The transistor was far superior to the vacuum tube, allowing computers to become
smaller, faster, cheaper, more energy-efficient, and more reliable than their first-
generation predecessors. Though the transistor still generated a great deal of heat
that subjected the computer to damage, it was a vast improvement over the vacuum
tube. Second-generation computers still relied on punched cards for input and
printouts for output.

2
An early Philco Transistor
(1950s). Image Source: Vintage Computer Chip Collectibles

From Binary to Assembly

Second-generation computers moved from cryptic binary machine language to


symbolic, or assembly, languages, which allowed programmers to specify
instructions in words. High-level programming languages were also being
developed at this time, such as early versions of COBOL and FORTRAN. These
were also the first computers that stored their instructions in their memory, which
moved from a magnetic drum to magnetic core technology.

The first computers of this generation were developed for the atomic energy
industry.

THIRD GENERATION: INTEGRATED CIRCUITS (1964-1971)

The development of the integrated circuit was the hallmark of the third generation
of computers. Transistors were miniaturized and placed on silicon chips,
called semiconductors, which drastically increased the speed and efficiency of
computers.

Instead of punched cards and printouts, users interacted with third generation
computers through keyboards and monitors and interfaced with an operating

3
system, which allowed the device to run many different applications at one time with
a central program that monitored the memory. Computers for the first time became
accessible to a mass audience because they were smaller and cheaper than their
predecessors.

FOURTH GENERATION: MICROPROCESSORS (1971-PRESENT)

The microprocessor ushered in the fourth generation of computers, as thousands of


integrated circuits were built onto a single silicon chip. What in the first generation
filled an entire room could now fit in the palm of the hand. The Intel 4004 chip,
developed in 1971, located all the components of the computer from the central
processing unit and memory to input/output controls on a single chip.

In 1981, IBM introduced its first computer for the home user, and in
1984 Apple introduced the Macintosh. Microprocessors also moved out of the realm
of desktop computers and into many areas of life as more and more everyday
products began to use microprocessors.

As these small computers became more powerful, they could be linked together to
form networks, which eventually led to the development of the Internet. Fourth
generation computers also saw the development of GUIs,
the mouse and handheld devices.

4
Intel’s first
microprocessor, the 4004, was conceived by Ted Hoff and Stanley Mazor. Image
Source: Intel Timeline (PDF)

FIFTH GENERATION: ARTIFICIAL INTELLIGENCE (PRESENT AND


BEYOND)

Fifth generation computing devices, based on artificial intelligence, are still in


development, though there are some applications, such as voice recognition, that are
being used today. The use of parallel processing and superconductors is helping to
make artificial intelligence a reality.

Quantum computation and molecular and nanotechnology will radically change the
face of computers in years to come. The goal of fifth-generation computing is to
develop devices that respond to natural language input and are capable of learning
and self-organization.

5
CLASSIFICATION OF COMPUTERS ACCORDING TO SIZE, TYPE AND
PURPOSE
We see many Computers nearby, but they all are different from each other. We are
going to know about the basics and classification of computers which included all
the different types of computers.
There are different classes of computer technology available these days. The
functionality and data processing of each type of computer is different and output
results as well.

However, the methods or techniques, Size, capacity, characteristics, and data


handling of the data of each computer may be different too. Let’s Get to Know the
“What are the Classifications of Computers System“:-
Classification of Computers
We can classify the computers into the following 3 categories:

Classifications of Computers System:-

1. On the Basis of Size and Capacity, [Supercomputer, Mainframe, Mini, and


Micro Computer].
2. On the Basis of Purposes, [General and Special Purpose].
3. On the Basis of Hardware Design and Type [Analog, Digital, and Hybrid
Computer].
Computers on the Basis of Size and Capacity
1. SuperComputer
A Supercomputer is the very fastest and powerful, and expensive type of computer
for processing data. Supercomputers’ size and storage capacity are also huge (can

6
occupy huge premises) designed to process vast amounts of data in a short time with
high productivity.
These are specially made to perform multi-specific tasks. Therefore, many CPUs
work in parallel order on these supercomputers. This function of a Supercomputer is
called Multiprocessing or Parallel Processing.

A supercomputer’s design is complicated, like it can be heterogeneous, combining


computers of different architectures, is significantly surpassed most existing
personal computers. This made this machine an ultra-high-
performance supercomputer.

Each part of a supercomputer is responsible for its own specific task, such as
structuring and solving the most complex problems requiring an incredible amount
of calculations.

Applications: The uses of supercomputers are dedicated to –


• In research and study of energy and nuclear weapons and designing the
aircraft, airplanes, and flight simulators.
• Climate research and Weather Forecasting and Prediction of Natural
Disasters.
• Spaceship and Satellite Launching.
• Used in scientific research laboratories.
• Used in Chemical and Biological research and for highly calculation complex
tasks.
Examples: IBM Roadburner, IBM Blue Gene, Intel ASI Red. PARAM-1000,
and CRAY-XMP-14.

7
Good to Know ~ World’s first supercomputer is the Control Data
Corporation (CDC) 6600 invented by Seymour Cray.

2. Mainframe Computer
Mainframe computers are multi-programming, high-performance computers,
and multi-user, which means they can handle the workload of more than 100 users
at a time on the computer.

The storage capacity of the mainframe is enormous, with a high-speed data process
as well. As well as handling hundreds of input and output devices at a time.

The mainframe is a highly efficient computer capable of simultaneously


solving complex calculations and continuously for a long time. These computers
have several microprocessors that have the ability to function the data at too high
performance and speed.

The mainframe is ahead of our conventional modern Personal computers in almost


every metric. The possibility of their “hot” replacement in the mainframe computer
ensures continuity of operation. And the standard amount of processor utilization
effortlessly exceeds 85% of the total power.

Somehow mainframes can be more powerful than supercomputers because the


mainframe supports many processes simultaneously. On the other hand,
supercomputers can run a single program but faster than a mainframe. In the
past, Mainframes requires entire rooms or even floors of whole buildings for set up.

8
In today, IBM company is leading the production of mainframe computers.
Mainframe reliability is increased with development in the past 60 years. These
computers can fix most of the hardware and software bugs.

Applications: Uses of Mainframe Computer –

Mainframe computers are mainly used by departmental and commercial


organizations like Banks, Companies, Scientific research centers, and governmental
departments like railways. These computers can work for 24 hours. Hundreds of
users can work on these computations simultaneously.

Using the mainframe completes the tasks, Such as keeping details of payments,
research centres, advertising, sending bills and notices, paying employees, ticket
booking, maintaining details of purchases by users, keeping detailed tax details, etc.

Examples: IBM Es000 series, ICL39 Series, and CDC 6600.

3. Mini Computer
Minicomputer is a digital and multi-user computer system with the connection of
more than one CPU. Thus, many people can work on these computers
simultaneously instead of a single person. Also, it can process with other accessories
like a printer, plotter, etc.

Minicomputers are the medium type of computers that have more functionality
power and are expensive than microcomputers. On the other hand, the size, storage,
and speed of minicomputers are large but less than the mainframe and
supercomputers.

9
Minicomputers are made for performing multiple computing tasks at a single point
of time, instead of assigning many microcomputers for a single task, which will be
time-consuming and expensive.

In general, a minicomputer is a multi-threaded system (several processes at a time)


capable of supporting from one to up to 200 users simultaneously: these computers
are currently used to store large databases, multi-user applications, and the
automation industry.

Applications: The uses of Minicomputers –

The minicomputers are used as real-time applications in Industries, bookings, and


Research Centres. Banks also use minicomputers for preparing payroll for
employees’ salaries, records, tracking of financial accounts, etc. As well as in the
field of Higher Education and Engineering.
Examples: PDP 11 and IBM (8000 Series).
Good to Know ~ PDP-1 was the world’s first minicomputer, small and interactive,
introduced in 1960 by the Digital Equipment Corporation.

4. Micro Computer
Today we are using many computers at home is also the most common
microcomputer. With this invention of the microprocessors in the year 1970, it
became possible to use computers for people personally at a low cost and reasonable
price known as Digital Personal Computer.

The design of microcomputers is minimal in size and storage capacity. These


computers consist of many parts like Input and Output devices, Software, operating

10
systems, networks, and Servers all these need to connect to form a complete Personal
Digital Computer.

There is not only a PC or laptop are examples of microcomputers. Other examples


of the microcomputer are smartphone, Tablet, PDA, server, palmtop, and
workstation.
This can be installed in any work area or even at home for personal use.

The primary purpose of microcomputers is to keep and process the everyday tasks
and needs of the people. Only one person can work on a single PC at a time, but its
operating system is multitasking. The PC can be connected to the Internet to take
benefits and enhance the user experience.
The development of multimedia, small equipment, optimized energy consumption,
and the LAN made the microcomputers increase in demand for every field.
The increase in the demand and need for microcomputers between the people leads
to the tremendous development of each part related to the microcomputers.

Applications: The uses of MicroComputer –


PC is being widely used in many fields like home, office, data collection, business,
education, entertainment, publishing, etc.
It keeps the details and prepares letters for correspondence in small businesses,
creating bills, accounting, word processing, and operation of the filing systems in a
large company. Some of the major PC manufacturers are IBM, Lenovo, Apple, HCL,
HP, etc. Examples: Desktops, tablets, smartphones, and Laptops. The fast
development of microcomputers with technology. As a result, today,
microcomputers coming in the form of a book, a phone, and even a clock in the name
of a digital clock.

11
CHAPTER TWO

COMPUTER HARDWARE AND SOFTWARE

Computer Hardware Basics

Hardware – any physical device or equipment used in or with a computer system


(anything you can see and touch).

External hardware

• External hardware devices (peripherals) – any hardware device that is located


outside the computer.

• Input device – a piece of hardware device which is used to enter information to a


computer for processing.

• Examples: keyboard, mouse, trackpad (or touchpad), touchscreen, joystick,


microphone, light pen, webcam, speech input, etc.

• Output device – a piece of hardware device that receives information from a


computer.

• Examples: monitor, printer, scanner, speaker, display screen (tablet, smartphone …),
projector, head phone, etc.

12
Internal hardware

• Internal hardware devices (or internal hardware components) – any piece of


hardware device that is located inside the computer.

• Examples: CPU, hard disk drive, ROM, RAM, etc.

Computer Software Basics

Computer software

• Software – a set of instructions or programs that tells a computer what to do or how


to perform a specific task (computer software runs on hardware).

• Main types of software – systems software and application software.

13
Application software

• Application software – a computer program that provides users with tools to


accomplish a specific task.

• Examples of application software: word processing, spreadsheets, presentation,


database management, Internet browsers, email programs, media players,
accounting, pronunciation, translation, desktop publishing, enterprise, etc.

System Software

System software – it is designed to run a computer’s hardware and application


software, and make the computer system available for use. It serves as the interface
between hardware, application software, and the user.

14
• Main functions of system software – allocating system resources, managing storage
space, storing and retrieval of files, providing security, etc.

• Main types of systems software – operating system, device driver, utility software,
programming software, etc.

Operating system (OS) – a software that controls and coordinates the computer
hardware devices and runs other software and applications on a computer. It is the
main part of system software and a computer will not function without it.

• Main functions of an operating system – booting the computer, managing system


resources (CPU, memory, storage devices, printer, etc.), managing files, handling
input and output, executing and providing services for application software, etc.

• Examples of operating system: Microsoft Windows, Apple iOS, Android OS,


macOS, Linux, etc.

Device driver – a software program that is designed to control a particular hardware


device that is attached to a computer.

• The main purpose of device driver – it acts as a translator between the hardware
device and operating systems or applications that use it.

• It instructs computer on how to communicate with the device by translating the


operating system’s instructions into a language that a device can understand in order
to perform the necessary task.

• Examples of device driver: printer driver, display driver, USB driver, sound
card driver, motherboard driver, ROM driver, etc.

15
Utility software – a type of system software that helps set up, analyze, configure,
strengthen, maintain a computer and performs a very specific task (e.g. antivirus
software, backup software, memory tester, screen saver, etc.).

USES OF COMPUTER

Computers at Home

There are many things that a computer can do at home, such as:

Manage home budget

• Personal finance software can help you create budget,


track debt, track spending and savings, reduce or eliminate expenses, plan tax, plan
for emergencies, determine short and long-term financial goals, or even just get a
better handle on your monthly household spending.

• Some personal finance software: Personal Capital, Quicken, Buxfer, Moneydance,


AceMoney Lite, Buddi, GnuCash, etc.

Work from home

16
• Some work from home jobs: data entry, web developer,
freelance writer, travel agent, call centre representative, online teaching job,
software engineer, social media manager, translator, accountant, bookkeeper, etc.

Online banking

• Online banking is a banking transaction system that


allows the bank customers to handle account management and conduct a range of
financial transactions via the Internet, rather than visiting a branch.

• Online banking allows users to make bill payments, view account details, open a
new account, money transfers, pre-authorized payments, e-transfer, apply for loans,
etc.

Entertainment

17
• Computers are used in a variety of areas for
entertainment purposes, such as videos, movies, television, music, photo editing, and
art (for example, paintings, pictures, poetry, etc., are just a click away).

Computer games

• Some intelligence games are specially developed to improve a user’s cognitive


abilities and boost thinking power and mental capability.

Computers in Education and Business

Computers in education

The uses of computers in education are plentiful, such as:

• Distance education

• Online courses, programs, and degrees

• Online training resources

• eLearning

18
• Computer aided teaching and learning. This includes research, school work, storage
of information, quick data processing, audio-visual aids in teaching, better
presentation of information (PowerPoint, Moodle, smart-boards, etc.), entering and
viewing grades online, quick communication between students and instructors, etc.

Computers in business

Computer can help a business start, run, manage, and grow. Computers can be used
in business for:

• Marketing and advertising

• Storage, archiving, and order fulfillment

• Budgeting and forecasting

• Customer relationship management

• e-commerce

• And more

Computers in healthcare

19
Computers play a crucial role in the healthcare field,
such as:

• Storing medical and patient data

• Managing appointments with doctors

• Medical imaging and equipment. This includes X-rays, CT scans, MRI scans
(Magnetic Resonance Imaging—it can produce a detailed body image), etc.

• Patient monitoring

• Computer-controlled surgeries

• Diagnostic databases (create a database of a patient records with their treatment and
medicine records)

• Medical research

• Blood testing (take blood samples and analyze the results with computer)

Computers in science/engineering

Computers play a critical role in science/engineering because today is a world of


computers.

20
• Research

• Design (prototype)

• Modelling

• Simulate experiments

• Record, organize, and analysis data

• Report/communication

21
CHAPTER THREE

NUMBER SYSTEMS

The number system or the numeral system is the system of naming or representing
numbers.

Types of Number System


There are various types of number systems in mathematics. The four most common
number system types are:

1. Decimal number system (Base- 10)


2. Binary number system (Base- 2)
3. Octal number system (Base-8)
4. Hexadecimal number system (Base- 16)

Now, let us discuss the different types of number systems with examples.

Decimal Number System (Base 10 Number System)


The decimal number system has a base 10 because it uses ten digits from 0 to 9. In
the decimal number system, the positions successive to the left of the decimal point
represent units, tens, hundreds, thousands and so on. This system is expressed
in decimal numbers. Every position shows a particular power of the base (10).
Example of Decimal Number System:
The decimal number 1457 consists of the digit 7 in the units position, 5 in the tens
place, 4 in the hundreds position, and 1 in the thousands place whose value can be
written as
(1×103) + (4×102) + (5×101) + (7×100)
(1×1000) + (4×100) + (5×10) + (7×1)
1000 + 400 + 50 + 7
1457

Binary Number System (Base 2 Number System)


The base 2 number system is also known as the Binary number system wherein,
only two binary digits exist, i.e., 0 and 1. Specifically, the usual base-2 is a radix of

22
2. The figures described under this system are known as binary numbers which are
the combination of 0 and 1. For example, 110101 is a binary number.
We can convert any system into binary and vice versa.
Example
Write (14)10 as a binary number.
Solution:

Base 2 Number System Example


∴ (14)10 = 11102

Octal Number System (Base 8 Number System)


In the octal number system, the base is 8 and it uses numbers from 0 to 7 to
represent numbers. Octal numbers are commonly used in computer applications.
Converting an octal number to decimal is the same as decimal conversion and is
explained below using an example.
Example: Convert 2158 into decimal.
Solution:
2158 = 2 × 82 + 1 × 81 + 5 × 80
= 2 × 64 + 1 × 8 + 5 × 1
= 128 + 8 + 5
= 14110
23
Hexadecimal Number System (Base 16 Number System)
In the hexadecimal system, numbers are written or represented with base 16. In the
hex system, the numbers are first represented just like in decimal system, i.e. from
0 to 9. Then, the numbers are represented using the alphabets from A to F. The
below-given table shows the representation of numbers in the hexadecimal number
system.

Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Number System Chart


In the number system chart, the base values and the digits of different number
system can be found. Below is the chart of the numeral system.

Number System Chart

24
Number System Conversion
Numbers can be represented in any of the number system categories like binary,
decimal, hex, etc. Also, any number which is represented in any of the number
system types can be easily converted to
The number 349 in the binary number system is 101011101
The number 349 in the decimal number system is 349.
The number 349 in the octal number system is 535.
The number 349 in the hexadecimal number system is 15D

Number System Examples


Example 1:
Convert (1056)16 to octal number.
Solution:
Given, 105616 is an hex number.
First we need to convert the given hexadecimal number into decimal number
(1056)16
= 1 x 163 + 0 x 162 + 5 x 161 + 6 x 160
= 4096 + 0 + 80 + 6
= (4182)10
Now we will convert this decimal number to the required octal number by
repetitively dividing by 8.

8 4182 Remainder

8 522 6

8 65 2

8 8 1

25
8 1 0

0 1

Therefore, taking the value of remainder from bottom to top, we get;


(4182)10 = (10126)8
Therefore,
(1056)16 = (10126)8

Example 2:
Convert (1001001100)2 to decimal number.
Solution:
(1001001100)2
= 1 x 29 + 0 x 28 + 0 x 27 + 1 x 26 + 0 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 0 x
20
= 512 + 64 + 8 + 4
= (588)10

Example 3:
Convert 101012 into an octal number.
Solution:
Given,
101012 is the binary number
We can write the given binary number as:
010 101
Now as we know, in octal number system,
010 → 2
101 → 5

26
Therefore, the required octal number is 258

Example 4:
Convert hexadecimal 2C to decimal number.
Solution:
We need to convert 2C16 into binary numbers first.
2C → 0010 1100
Now convert 001011002 into a decimal number.
101100 = 1×25+1×23+1×22
=32+8+4
=44

Conversion of binary fractional part to decimal

Let's take an example for n = 110.101

Step 1: Conversion of 110 to decimal


=> 1102 = (1*22) + (1*21) + (0*20)
=> 1102 = 4 + 2 + 0
=> 1102 = 6
So equivalent decimal of binary integral is 6.

Step 2: Conversion of .101 to decimal


=> 0.1012 = (1*1/2) + (0*1/22) + (1*1/23)
=> 0.1012 = 1*0.5 + 0*0.25 + 1*0.125
=> 0.1012 = 0.625
So equivalent decimal of binary fractional is 0.625

Step 3: Add result of step 1 and 2.


=> 6 + 0.625 = 6.625

27
BINARY OPERATIONS

Rules of Binary Addition


Binary addition is much easier than the decimal addition when you
remember the following tricks or rules. Using these rules, any binary
number can be easily added. The four rules of binary addition are:

• 0+0=0
• 0+1=1
• 1+0=1
• 1 + 1 =10

Example 1: 10001 + 11101


Solution:
1
10001
(+) 1 1 1 0 1
———————–
101110

Example 2: 10111 + 110001


Solution:
111
10111
(+) 1 1 0 0 0 1

———————–
1001000

28
Binary Subtraction

Binary Subtraction Rules


Rules and tricks: Binary subtraction is much easier than the decimal
subtraction when you remember the following rules:

• 0–0=0
• 0 – 1 = 1 ( with a borrow of 1)
• 1–0=1
• 1–1=0

Consider other examples of binary subtractions are as follows:


Example 1: 0011010 – 001100
Solution:
1 1 Borrow
0011010
(-) 0 0 1 1 0 0
——————
0001110
Decimal Equivalent :
0 0 1 1 0 1 0 = 26
0 0 1 1 0 0 = 12
Therefore, 26 – 12 = 14
The binary resultant 0 0 0 1 1 1 0 is equivalent to the 14

Example 2: 0100010 – 0001010


Solution:
1 1 Borrow

29
0 1 0 0 0 1 0 = 3410
(-) 0 0 0 1 0 1 0 = 1010
——————
0 0 1 1 0 0 0 = 2410

Binary Division

Binary Division Rules


The binary division is much easier than the decimal division when you
remember the following division rules. The main rules of the binary
division include:

• 1÷1 = 1
• 1÷0 = Meaningless

• 0÷1 = 0

• 0÷0 = Meaningless

Similar to the decimal number system, the binary division is similar,


which follows the four-step process:

• Divide
• Multiply

• Subtract

• Bring down

Important Note: Binary division follows the long division method to


find the resultant in an easy way.

Binary Division Examples


Example 1.

30
Question: Solve 01111100 ÷ 0010
Solution:
Given
01111100 ÷ 0010
Here the dividend is 01111100, and the divisor is 0010
Remove the zero’s in the Most Significant Bit in both the dividend and
divisor, that doesn’t change the value of the number.
So the dividend becomes 1111100, and the divisor becomes 10.
Now, use the long division method.

• Step 1: First, look at the first two numbers in the dividend and
compare with the divisor. Add the number 1 in the quotient place.
Then subtract the value, you get 1 as remainder.

• Step 2: Then bring down the next number from the dividend
portion and do the step 1 process again
• Step 3: Repeat the process until the remainder becomes zero by
comparing the dividend and the divisor value.
31
• Step 4: Now, in this case, after you get the remainder value as 0,
you have zero left in the dividend portion, so bring that zero to the
quotient portion.
Therefore, the resultant value is quotient value which is equal to 111110
So, 01111100 ÷ 0010 = 111110
Example 2: Solve using the long division method: 101101 ÷ 101
Solution:

Binary Multiplication

Binary Multiplication Rules

Binary multiplication, like other binary operations, is much easier,


unlike the decimal multiplication when you remember the following
multiplication rules. The rules of binary multiplication are:

• 0×0=0
• 0×1=0
• 1×0=0
• 1 × 1 = 1 [No borrow or carry method is applicable here]

Examples of Binary Multiplication

32
Some binary multiplication examples are given below for a better
understanding of this concept.
Example 1: Solve 1010 × 101
Solution:
1010 × 101
1010
(×) 101
—————–
1010
0000
——————
01010 ……. First Intermediate Sum
1010
——————–
110010
Comparison with Decimal values:
10102 = 1010
10102 = 510
10 x 5 = 5010
(110010)2 = 5010

Another example of binary multiplication with a decimal point is as


follows:

Question: 1011.01 × 110.1

33
Solution:

One’s and Two’s Complement

1’s complement of a binary number is another binary number obtained


by toggling all bits in it, i.e., transforming the 0 bit to 1 and the 1 bit to
0.

Examples:
1's complement of "0111" is "1000"
1's complement of "1100" is "0011"

2’s complement of a binary number is 1, added to the 1’s complement


of the binary number.

Examples:
2's complement of "0111" is 1000 + 1 to give "1001"
2's complement of "1100" is 0011+1 to give "0100"

34
CHAPTER FOUR

FLOWCHART AND ALGORITHM

The algorithm and flowchart are two types of tools to explain the process of a
program. In this page, we discuss the differences between an algorithm and a
flowchart and how to create a flowchart to illustrate the algorithm visually.

Algorithms and flowcharts are two different tools that are helpful for creating new
programs, especially in computer programming.

An algorithm is a step-by-step analysis of the process, while a flowchart explains


the steps of a program in a graphical way.

Part 1: Definition of Algorithm

Writing a logical step-by-step method to solve the problem is called the algorithm.
In other words, an algorithm is a procedure for solving problems. In order to solve
a mathematical or computer problem, this is the first step in the process.

An algorithm includes calculations, reasoning, and data processing. Algorithms


can be presented by natural languages, pseudocode, and flowcharts, etc.

Part 2: Definition of Flowchart

A flowchart is the graphical or pictorial representation of an algorithm with the


help of different symbols, shapes, and arrows to demonstrate a process or a
program. With algorithms, we can easily understand a program. The main purpose
of using a flowchart is to analyze different methods. Several standard symbols are
applied in a flowchart:

Terminal Box - Start / End

Input / Output

35
Process / Instruction

Decision

Connector / Arrow

The symbols above represent different parts of a flowchart. The process in a


flowchart can be expressed through boxes and arrows with different sizes and
colors. In a flowchart, we can easily highlight certain elements and the
relationships between each part.

Part 3: Difference between Algorithm and Flowchart


If you compare a flowchart to a movie, then an algorithm is the story of that movie.
In other words, an algorithm is the core of a flowchart. Actually, in the field of
computer programming, there are many differences between algorithm and
flowchart regarding various aspects, such as the accuracy, the way they display,
and the way people feel about them. Below is a table illustrating the differences
between them in detail.

Algorithm Flowchart
It is a procedure for solving
It is a graphic representation of a process.
problems.
The process is shown in step-by- The process is shown in block-by-block
step instruction. information diagram.
It is complex and difficult to
It is intuitive and easy to understand.
understand.
It is convenient to debug errors. It is hard to debug errors.
The solution is showcased in natural
The solution is showcased in pictorial format.
language.

36
It is somewhat easier to solve
It is hard to solve complex problem.
complex problem.
It costs more time to create an
It costs less time to create a flowchart.
algorithm.

Part 4: Use Flowcharts to Represent Algorithms

Algorithms are mainly used for mathematical and computer programs, whilst
flowcharts can be used to describe all sorts of processes: business, educational,
personal, and algorithms. So flowcharts are often used as a program planning tool
to organize the program's step-by-step process visually. Here are some examples:

Example 1: Print 1 to 20:

Algorithm:

• Step 1: Initialize X as 0,
• Step 2: Increment X by 1,
• Step 3: Print X,
• Step 4: If X is less than 20 then go back to step 2.

Flowchart:

37
Example 2: Convert Temperature from Fahrenheit (℉) to Celsius (℃)

Algorithm:

• Step 1: Read temperature in Fahrenheit,


• Step 2: Calculate temperature with formula C=5/9*(F-32),
• Step 3: Print C.

Flowchart:

Example 3: Determine Whether A Student Passed the Exam or Not:


Algorithm:

• Step 1: Input grades of 4 courses M1, M2, M3 and M4,


• Step 2: Calculate the average grade with formula
"Grade=(M1+M2+M3+M4)/4"
• Step 3: If the average grade is less than 60, print "FAIL", else print "PASS".

• Average grade is less than 60, print "FAIL", else print "PASS".

Flowchart:

38
NOTE: The decision symbol has three possible values which are Yes, No and
Neutral. This depends on the algorithm

39
CHAPTER FIVE

VB.NET

Images Control Name Description

Pointer Used to move and resize controls and forms.

Button This Control triggers an action when accessed.

Check Box Control that has values either true or false

CheckedList Box Lists check box next to each item

A combination of list and text box controls that enables to select


Combo Box
as well as edit text.

DateTimePicker Display a calender picker to choose the day and date.

Label Displays a label text.

LinkLabel Displays a label with a link text.

List Box Control that lists number of items.

List View Extension of ListBox control with options to add icons,headings.

Masked Text Box Uses a Mask to differetiate proper and improper text input.

MonthCalendar Enable to select date at runtime

Notify Icon Displays an icon in the Windows Tray

Allows to input a integer of specific decimal places within a


NumericUpDown
specific range.

Picture Box Display image files

Progress Bar Display the progress of a task.

Radio Button Allows to choose a choice from a group of choices.

Rich TextBox Allows to edit, input rich text.

Text Box Control used to input or display text.

ToolTip Displays tooltip text.

TreeView Displays the hierarchy of nodes.

WebBrowser Allows to open an html document in form.

40
Useful links in working with VB.Net

Visual Basic 2010 Lesson 1- Introduction – Visual Basic Tutorial (vbtutor.net)

Follow the steps in the above to attempt the exercises in CSC101 practical manual.

41

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy