Reference no: EM132486729
MAT1101 - Discrete Mathematics for Computing - University of Southern Queensland
Problem 1
Computer specification
Everything stored on a computer is expressed as a string of bits. However, different types of data (for example, characters and numbers) may be represented by the same string of bits.
For this Problem, we assume that text characters (or symbols) are stored in 8-bits. Table 1 maps the ISO-LATIN-1 character set to the hexadecimal value repres- enting the state of these 8 bits. For example, from Table 1 the character ‘A' has the hexadecimal value 41. Converting this hexadecimal value to binary gives the state of the 8 bits (e.g. 01000001) storing the character ‘A'.
Table 1: Hexadecimal map of the "Control, Basic and Supplemental Latin 1 Character set" to an 8-bit encoding scheme.
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
A
|
B
|
C
|
D
|
E
|
F
|
0
|
NULL
|
SOH
|
STX
|
ETX
|
EOT
|
ENQ
|
ACK
|
BELL
|
BS
|
HT
|
LF
|
VT
|
FF
|
CR
|
SO
|
SI
|
1
|
DLE
|
DC1
|
DC2
|
DC3
|
DC4
|
NAK
|
SYN
|
ETB
|
CAN
|
EM
|
SUB
|
ESC
|
FS
|
GS
|
RS
|
US
|
2
|
SP
|
!
|
"
|
#
|
$
|
%
|
&
|
'
|
(
|
)
|
*
|
+
|
,
|
-
|
.
|
/
|
3
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
:
|
;
|
<
|
=
|
>
|
?
|
4
|
@
|
A
|
B
|
C
|
D
|
E
|
F
|
G
|
H
|
I
|
J
|
K
|
L
|
M
|
N
|
O
|
5
|
P
|
Q
|
R
|
S
|
T
|
U
|
V
|
W
|
X
|
Y
|
Z
|
[
|
\
|
]
|
^
|
_
|
6
|
'
|
a
|
b
|
c
|
d
|
e
|
f
|
g
|
h
|
i
|
j
|
k
|
l
|
m
|
n
|
o
|
7
|
p
|
q
|
r
|
s
|
t
|
u
|
v
|
w
|
x
|
y
|
z
|
{
|
|
|
}
|
~
|
DEL
|
8
|
XXX
|
XXX
|
BPH
|
NBH
|
IND
|
NEL
|
SSA
|
ESA
|
HTS
|
HTJ
|
VTS
|
PLD
|
PLU
|
RI
|
SS2
|
SS3
|
9
|
DCS
|
PU1
|
PU2
|
STS
|
CCH
|
MW
|
SPA
|
EPA
|
SOS
|
XXX
|
SCI
|
CSI
|
ST
|
OSC
|
PM
|
APC
|
A
|
NBSP
|
¡
|
¢
|
£
|
¤
|
¥
|
¦
|
§
|
¨
|
©
|
ª
|
«
|
¬
|
SH
|
®
|
¯
|
B
|
°
|
±
|
²
|
³
|
´
|
µ
|
¶
|
|
¸
|
¹
|
º
|
»
|
¼
|
½
|
¾
|
¿
|
C
|
À
|
Á
|
Â
|
Ã
|
Ä
|
Å
|
Æ
|
Ç
|
È
|
É
|
Ê
|
Ë
|
Ì
|
Í
|
Î
|
Ï
|
D
|
Ð
|
Ñ
|
Ò
|
Ó
|
Ô
|
Õ
|
Ö
|
×
|
Ø
|
Ù
|
Ú
|
Û
|
Ü
|
Ý
|
Þ
|
ß
|
E
|
à
|
á
|
â
|
ã
|
ä
|
å
|
æ
|
ç
|
è
|
é
|
ê
|
ë
|
ì
|
í
|
î
|
ï
|
F
|
ð
|
ñ
|
ò
|
ó
|
ô
|
õ
|
ö
|
÷
|
ø
|
ù
|
ú
|
û
|
ü
|
ý
|
þ
|
ÿ
|
In this computer, we will also assume that numbers (signed integers, unsigned integers and single precision floating point real) numbers are stored in 12-BITS. For single precision floating point (real) numbers, 6-bits of these 12-BITS are reserved for the mantissa (or significand) with 2k-1 - 1 as the exponent bias (where k is the number of bits for the characteristic).
Information will to be passed within the computer using 24-BITS. For example, the string of 24-BITS:
0011 0110 0011 1001 0011 0101,
within our computer might represent:
• three ASCII/LATIN-1 characters ‘695' (i.e. 3×8-bits encoded as per Table 1); or
• two numbers (2×12-BITS). The interpretation of these 12-BITS will be differ- ent depending whether the numbers are to be interpreted as:
- signed integers (e.g. 0011 0110 0011 → 867 and 1001 0011 0101 →
-1739),
- unsigned integers (e.g. 0011 0110 0011 → 867 and 1001 0011 0101 →
2357), or
- as single precision floating point (real) numbers (e.g. 0.13672 and
-0.0004044). More precisely, any single precision floating point (real) number between 0.13672 and 0.1406 will have the same 12-BIT pattern, in this not a very accurate computer. Similarly, any floating point number between -0.0004044 and -0.0004119 will also have the same 12-BIT pattern.
i) Find the computer representation for the negative integer -515.
ii) Find the computer representation for the floating point number 51.25.
iii) Is the number stored in Problem 1(ii) exact? If not what is the actual num- ber stored?
iv) Find the bit pattern required to store the five characters:
§USQ©
The remaining parts (v-ix) refer to the following 24-BITS:
011100100110010111110011
v) Represent this string of bits as a single hexadecimal number.
vi) What characters according to Table 1 are represented by these 24-BITS?
vii) What pair of unsigned integers is represented by these 24-BITS?
viii) What pair of single precision floating point numbers could be represented by these 24-BITS?
ix) Double precision on this computer will use 24-BITS, where 8-bits are used to store the characteristic. Assuming this, answer the following Problems.
• What will be the state of the 24-BITS, if 51.25 is stored as a double precision floating point number on this computer?
Problem 2
An Internet Protocol address (IP address) is a numerical bit pattern assigned to each device (e.g., computer, printer) participating in a computer network that uses the internet for communication. An IP address serves two purposes: 1) host iden- tification, and 2) location addressing.
IPv4 uses 32-BIT (four-bytes) addresses. IPv4 addresses may be written in any notation expressing a 32-BIT integer value, but for human convenience, they are most often written in the dot-decimal notation, which consists of four octets of the address expressed individually in decimal and separated by periods. However, IPv4 addresses can also be expressed in Octal, Decimal, Hexadecimal etc as shown in the Table 2.
Table 2: The following table shows several representations of the IP Address 192.0.2.235
Format
|
Value
|
Notes
|
Dotted Decimal
|
192.0.2.235
C0.00.02.EB 0300.0000.0002.0353
C00002EB 3221226219
30000001353
|
Each 8-bits is expressed as decimal
|
Dotted Hexadecimal
|
Each 8-bits expressed as hexadecimal
|
Dotted Octal
|
Each 8-bits expressed as octal
|
Hexadecimal
|
32-bit binary number in hexadecimal
|
Decimal
|
32-bit binary number in decimal
|
Octal
|
32-bit binary number in octal.
|
i) Consider the following IP address given in dotted decimal format 10.0.20.105. Convert it to the following formats.
i) Decimal format.
ii) Binary format.
iii) Octal format.
ii) You are given an IP address (01110111001100001000100010001001) as a 32- bit binary number. Convert this number to:
i) Dotted Hexadecimal format.
ii) Octal format.
iii) Dotted Decimal format.
Problem 3
Consider the following algorithm.
1. Input year a four digit year.
2. if (year mod 4 = 0) { Divisible by 4 }
2.1 if (year mod 100 = 0) { Divisible by 100 }
2.1.1 if (year mod 400 = 0) {Divisible by 400}
2.1.1.1 isLeapYear ← TRUE;
Else
isLeapYear ← FALSE;
End if
Else { Not divisible by 100}
2.2.1 isLeapYear ← TRUE;
End if
3. Else { Not divisible by 4 }
isLeapYear ← FALSE;
4. End if
5. Output isLeapYear
i) Trace the algorithm starting with the input 2600.
ii) Document the changes that would need to be made to the algorithm after step 4 to output the number of days in a specific year. Make sure that you describe the changes in detail.
Attachment:- Discrete Mathematics for Computing.rar