CSC 156 Fall 2023 - Homework 6 (100 pts. total)
Assigned Wed Nov 1, due Mon Nov 13


BEFORE STARTING THIS ASSIGNMENT:
Before starting the exercises given below for each section, please make sure to read each section and check your understanding (by doing the participation exercises and those additional exercises with answers provided).

FOR ALL QUESTIONS IN THIS ASSIGNMENT:
Answer each question. *Make sure to justify your answer for all questions. Do NOT just state the answer.*

THE ASSIGNMENT:
  • [15 pts.] Question 1: In the RGB color system, a shade of dark green can be made using red = 0, green = 60, and blue = 20.
             a) Express this as a 3-byte binary number.
             b) Express this as a hexadecimal number.
             c) What percentage of green was used in this color?
  • [15 pts.] Question 2: Calculate the value of the following bitwise operations:
             a) 10001 & 01011
             b) 10001 ^ 01011
             c) 01011 << 3
  • [15 pts.] Question 3: Given a 6-bit binary number x = b5b4b3b2b1b0, write a bitwise expression (in terms of x) that:
             a) gets the bit b4
             b) sets the bit b2 to 0
             c) sets the bit b3 to 1
  • [10 pts.] Question 4: Convert the 16-bit binary "floaty" number 0100111111100000 to decimal format.
  • [30 pts.] Question 5: Write the following fractional numbers using the 16-bit "floaty" format:
             a) 1.92
             b) 7200000
             c) 0.00059
  • [15 pts.] Question 6: To the maximum possible accuracy, express 4/3 using the 16-bit "floaty" format. Then, convert that result back to a fractional number. Briefly explain why the result obtained is slightly different than the number (4/3) that you started with.



    Last Modified: 11/8/23