Boolean Logic and Number Systems Explained
Boolean Logic and Number Systems Explained
Developed by George Boole (1815-1864), and is used to refine the determination of system status
or to set or clear specific bits. Boolean logic is a way of comparing individual bits.
The operators used most often are AND, OR and NOT.
The AND operation says if and only if all inputs are on, the output will be on. The output will be
off if any of the inputs are off.
The OR operation says if any input is on, the output will be on. It's easy to see all of the
combinations by using what are called truth tables, illustrated below. At the bottom of each table
is shown the schematic symbol found in circuit diagrams.
NOT (inverter)
Input = 1 Output = 0
Input = 0 Output = 1
DATA REPRESENTATION
Program instruction and data are made up of a combination of three types of characters.
Alphabetic (A - Z), Numeric (0 - 9) and special (all other characters E.G @, #, $). The data and
program instructions are being stored character by character. Each character in storage has got its
electrical representation which uniquely identifies it.
All digital computers use some variation of binary numbering system for representation of
characters. The binary numbering system has only two digits 0 and 1. 1 denotes the presence
of electrical pulse and 0 denotes the absence of such a signal.
The computer is unable to understand the supplied data represented by these symbols. To
make communication possible between a computer and man, data must be coded in a form
understandable to the computer and the information supplied by a computer, as a result of data
processing, must be decoded in the form understandable to the user. The responsibility of
coding and decoding in a computer system lies with the input-output devices.
Number Systems
A number system is a set of symbols or numbers combined with rules for how these numbers are
used. The various number systems are:
• Decimal number system
• Binary number system
• Octal number system
• Hexadecimal number system.
Decimal System
This consists of ten digits 0 –9. Each digit has a digit value 0 to 9. Because the decimal system is
used almost universally, basic arithmetic performed by a person in one country is easily
understood
by a person in another country.
In a decimal system each digit has a positional value determined by how many places to the left
or the right of the decimal point the digit is written.
Since the positional increment is a power of 10, the value 10 is known as the base or radix of the
number.
For example
632.85 = 6 x 101 + 3 x 101 + 2 x 100 + 8 x 10-1 + 5 x 10-2
= 600 + 30 + 2 + 0.8 + 0.05
Binary System:
This is a base two number system since it uses only two digits 0 and 1 called the binary digits. Its
lowest digit is 0 and the highest digit is 1 – one less than the base of 2. Internally, the computer
uses binary number system since the two digits 1 and 0 represent the two electrical states, on
and off.
In binary number system, each of the position is a power of the base (2) and these powers begin at
0 and increases by 1 as we move left in the number.
. . . 23 22 21 20 Power
...4 3 2 1 Positional Value
...8 2 2 1 Value
That is why computer memory is incremented by powers of 2. Consider the RAM sizes 64k, 128k,
256k, 512k, 640k and so forth.
Machine language uses binary number system to provide instructions for the CPU. It is the most
basic language for the computer. It requires no translation to be understood. Binary numbers
tend to be much longer than their decimal equivalents.
Programmers, who work in assembly language and in high-level languages that enable
programmes to reach down to the machine level, find it cumbersome to work with binary
numbers. For this reason, two other systems, the octal system (base 8) and the hexadecimal
system (base 16) – are used primarily because they make it convenient to abbreviate binary
numbers.
Octal System:
It uses 8 digits from 0 – 7. Because 8 is an integral power of 2 i.e. 810 = 2310, one octal digit has a
value equivalent to that of a group of three binary digits and vice versa. This relationship
simplifies the programming of digital computers, since the octal system may be used in place of
the more cumbersome binary system.
Hexadecimal Systems
This is a base 16 number system that uses 16 symbols; the digits 0 to 9, then the letters A to F to
represent the numbers 10 to 15. The number 16 is also an integral power of 2 that is, 1610 , 2410 .
Thus, one hexadecimal digit has a value equivalent to that of a group of four binary digits and vice
versa.
a) Decimal to Binary
Suppose we want to convert the decimal number 57 to its binary equivalent. There are two
methods that we can follow.
Method 1:
Begin by writing the positional values of the columns right to left until we reach a column whose
positional value is greater than the decimal number.
Powers: 26 25 24 23 22 21 20
Positional values: 64 32 16 8 4 2 1
Next we work from the left most column to the right. We divide 32 into 57 and observe that
there is one 32 in 57 with a remainder of 25, so we write 1 in the 32 column. We divide 16 into 25
and observe that there is one 16 in 25 with a remainder of 9 and write 1 in the 16 column.
We divide 8 into 9 and observe that there is one 8 in 9 with a remainder of 1. The next two
columns each produce quotients of zero when their positional values are divided into 1 so we
write 0s in the 4 and 2 columns. Finally 1 into 1 is 1 so we write 1 in the 1 column.
This yields
Positional values: 32 16 8 4 2 1
Symbol values: 1 1 1 0 0 1
In the positional values, put a “1” whenever the sum of the given number falls and “0” elsewhere.
2 57 Remainders
2 28 1
2 14 0
2 7 0
2 3 1
2 1 1
0 1
Read the remainders from bottom to top. We thus have 5710 = 1110012
Solution
Method 1
Write 53 as a sum of powers of 2.
That is 53 = 25 + 24 + 22 + 20 = 32 + 16 + 4 + 1
Construct a table for the positional values of a binary number system. We have
.... 26 25 24 23 22 21 20
.... 64 32 16 8 4 2 1
Put a “1” under the positional values whenever the sum of the given number falls and “0”
elsewhere. Thus we put a “1” under 32, 16, 4 and 1 and “0” otherwise. We therefore
have.
25 24 23 22 21 20
32 16 8 4 2 1
30
1 1 0 1 0 1
Start reading the binary numbers from left to right. Therefore we have 5310 = 1101012
Division algorithm:- Divide the given decimal number by two and at each stage writing down the
remainder on the side.
2 53 Remainders
2 26 1
2 13 0
2 6 1
2 3 0
2 1 1
0 1
31
Read the remainder from bottom to top. Thus we have 5310 = 1101012
Solution:
Method 1:
249 Remainders
224 1
212 0
26 0
23 0
21 1
0 1
Read the remainder from bottom to top. Therefore 4910 = 1100012
Method 2
49 = 22 + 24 + 20 = 32 + 16 + 1
Thus we have.
25 24 23 22 21 20
32 16 8 4 2 1
1 1 0 0 0 1
Consider the decimal number 0.375. We also have two methods to convert this to binary.
Method I
Write the positional values
32
Powers: 2-1 2-2 2-3
Positional Values: 0.5 0.25 0.125
Write 0.375 as a sum of the power of 2. 0.375 = 0.25 + 0.125 we put 1 where the sum fall and
0 elsewhere.
Thus we have
0 1 1
33
•375
x 2
0 0.750
x 2
1 1 . 50
1. 1.0
Consider the decimal number 103. To convert it to octal number system we can use any of the
methods discussed above for binary except that we shall have the base as 8.
Method 1
Write the positional values of the columns until we reach a column whose positional value is
greater than the decimal number. We do not need that column so we discard it.
Powers 82 81 80
Positional Values 64 8 1
Next work from the left most column to the right. We divide 64 into 103 and observe that there is
one 64 in 103 with a remainder of 39, so we write 1 in the 64 column.
We divide 8 into 39 and observe that there are four 8s in 39 with a remainder of 7 and write 4 in
the 8 column. Finally we divide 1 into 7 and observe that there are seven 1s in 7 with no
remainder so we write 7 in the 1 column. This yields
Positional Values: 64 8 1
34
Symbol Values: 1 4 7
8 6954 Remainders
8 869 2
8 108 5
8 13 4
8 3 5
8 1 1
Read the remainder from bottom to top. Thus 695410 = 154528.
Fractional Parts
35
Convert 0.58910 to an octal number.
Solution:
We shall use the multiplication algorithm
0 . 589
x 8
4 4 . 712
x 8
5 5. 696
x 8
5 5 . 568
x 8
4 4 . 544
Example 1
Convert the decimal number 375 to hexadecimal.
36
Solution:
Write the positional values of the columns until we reach a column whose positional value is
greater than the decimal number. We do not need that column so we discard it. Thus, we
first write.
We discard the column with the positional value 4096. Next we work from the left most column
to the right. We divide 256 into 375 and observes that there is one 256 in 375 with a remainder
of 119, so we write 1 in the 256 column.
We divide 16 into 119 and observe that there are seven 165 in 119 with a remainder of 7 and
write 7 in the 16 column.
Finally, we divide 1 into 7 and observe that there are seven 1s in 7 with no remainder so we write
7 in the 1 column. This yields:
37
Positional Values: 256 16 1
Symbol Values: 1 7 7
Example 2:
Solution
We shall use the division algorithm.
16 4823 Remainders
16 301 7
16 18 13 = D
16 1 2
16 0 1
Exercises:
1) Convert each of the following decimal numbers to their binary equivalent.
i) 0.587
ii) 0.987
iii) 0.642
iv) 0.2017
v) 0.9716
38
Answer
(i) 0.45448 (ii) 0.77138 (iii) 0.51068 (iv) 0.14728 (v) 0.76148.
Because we are accustomed to working in decimal, it is often convenient to convert a binary, octal,
or hexadecimal number to decimal to get a sense of what the number is “really worth”. To convert
39
a number to decimal from another base, multiply the decimal equivalent of each digit by
its positional value, and sum these products.
Examples:
Solution
110101 2 = (1 x 25) + (1 x 24) + (0 x 23) + (1 x 22 ) + (0 x 21) x (1 x 100)
= 32 + 16 + 0 + 4 + 0 + 1
= 5310
base10 Solution
1100012 =(1 x 25) + (1 x 24) + (0 x 23) + (0 x 22) + (0 x 21) +(1 x 20)
= 32 + 16 + 0 + 0 + 0 + 1
= 4910
Other examples
Binary Decimal
0 0
1 1
10 2
11 3
100 4
101 5
Examples:
Solution:
40
617328 = (6 x 84) + (1 x 83) + (7 x 82) + (3 x 81) + (2 x 80).
=25,56210
41
= (7 x 512) + (6 x 64) + 8 + 4
= 358 4 + 384 + 8 + 4
= 398010
To do this, simply ignore the negative power and treat the number as a whole number. Convert
the octal fraction to a decimal fraction using the same procedure as before. Once the number is
converted, divide it by the conversion factor. The conversion factor is equal to the positive power
of the radix at whose position the fractional least significant digit (LSP), appears.
Steps
Disregard the decimal point in 0.4554 and write the octal number as if it were a whole number
Divide the product obtained above by the conversion factor you obtained earlier
2412 = 0.58888
4096
Examples
42
(i) Convert the hexadecimal AD3B to decimal
Solution
AD3B = (A x 163) + (D x 162) + (3 x 161) + (B x 160)
= (10 x 4096) + B x 256) + (3 x 16) + (11 x 1)
= 40960 + 3328 + 48 + 11
= 4434710
Solution
C14A16 = (12 x 163) + (1 x 1 62) + (4 x 161) + (10 x 160)
= (12 x 4096) + 256 + (4 x 16) + 10
= 4948210.
43
3. Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers
Examples
Solution
4 7 3 2
100 111 011 010
Solution
Simply write 6, 5 and 3 in their three digit binary equivalent.
6 5 3
110 101 011
Solution:
A 1 4 6 B
1010 0001 1100 0110 1011
44
Thus A 1 4 6 B16 = 1010 0001100011010112
Solution
FAD516 = 1111010110101012
3 C 8 . 9 6
45
4) Converting from Binary to Octal and Hexadecimal
The main use for octal and hexadecimal numbers in computing is for abbreviating
lengthy binary representation.
Examples:
Solution:
111 101 001 011
7 5 1 3
Solution:
Group the binary digits 3 at a time starting from the most significant digit (MSD)
to the right.
46
Examples:
Solution:
1111 0100 1011
F 4 B
Solution:
3 B . 6 8
47
5) Converting from octal to hexadecimal
Example:
4 7 3 2 …… Base 8
100 111 011 010 …… Base 2 in groups of 3.
1001 1101 1010 …… Base 2 in groups of 4
9 D A ……. Base 16
Solution:
A 1 4 6 B …………… Base 16
1010 0001 0100 0110 1011 …….. Base 2
010 100 001 010 001 101 011 …….. Base 2 in groups of 3
2 4 1 2 1 5 3 …….. Base 8
Exercises
Note: The answers for these exercises are given beside the question and enclosed
in square brackets.
Bits
These are the on and off pulses or each 1 or 0 that represent the data.
A byte is a collection of 8 bits or a one character of data. Each storage position in memory is called
a byte. The size of memory of a computer is measured in thousands of bytes.
49
1,024 bytes = 1 kilobyte (1K) - usually rounded off to 1000 bytes.
1 000 Kilo bytes = I Megabytes (MB)
1 000 Megabytes = 1 Gigabytes (GB)
Representing Characters
Character representation refers to the way non-numeric data, such as a letter of the alphabet or a
punctuation mark is represented by a series of bits. Character representation code, simply
referred to as code is a series of bits that represents a letter, symbol or numerical.
The three character representation codes most widely used are ASCII, ANSI and EBCDIC. A
fourth code Unicode has been proposed for future world wide use.
This is an 8 -bit character representation code developed by IBM for its mainframe computers. It
does not use the same code as ASCII or ANSI for the initial 128 character.
Unicode: is a 16 -bit code that can represent 65000 different characters. It can represent
any character in every language used today.
40
Week 3 Students learning objectives
Topics
Y Computer Networks
Y System Software and Virtual Machines.
41
COMPUTER NETWORK
A computer network is a collection of computers and other devices that communicate to share
data, hardware and software.
LAN
A local area network (LAN) is a computer network covering a local area, like a home, office or
small group of buildings such as a college. LANs are distinguished from other kinds of networks by
three characteristics: (1) their size, (2) their transmission technology, and (3) their topology.
MAN
Metropolitan Area Networks or MANs are large computer networks usually spanning a campus or a
city. They typically use wireless infrastructure or optical fiber connections to link their sites.
For instance a university may have a MAN that joins together many of their campus local area
networks (LANs) around a city.
WAN
A wide area network or WAN is a computer network covering a wide geographical area, involving
a vast array of computers. The best example of a WAN is the Internet. WANs are used to connect
local area networks (LANs) together, so that users and computers in one location can
communicate with users and computers in other locations. Many WANs are built for one
particular organization and are private.
42
2. Connecting cables: -
The cables commonly used for interconnecting PCs are the twisted pair copper wires, either
Category 5 (CAT 5) or Category 6 (CAT 6) cables. Or fiber optic conections.
Instead of using cables, some wireless networks use radio or infrared signals to transmit data from
one network device to another. The NIC on a wireless network contain the transmitting device
necessary to send data to other devices on the LAN.
3. Network Servers
43
A dedicated file server is devoted only to the task of delivering programs and data files to
workstations. It does not process data or run programs for the Workstations. Instead programs
run using the memory and processor of the workstation.
Non-dedicated server (peer-to-peer capability) here a network computer performs a dual role
as both file server and workstation.
4. Print server – stores files in a print queue and sends each queued file to the network printer.
A print job is a file that has been sent to the printer.
Application server is a computer that runs application software and forwards the results of
processing to workstations as requested. It makes it possible to use the processing power of both
the server and the workstation.
5. Modem - These are devices that modulate and demodulate data. Modulation is the process
of conversion of the computer data into analog signals before being transferred over a
standard telephone line.
Demodulation refers to converting back the data to digital form. The quality of a modem is
determined by its transmission speed. It can be either internal or external.
Examples:
Network Operating Systems such as Novell Network, Banyan lines, and LANtastic are software
packages designed to control data flow.
44
Standalone Applications
Most applications designed for standalone computers can be installed on a network server, which
sends them to individual workstations as requested.
GroupWare
A workgroup is basically two or more people who work on the same project. GroupWare is
application software that support collaborative work, usually on a LAN.
Network Topologies
This refers to how devices on LAN are connected to each other.
45
Bus-topology
Here the new nodes are easily added to a bus and all nodes may directly communicate with each
other, we use the coaxial cable to connect the workstations:
PC PC PC PC
Advantages
• Easy to implement and extend
• Well suited for temporary networks (quick setup)
• Typically the cheapest topology to implement
• Failure of one station does not affect others
Disadvantages
• Difficult to administer/troubleshoot
• Limited cable length and number of stations
• A cable break can disable the entire network
• Maintenance costs may be higher in the long run
• Performance degrades as additional computers are added
Ring topology
Here every node is connected to two other nodes. Movement of data on the ring is normally in one
direction to prevent signals from interfering with each other.
PC
PC
PC
PC
46
Advantages
• Growth of the system has minimal impact on performance
• All stations have equal access
• Each node on the ring acts as a repeater, allowing ring networks to span greater distances than other
physical topologies.
• Because data travels in one direction high speeds of transmission of data are possible
Disadvantages
• Often the most expensive topology
• Failure of one computer may impact others
Star topology
Here all the messages pass through a central switch/hub. It allows any node to communicate with
every other node by sending messages to the hub.
47
HUB
PC PC PC
Advantages
• Easy to implement and extend, even in large networks
• Well suited for temporary networks (quick setup)
• The failure of a non central node will not have major effects on the functionality of the network.
Disadvantages
• Limited cable length and number of stations
• Maintenance costs may be higher in the long run
• Failure of the central node can disable the entire network.
Network Protocols:
A communication protocols is a set of rules that ensures the orderly and accurate transmission and
reception of data. The most widely used network communications protocol are:
IPx (Internet-work packet exchange) is the protocol used by Novell NetWare, the most popular
microcomputer network software.
48
COMPUTER VIRUSES
A computer virus is a program that has the ability to reproduce/replicate itself without the
user’s knowledge. For example, it may attach itself to the DOS program FORMAT and run every
time you format a diskette.
There are other types of software that can cause problems in a PC. However, no other software can
replicate and it is this characteristic that makes a program a virus.
Effects of Viruses:
• A virus can destroy/delete or corrupt data e.g. those on specific applications such as
all Excel files or all word files e.g. Sircam worm deletes data.
• Display irritating message, or otherwise disrupt computer operations. Most viruses stay
in your PC’s memory where they can cause problems by interfering with other software
you are trying to run.
• Disable hardware, making the computer unusable.
49
• It can perform dangerous operations like formatting the hard disk.
• It consumes the disk space, memory and wastes the processor time.
• Once you have a virus, it is very likely that you will pass it on to a colleague or a customer,
who may well lose confidence in you and your company.
Only a few viruses such as Cinderella and Frodo, are designed to infect data files. Because a virus
needs to be executed to spread, a data file can only be a carrier, it cannot deliver the payload.
If your booting disk is infected and you try to boot your computer with it then the following
message is likely to be displayed.
By this time the virus has already run and your PC may already be infected. In most cases, the
virus loads itself into memory and infects the partition sector of the hard disk. It replaces the
original partition sector with its own code. If this partition sector is infected, when the PC is
rebooted from the hard disk, the virus is loaded into memory. Any diskette subsequently
accessed is infected.
50
Companion Viruses
If you have a COM file and an EXE file of the same name, Dos always runs the COM file in
preference to the EXE file is not file extension is given. Companion viruses make use of this fact
by creating COM files with the same name as the legitimate EXE files, thus ensuring they are
executed. They then pass control to the original EXE file which runs normally.
51
• Your computer displays annoying messages such as “Gotcha! Arf Arf! “You are stoned”
• Your computer develops unusual visual or sound effects. For example, characters begin
to disappear from your screen or the sound of a flushing toilet comes for your computer’s
speakers.
• You have difficulty saving files.
• Your computer suddenly seems to work very slowly.
• Files are mysteriously missing.
• Your computer reboots unexpectedly.
• Your executable files unaccountably increases in size.
Viruses are just one type of program in a large category of software designed by hackers to disrupt
or damage the data on computers.
For example, a hacker may write a program to format hard disk drives and embeds this program
in a file called sched.exe. He then distributes the disk containing this Trojan and posts it to
computer bulletin boards where other users are likely to assume that it is a free scheduling
program, just to realize that it has deleted all the files upon execution. This Trojan horse does not
harbor a virus because it does not replicate itself.
Another popular Trojan horse looks like the login screen on a network. However, as a user logs in,
the Trojan horse collects the user’s ID and password. These are stored in a file that hackers can
access later. Armed with a valid user ID and password, the hackers can access the data stored on
the network.
52
A notorious time bomb appeared in December 1989. Many hospitals and medical clinics received
in innocent looking package containing “ADS information” software from a company called PC
Cyborg. The process of installing the software also installed a time bomb. After the computer was
booted a certain number of times, the time bomb scrambled the data on the hard disk. Next, the
bomb displayed an invoice demanding payment before the method for unscrambling the hard disk
was revealed.
A logic bomb is a computer program that is triggered by a specific set of conditions, such as the
number of files in a disk, or a certain sequence of characters being entered. It can be carried by a
virus or a Trojan horse. But it could also be a stand alone program.
53
Worms
A software worm is a program designed to enter a computer system – usually a network
through security holes. Like a virus, a worm reproduces itself. Unlike a virus, a worm does not
need to be
attached to an executables program to reproduce. These security holes may be electronic mail
system.
Spread
• Through data transfer; either through auxiliary storage devices, or from one computer to
the other through networking. It is spread when an infected program is executed or the
computer is booted from infected diskette. Through electronic communication
devices/times as attached to emails.
Control/Avoidance and Detection
• Avoid using high-risk disks programs e.g. disks containing public domain software or
shareware and on disks containing illegal copies of computer programs downloaded form
bulletin boards. You must use a virus detection program to check for viruses before you
run any programs from such disks.
• Use of virus detection program/anti-virus programs which examines the files stored
on a disk to determine if they are infected with a virus, then disinfects the disk, if
necessary.
• Backups – make regular backups of your system.
Write-protect all boot diskettes. Viruses cannot infect manually protected diskette
54