Download Chapter 2 - kalpol.com

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Josh Poage
CS310 # 50940
457-45-8446
Chapter 1
1.8.
Characteristics of algorithms:
1. Definiteness – each step is precisely stated.
2. Effectively computable – each step can be carried out by a computer.
3. Finiteness – the procedure terminates.
1.10
1. No – there is no terminating condition.
2. No – there are an infinite number of prime numbers, and the procedure will never terminate.
3. Yes
4. No – it is statistically possible that the procedure may never terminate.
1.16
There is one ISA implemented by each microarchitecture. Many microarchitectures can use the same ISA.
1.19. For backwards compatibility.
1
Josh Poage
CS310 # 50940
457-45-8446
Chapter 2
2.2
For 26 characters, 5 bits are needed (25 = 32) which will contain all possible combinations.
For upper- and lower-case, 6 bits will suffice (26 = 64, 26+26=52).
2.3
a. 9 bits will be needed. (29 = 512)
b. About 112 more. (400+112 = 512)
2.4
With n bits, 2n integers can be represented. The range is [0, n-1].
2.8
a. The largest positive number in 2’s complement is 127=01111111.
b. The largest negative number in 2’s complement is –127=11111111.
c. The largest positive number that can be represented in n-bit 2’s complement is 2n-1.
d. The smallest negative number that can be represented in n-bit 2’s complement is –2n-1.
2.9
a.
0101
0001
----0110 = 6
b.
10100101
00000001
-----------10100110 = 166
c.
00000001
00000001
----------00000010 = 2
2
Josh Poage
CS310 # 50940
457-45-8446
d.
1100011000101100
0000000000000001
----------------------1100011000101101 = 50,733
2.10
a.
102=01100110
b.
64 = 01000000
c.
33 = 0100001
d.
-128= 010000000
101111111
000000001
------------110000000
2.12
a.
11111010
b.
00011001
c.
11111000
d.
00000001
2.13
a.
b.
c.
d.
e.
1100
1010
1111
1011
10000
3
Josh Poage
CS310 # 50940
457-45-8446
2.16
a.
1011
0001
-----1100 = -4
b.
01010101
11111111
-----------01010100 = 172
c.
0101
1110
-----1011 = -5
d.
01
10
--11 = -1
2.17
a.
b.
c.
d.
1100 = 12
1011000 = 88
1011 = 11
11 = 3
2.19.
3 generates overflow.
3. 0111 + 0001 = 1000 which is incorrect.
4
Josh Poage
CS310 # 50940
457-45-8446
2.27
a.
b.
c.
d.
e.
f.
01010111
100
10100000
00010100
0000
0000
2.30
a.
b.
c.
d.
e.
f.
11010111
111
11110100
10111111
1101
1101
2.31
a.
b.
c.
d.
0111
0111
1101
0110
2.33
a.
b.
c.
d.
mask: 11111011 operation: and
01000100
operation : or
00000000
operation: and
11111111
operation: or
2.36
a.
b.
c.
d.
11.11 = 0 10000010 00000000000000000001111
-110111.010111 = 1 10000110 00000000000110111010111
11.001001000011 = 0 10001100 00000000011001001000011
1111101000000000 = 0 1000000 00000001111101000000000
2.37
a.
b.
c.
d.
0
10000000000000000000 x 23 = 10000000000000000 = 65,536
0
1
5
Josh Poage
CS310 # 50940
457-45-8446
2.40
a.
b.
c.
x48656C6C6F21 = 01001000 01100101 01101100 01101100 01101111 00100001 = Hello!
x68454C4C4F21 = 01101000 01000101 01001100 01001100 01011111 00100001 = hELLO!
x436f6d70757465727321 = 01000011 01101111 01101101 01110000 01110101 01110100
01100101 01110010 01110011 00100001 = Computers!
d.
x4C432D32 = 01001100 01000011 00101101 00110010 = LC-2
2.42
a.
b.
c.
d.
2.43
1101 0001 1010 1111 = D1AF
001 1111 = 1F
1=1
1110 1101 1011 0010 = EDB2
a.
b.
c.
d.
e.
2.44
x10 = 0001 0000
x801 = 1000 0000 0001
xF731 = 1111 0111 0011 0001
0F1E2D = 0000 1111 0001 1110 0010 1101
BCAD = 1011 1100 1010 1101
a.
b.
c.
d.
xF0 = 1111 0000 = 11111111 00000000 = 10
x7FF = 0111 1111 1111 = 00000111 11111111 11111111 = 00000111 00000000 00000000 = 700
x16 = 0001 0110 = 00000001 00000110 = 16
x8000 = 1000 0000 0000 0000 = 11111000 00000000 00000000 00000000 = 00001000 00000000
00000000 00000000 = 8000
2.45
a.
b.
c.
d.
2.46
10000000 = 0001 0000 0000 = 100
111 = 0110 1111 = 6F
123, 456, 789 = 0111 0101 1011 1100 1101 0001 0101 = 75BCD15
–44 = -00101100 = 1101 0100 = D4
a.
025B
26DE
-------2939
6
Josh Poage
CS310 # 50940
457-45-8446
b.
7D96
F0A0
------16E36
c.
A397
A35D
------146F4
d.
7D96
7412
------F1A8
e.
they’re in hex?
2.47
a.
0101010001111000
1111110111101010
-----------------------0101010001101000 = 546816
b.
1010101111001101
0001001000110100
-----------------------1011101111111101 = BBFD
c.
((1101111011111010)’ AND (1111111111111111)’)’=
(0010000100000101 AND
0000000000000000)’=
( 0000000000000000)’=
( 1111111111111111) = FFFF
7
Josh Poage
CS310 # 50940
457-45-8446
d.
00000011111111 XOR
11001001011100
---------------------11001010100011 = 32A3
2.48
a. 25, 675 = 644B
b. 2A3.A = 2.A3A X 162
c. Hello = 0100 1000 0110 0101 0110 1100 0110 1100 0110 1111 = 48656C6C6F
2.49
unsigned binary
1’s complement
2’ complement
IEEE 754 floating point
ASCII string
2.51
Q1=XY’ + XZ’
Q2=X’ +Z’=
x y z Q1
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
x434F4D50
x55544552
1000011010011110100110101010000 1010101010101000100010101010010
1000011010011110100110101010000 1010101010101000100010101010010
1000011010011110100110101010000 1010101010101000100010101010010
4.34F4D5 x 167
5.5544552 x 167
COMP
UTER
Q2
1
1
1
1
1
0
1
0
8
Related documents