lab_2_worksheet

.docx

School

Langara College *

*We aren’t endorsed by this school

Course

1050

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

4

Uploaded by GrandGuineaPig4093

Report
Lab 2: Chapter 3, Data Representation — Negative Integers, Non- negative Floating Point Numbers (Fractions), Text, Text Compression. [52 marks] In all of the problems, you must show your work to qualify for the mark. Type your answer in this worksheet after each question. Export the completed worksheet to PDF and Submit the PDF version with D2L. The related Lab Manual PDF files and Applets are included on D2L. It is recommended that you read the PDF Files and try some examples with the Applets. 1. [3 marks] Convert -45 to 8-bit signed magnitude binary notation. Check your answer with "Negative Binary Numbers" Applet. Answer: -45= 10101101 2 2. [4 marks] Convert -45 to 8-bit 2's complement binary notation. Check your answer with "Negative Binary Numbers" Applet. Answer: -45 = 45 = 00101101 = 11010010+1 = 11010011 2 3. [9 marks] Convert the following 8-bit signed magnitude binary numbers to decimal. 10101010 00101010=42=-42 00110101 00110101=53 11110100 01110100=116=-116 Page 1
4. [9 marks] Convert the following 8-bit 2's complement binary numbers to decimal. Note: A non-negative number’s 2’s complement is the same as its sign-magnitude. 10101110 01010001+1=01010010= 82= -82 00110101 11001010+1=11001011= -75= 75 11101010 00010101+1=00010110=22=-22 5. [ 2] Convert ˗137 to Binary using "Negative Binary Numbers" Applet. How many Bits would be needed and Why? So when we use 8-bits to represent -137 in binary, the case of overflow occurs as the value does not fit into the number of bits we have allocated for the result. Therefore, in order to represent -137, we need 9 bits because it can represent numbers from -256(2 (9-1) ) to +256(2 (9-1) ). Page 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help