Last active
March 23, 2020 05:48
-
-
Save vd89/004c54d537d42e0a575d88830e578bce to your computer and use it in GitHub Desktop.
The Number System
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7. What is the largest positive number one can represent in | |
a 12-bit 2's complement code? Write your result in binary | |
and decimal? | |
Ans: | |
Largest 12-bit binary positive = 0111 1111 1111 | |
In Decimal = (1+2+4+8+16+32+64+128+256+512+1024+0) = 2047 = 2^11 -1 | |
8. What are the 8-bit patterns used to represent each of the | |
characters in the string " CODE/THS 2020 " ? (Only represent | |
the characters between the quotation marks.) | |
**Note: There is space between THS and 2020 . | |
Ans: | |
Using the ASCII Table | |
CODE/THS 2020 | |
Dec Binary | |
C = 67 0100 0011 | |
O = 79 0100 1111 | |
D = 68 0100 0100 | |
E = 69 0100 0101 | |
/ = 47 0010 1111 | |
T = 84 0101 0100 | |
H = 72 0100 1000 | |
S = 83 0101 0011 | |
SPACE = 32 0010 0000 | |
2 = 50 0011 0010 | |
0 = 48 0011 0000 | |
2 = 50 0011 0010 | |
0 = 48 0011 0000 | |
Decimal = 67 79 68 69 47 84 72 83 32 50 48 50 48 | |
Binary = 01000011-01001111-01000100-01000101-00101111-01010100-01001000-01010011-00100000-00110010-00110000-00110010-00110000 | |
9. Perform the following additions on 12-bit numbers, | |
generating an 12-bit result. Negative numbers are | |
represented using two’s complement. For each addition, | |
clearly indicate if unsigned and/or signed overflow | |
occurred or not. | |
● 1111 1111 0101 | |
0000 1100 1100 | |
● 1101 0101 1010 | |
1111 1110 1010 | |
● 1111 1111 0100 | |
1101 0111 1111 | |
● 1111 1111 0011 | |
0011 1001 1001 | |
Ans. | |
● | |
11111 1111 1 (Carry) | |
1111 1111 0101 | |
0000 1100 1100 | |
----------------- | |
1 0000 1100 0001 | |
= Signed Overflow is 1 | |
● | |
1 1111 1111 1 (Carry) | |
1101 0101 1010 | |
1111 1110 1010 | |
----------------- | |
1 1101 0100 0100 | |
= Signed Overflow is 1 | |
● | |
1 1111 1111 1 (Carry) | |
1111 1111 0100 | |
1101 0111 1111 | |
----------------- | |
1 1101 0111 0011 | |
= Signed Overflow is 1 | |
● | |
1111 1111 0011 | |
0011 1001 1001 | |
------------------- | |
1 0011 1000 1100 | |
= Signed Overflow is 1 | |
10. (1101)2 × (101)2 | |
Ans: | |
1101 1101 = 1+0+4+8 = 13 | |
101 * 101 = 1+0+4 = 5 | |
------- ---- | |
111 (carry) 65 | |
1101 | |
0000| + | |
1101|| + | |
--------- | |
01000001 = 1+64 = (65)10 | |
11. (1001)2 ÷ (101)2 | |
Ans: | |
1 (Borrow) 101 = 1+0+4 = 5 | |
101 ) 1001 ( 1 1001 = 1+0+0+8=9 | |
101 9/5 = | |
---- | |
0100 | |
(1001)2 ÷ (101)2 = (1)2 | |
12. What is the biggest binary number you can write with 5 bits? | |
Ans: 11111 = 1+2+4+8+16 = 2^5 -1 = 31 | |
13. What is the biggest binary number you can write with | |
n bits? | |
Ans: 2^n -1 the max no | |
14. Which fractions recur infinitely in binary and which terminate? | |
Ans: if demoninator of fraction in lowest form is power of 2 then it terminates, else not. | |
15. In hex, 2BFC + 54AF ? | |
Ans : 2BFC = (11260)10 = (10101111111100)2 | |
54AF = (21679)10 = (101010010101111)2 | |
111 1111 1111 1 (Carry) | |
010 1011 1111 1100 | |
+ 101 0100 1010 1111 | |
---------------------- | |
1000 0000 1010 1011 | |
= 32768+128+32+8+2+1 = (32939)10 | |
16 32939 | |
2058 11 = B | |
128 10 = A | |
8 0 | |
= (80AB)16 | |
2BFC + 54AF = 80AB | |
16. If a number has k digits in hex, how many digits (bits) does it have in binary ? | |
Ans : k/4 | |
17. Convert the binary number 1101101111110101 to hex ? | |
Ans : | |
1101 1011 1111 0101 | |
= 32768+16384+4096+2048+512+256+128+64+32+16+4+1 | |
= (56309)10 | |
16 56309 | |
3519 5 | |
219 15 | |
13 11 | |
1101 1011 1111 0101 = (DBF5)16 | |
18. Convert the hex number ABC7 to binary? | |
Ans. | |
ABC7 | |
= 10*16^3 + 11*16^2 + 12*16 + 7*1 | |
= (43975)10 | |
2 43975 | |
21987 1 | |
10993 1 | |
5496 1 | |
2748 0 | |
1374 0 | |
687 0 | |
343 1 | |
171 1 | |
85 1 | |
42 1 | |
21 0 | |
10 1 | |
5 0 | |
2 1 | |
1 0 | |
(ABC7)16 = (1010 1011 1100 0111)2 | |
19. In hex, AC74 − B3F? | |
Ans: | |
AC74 = (10 × 16³) + (12 × 16²) + (7 × 16¹) + (4 × 16⁰) | |
= (44148)10 | |
= (1010 1100 0111 0100)2 | |
B3F = (11 × 16²) + (3 × 16¹) + (15 × 16⁰) | |
= (2879)10 | |
= (0000 1011 0011 1111)2 | |
011 000 1011 (Borrow) | |
1010 1100 0111 0100 | |
- 0000 1011 0011 1111 | |
------------------------- | |
1010 0001 0011 0101 | |
= (41269)10 | |
= (A135)16 | |
20. Convert the following binary fractions to ordinary fractions | |
● 0.1001 | |
● 1.0011 | |
● 1.1111 | |
Ans: | |
A. 0.1001 | |
= 0*2^0 + 1*2^-1 + 0 + 0 + 1*2^-4 | |
= (0.5625)10 | |
B. 1.0011 | |
= 1 + 1*2^-3 + 1*2^-4 | |
= (1.1875)10 | |
C. 1.1111 | |
= 1 + 1*2^-1 + 1*2^-2 + 1*2^-3 + 1*2^-4 | |
= (1.9375)10 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment