Computer Science Assignment: Binary, Hex, and Set Theory Problems

Verified

Added on  2019/09/21

|10
|1177
|306
Homework Assignment
AI Summary
This computer science assignment covers a range of fundamental topics including number system conversions (decimal to binary and hexadecimal), binary-encoded decimal (BCD), infix, prefix, and postfix notation, and base conversions. It also includes problems related to truth tables, Venn diagrams, circuit expressions and truth tables, and ASCII codes with parity bits. Furthermore, the assignment delves into floating-point representation, set builder notation, set operations (union, intersection, subsets), and set theory problems. The solutions provided offer detailed explanations and step-by-step approaches to solve each problem, making it a valuable resource for students studying computer science fundamentals. This assignment is designed to test and enhance the understanding of core concepts in discrete mathematics and computer architecture.
Document Page
1. Complete the following table, converting from Decimal, to Binary and Hex and needed.
(6 points)
Decimal Binary Hex
15 00001111 F
51 00110011 33
43 00101011 2B
165 10100101 A5
2. Convert 5,237 into Binary Encoded Decimal (BED) ( 2 point)
Answer:
Step 1: converting each digit to 4 digit binary number.
5= 0101
2= 0010
3= 0011
7= 0111
Step 2: combining these vales
BCD: 0101001000110111
3. Complete the following table of Infix, Prefix and Postfix notation. (8 points)
Prefix Infix Postfix
*AB A*B AB*
* (-a b ) (* a d) (a-b)*(a*d) (a b -) ( a d *) *
- - 2x 7y 5 2x-7y-5 2x 7y 5 - -
+ 2x - * x 7 * 2 d 2x+((x*7)-(2*d)) X 7 * 2 d * - 2x +
4. If there are 7,253 students but that number is in in Base 20, how many students does the
numeral 2 represent? (2 points)
Answer: the numeral 2 for 7253 for base 20 is: I2D
5. Create the Truth Table for the following( 6 points):
~A ^ B
A B A^B ~(A^B)
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
A V B ^ ~C
A B C ~C AVB AVB^~C
T 0 0 0 1 0 0
T 0 0 1 0 0 0
T 0 1 0 1 1 1
T 0 1 1 0 1 0
F 1 0 0 1 1 1
F 1 0 1 0 1 0
F 1 1 0 1 1 1
F 1 1 1 0 1 0
Write the statement for the shaded area in the following Venn Diagrams (8 points):
6. :_______
((A ^ C) – (A^B^C)) U( (B ^ C) – (A^B^C))
7. : (AUB) – (A^B)
Document Page
8. : (AUBUC) – ((A^B) – (A^C) – (B^C) + 2(A^B^C))
9. : ((A^B) + (A^C) + (B^C) - 2(A^B^C))
Document Page
10. Given the following circuits, create the expression.(3 points)
ANSWER:
Expression: (A’ U B) ^ (B U ( C ^ D’))
11. Given the following circuits, create the expression and the Truth Table:
(4 points)
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
ANSWER:
Expression: (A^B) ^ C’
A B C C’ A^B (A^B) ^ C’
0 0 0 1 0 0
0 0 1 0 0 0
0 1 0 1 0 0
0 1 1 0 0 0
1 0 0 1 0 0
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 0 1 0
Expression: (A ^ B) ^ (C U D)
Document Page
A B C D A ^ B C U D (A ^ B) ^ (C
U D)
0 0 0 0 0 0 0
0 0 0 1 0 1 0
0 0 1 0 0 1 0
0 0 1 1 0 1 0
0 1 0 0 0 0 0
0 1 0 1 0 1 0
0 1 1 0 0 1 0
0 1 1 1 0 1 0
1 0 0 0 0 0 0
1 0 0 1 0 1 0
1 0 1 0 0 1 0
1 0 1 1 0 1 0
1 1 0 0 1 0 0
1 1 0 1 1 1 1
1 1 1 0 1 1 1
1 1 1 1 1 1 1
12. In the following table, find the appropriate 8 bit ASCII code and add the correct Odd parity bit as
needed. (3 points)
ANSWER:
Character (not
HEX!!)
VALUE IN HEX 8 bit ASCII Parity Bit
Document Page
A 41 01000001 0
F 46 01000110 1
f 66 01100110 0
Binary Decimal fraction value Power of 2
.1 ½ .5 -1
.01 ¼ .25 -2
.001 1/8 .125 -3
.0001 1/16 .0625 -4
.00001 1/32 .03125 -5
.000001 1/64 .015625 -6
13. Using the above table for reference, Convert the following Hex numbers into the appropriate
floating point representation in single precision binary. Label the three sections of the resulting
binary stream. ( 10 points)
HEX
95.6
14. Using Set Builder Notation show the sets for the following:
All Real numbers between -4 and 19 (1 point)
Answer: let the set be ‘A’
{ A E R | A >= -4 and A <= 19}
All Integers between zero and 54 (1 point)
Answer: let the set be ‘B’
{ B E Z | B >= 0 AND B< = 54}
Answer the following questions based on these sets:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
A={3,4,5}
B={2,4,6}
C={0,1,5,7,9}
D={1,7,9}
15. Show set G that is the Union of set B and D ( 1 point)
ANSWER:
Let G = {1, 2, 4, 6, 7, 9}
Since B= {2, 4, 6} and D= {1, 7, 9}
G = (B U D)
16. Show set T that is the Intersection of set C and D ( 1 point)
ANSWER:
Let ‘T’ be a set with elements = {1, 7, 9}
And it is given that C= {0,1,5,7,9} and D= {1,7,9}
T = (C ^ D)
17. List the proper subsets of set C ( 1 point)
ANSWER: since C= {0,1,5,7,9}, thus some of its proper subsets are:
a. {0}
b. {1}
c. {5}
d. {7}
e. {9}
f. {0,1}
g. {0,1,5}
h. {1,5}
i. {0,5}
j. {5,7,9}
k. {7,9}
Document Page
l. {0,7}
m. {0,9}
n. {1,7}
o. {1,9}
p. {5,7}
q. {5,9}
18. Create set K such that K is a subset of C and a subset of D, but not a proper subset of D(1 point)
Answer: it is given that
C= {0, 1, 5, 7, 9}
D= {1, 7, 9}
K = {0,1,2,3,5,7} is a set such that K is a subset of C and a subset of D, but not a proper
subset of D
Document Page
chevron_up_icon
1 out of 10
circle_padding
hide_on_mobile
zoom_out_icon