Homework 2 Homework 2 is due on Friday September 9 at 4 00pm Remember to include your Discussions section e g AB1 and follow the complete Homework submission guidelines Please ask all questions about this assignment during the TA and UA office hours Questions sent via e mail will not be answered Please remember to submit your homework before the deadline and staple your submission Homework that is not stapled or late will NOT be graded No exceptions Most of the problems in this homework require showing your work If you do not show your work half of the points will be taken away Binary Representation and Arithmetic 1 Binary addition Perform the following 8 bit binary arithmetic additions Perform the operation twice 1st assume that the numbers are represented in unsigned representation and 2nd assume that the numbers are represented in 2 s complement representation For each operation indicate when overflow occurs Show your work 1 2 3 4 5 1000 1100 0110 1110 0100 0110 0011 1100 1110 1100 1100 1110 1001 0111 0110 1001 1011 1010 1011 0000 2 Binary subtraction Perform the following 8 bit binary subtraction calculations For all of the following problems assume that you are executing the arithmetic operations on a computer that uses 8 bit 2 s complement representation for its numbers Show your work 1 2 3 4 5 6 0000 1111 1110 1111 0111 0111 0111 1010 0100 1011 1011 1111 0111 1111 0111 1110 1110 1001 0010 0000 1011 0110 0100 1100 3 Designing Representations Look in the back of the book at the table illustrating the ASCII representation for English text The table gives decimal and hexadecimal values corresponding to the 7 bit patterns used for ASCII Note that the ASCII characters 0 through 9 are assigned consecutive binary patterns consecutive integers in the table Explain why this choice is useful In other words explain why a representation in which we assigned random distinct patterns for these ten digits would not be as good as the representation shown in the table 4 Interpretation of Data Types Consider the 32 bit string represented as the hexadecimal number x476F 6C66 What value does this number represent for each of the following representations 1 2 3 4 Unsigned 2 s complement IEEE 754 floating point Extended ASCII string 5 Sorting Order the following numbers in ascending order assuming 8 bit unsigned numbers Remember the different notations for binary decimal and hexadecimal numbers 1 x10 0000 0010 10 2 1000 0011 x9A 133 6 Unsigned representation vs 2 s complement Order the next two sequences of numbers in ascending order twice First assume that the numbers are written in 8 bit unsigned and then in 8 bit 2 s complement representation 1 0111 1100 0101 1010 xDD xEA 2 x71 x8B 1001 0110 0110 1001 7 Logical operations Perform the following bitwise logical operations 1 NOT 10011 AND 10101 2 1000 0111 OR NOT 0010 1001 AND 1001 1001 3 NOT xC0 AND xFF OR xEE 8 Conversion to floating point data type Convert the following decimal numbers into their 32 bit floating point representation IEEE single precision You may use a calculator to do the required multiplications but you must show your work not just the solution 1 59 75 2 0 3 Hint 1 Not all numbers can be represented exactly using the floating point data type so do not expect that you will always reach 0 after many multiplications Hint 2 A rule of thumb to know if you did your calculations correctly is to convert back to decimal representation to check your answer 9 Conversion from floating point data type Convert the following 32 bit floating point numbers IEEE single precision into their decimal representation 1 0100 0000 0100 1001 0000 1110 0101 0110 2 0100 0101 0001 1111 1000 0000 0000 0000 10 Course policies and procedures Review the Student Code 1402 Academic Integrity Infractions In particular read the definitions for the following violations of academic integrity Cheating 1402 a Plagiarism 1402 b Fabrication 1402 c Facilitating Infractions of Academic Integrity 1402 d 1 Explain in two to four sentences how using a solution written by another student and submitting it as your own work on a homework assignment is a violation of academic integrity 2 Explain in two to four sentences how using a solution derived collectively in a study group and submitting it as your own work on a homework assignment is a violation of academic integrity
View Full Document