Mathematics Sample Notes
Mathematics Sample Notes
&
PAST PAPERS
CERTIFICATE IN IT
MATHEMATICS
1920-104
[email protected]
www.kenyanexams.com
Table of Contents
2
3.10 Exercises .................................................................................................. 3-6
3.11 Past Years Questions................................................................................ 3-9
3
CHAPTER 8: DATA STRUCTURES (II) .................................... 8-1
8.1 Introduction .............................................................................................. 8-2
8.2 Tree .......................................................................................................... 8-2
8.3 Tables ....................................................................................................... 8-4
8.4 Binary Trees ............................................................................................. 8-5
8.5 Traversing of Binary Trees ...................................................................... 8-6
8.6 Binary Search Tree .................................................................................. 8-7
8.7 Searching and Inserting in Binary Search Trees ...................................... 8-8
8.8 Past Years Questions.............................................................................. 8-10
4
Chapter 1 : Number Bases
Chapter Objectives
1.1 Introduction
In this chapter, we start to explore various sets of numbers which are used to
represent data in real life problems. Namely, natural numbers, integers, rational,
irrational, real and complex numbers. Numbers are used to represent quantities,
measurement, and others in our surroundings. They are essential representations
of data that will be processed by computer systems to produce useful information.
The computer system, being a digital electronic device, has to handle data in
binary numbers.
In binary numbers, each binary digit has only two states rather than ten states in
decimal numbers. Therefore, binary, octal and hexadecimal number systems are
dealt with in subsequent parts of the chapter.
5
Real Can be represented by points a the straight
R
line Example: -2.31, 5 , 6
6
1.2.1 Single Precision
The computer will need longer processing time to produce double precision
numbers. The real number is calculated to 16 and displayed on the screen to 15
significant figures.
Column No 6 5 4 3 2 1
100,00
Value 10,000 1,000 100 10 1
0
Power of
105 104 103 102 101 100
Magnification
Numerals 4 2 3 5 2 4
7
1.5 Conversion from Other Bases to Denary
We can use this column system to convert a number in other bases to its
equivalence in Denary.
Column No 6 5 4 3 2 1
Value 32 16 8 4 2 1
Power of
25 24 23 22 21 20
Magnification
Numerals 1 1 1 0 0 1
1110012 = 1 x 25 + 1 x 2 4 + 1 x 2 3 + 1 x 2 0
= 32 + 16 + 8 + 1
= 5710
Column No 6 5 4 3 2 1
104857 6553
Value 4096 256 16 1
6 6
Power of
165 164 163 162 161 160
Magnification
Numerals 4 B E E F 8
8 475
8 59 remainder
3
8 7 remainder
8
3
0 remainder
7
The octal number is obtained by reading the last integer 7 and upwards to include
all remainders; 47510 = 7338
2 475 remainder
1
2 237 remainder
1
2 118 remainder
0
2 59 remainder
1
2 29 remainder
1
2 14 remainder
0
2 7 remainder
1
2 3 remainder
1
2 1 remainder
1
0
47510 = 1110110112
We know that 910 = 10012 and 910 = 118 so, we can conclude that 10012 = 118. To
convert a binary number to an octal number in this case will involve a lot of
calculations.
Binary Octal
000 0
9
001 1
010 2
011 3
100 4
101 5
110 6
111 7
We need three binary bits to represent symbols in octal! Likewise, one octal
number will produce three binary bits.
Following the same argument, it is not so difficult to see why we need to have
four binary bits to represent one hexadecimal number.
Since every octal number will produce three binary bits, and every four binary
bits will produce one hexadecimal number. We can make use of the binary base
as the “conversion medium” to convert a hexadecimal number to an octal number
or vice versa.
10
multiply 0.75 by 2 continuously until the fraction becomes zero or the degree of
accuracy is satisfied.
2 4 0
2 2 0 0.75 * 2
1 1 1.5 * 2
1.0
0.11
2 6 0
2 3 1
1 1 0.1 * 2
0.2 * 2
0.4 * 2
0.8 * 2
1.6 * 2
1.2 * 2
0.4
0 . 0 0 0 1 1 0
On the other hand, how can we convert (110.000110)2 to denary real numbers?
Method:
= 6.09375
11
We only cover octal addition. The sum of two octal numbers can be reduced by
the usual addition algorithm to the repeated addition of two digits (with possibly a
carry of 1). The following table shows the addition of Octal number.
++ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16
The sum of two octal digits, or the sum of two octal digits plus 1, can be obtained
by:
Example: 58 + 68 + 28 = 158
58
+ 68
28
Decimal sum 13
Modification - 8
Octal sum 158
The sum of two hexadecimal digits, or the sum of two hexadecimal digits plus 1,
can be obtained by:
i. Finding their decimal sum; and
ii. Modifying the decimal, if it exceeds 15, by subtracting 16 and carrying 1 to
the next column.
If the base exceeds ten, we need mentally to change each hexadecimal letter digit
to its decimal form when finding the decimal sum, and each decimal difference
greater than nine to its hexadecimal form when modifying the decimal sum.
1. A = 10 B = 11 C = 12 D = 13 E = 14 F = 15
12
A16
+ 916
Decimal sum 19
Modification - 16
Octal sum 1316
“If Peter starts work at 8 o'clock in the morning and works for 8 hours, at what
time will Peter finish work?”
4 o'clock in the afternoon, right? But how you worked that one out? Because the
clock only has 12 hours, once the shorthand reaches 12, it will restart from 0. The
numbers we see on the clock-face must be less than or equal to 12. This is a finite
set or finite arithmetics.
8 + 8 = 16
(16) mod 12 = 4
30/12 = 2 remainder 6
30 mod12 = 6
Points to Remember
The higher the precision required the longer the processing time in computer
systems.
13
4 number systems
Decimal (Denary)
Binary
Octal
Hexadecimal
Octal and hexadecimal numbers are used as a shorthand for binary numbers.
Each octal digit can be expressed as 3 binary digits
Each hexadecimal digit can be expressed as 4 binary digits.
14
j. 1100110101 binary to octal [1]
k. ACD hexadecimal to denary [1]
l. 2464 octal to hexadecimal [1]
Convert:
u. 274 Octal to DENARY [1]
v. DA3 Hexadecimal to OCTAL [1]
1. Convert:
w. ABC Hexadecimal to OCTAL [1]
x. 3974 Denary to HEXADECIMAL [1]
2. Convert:
y. 7456 Octal to HEXADECIMAL [1]
z. 9E7 Hexadecimal to DENARY [1]
3. Convert:
aa. 8543 Denary to OCTAL [1]
bb. 9AD Hexadecimal to OCTAL [1]
4. Convert:
cc. A25 HEXADECIMAL to BINARY [1]
dd. 549 DENARY to OCTAL [1]
ee. 3527 OCTAL to HEXADECIMAL [1]
Convert:
15
ff. 5391 Denary to HEXADECIMAL [1]
gg. 6A5 Hexadecimal to OCTAL [1]
Convert:
hh. 5743 Denary to HEXADECIMAL [1]
ii. ABC Hexadecimal to OCTAL [1]
16
a. Evaluate (7 * 3 + 5 * 2 + 2 * 1) mod 11 [1]
j. Evaluate (3 * p) mod 5 for p = 0, 2 and 4 [2]
17
Chapter 2 : Computer Based Arithmetic
Chapter Objectives
integer
fraction
mixed number;
shift operations.
18
2.1 Binary Addition
Binary addition for fixed point numbers is done as follows:
Example:
Binary
Decimal equivalent
1010 10
+ 0111 + 7
10001 17
Example:
Binary
Decimal equivalent
1010.01 10.25
+ 0111.11 + 6.75
10001.00 17.00
Example:
Binary
Decimal equivalent
111 carry over 1 carry over
101100 44
+ 011101 + 29
1001001 73
19
Example:
Binary
Decimal equivalent
11 carry over
0.11 0.75
+ 0.01 + 0.25
1.00 1.00
0-0 = 0
1-1 = 0
1-0 = 1
0-1 = 1 with borrow “1” from the column to the left of
the number subtracted from
Example:
Binary
Decimal equivalent
11010 26
- 01001 - 9
10001 17
Example:
Binary
Decimal equivalent
1010.00 10.00
- 1000.11 - 8.75
00001.01 17
The subtraction process can be more clearly illustrated in the following example.
Example:
20