# CSE 101 Homework 03 Assignment 2015

Exercises with a green background ( ) are designed for practice to gain a basic understanding of aparticular concept and can be discussed/debriefed with your Lead, Assistant, and helproom staff.Exercises with a white background ( ) are to be completed on your own and will not bedebriefed/discussed by CSE101 staff members. The exercises with a white background must be turned invia D2L before your next class session meets. In many cases, your next class will build on the prior day’shomework and not having it completed may inhibit your understanding of new class material.Flash DriveIf you have not already done so, using Notepad, add a file to your flash drive titled _IFFOUND.TXT(putting an underscore at the beginning of a filename will make that file appear at the top of the list).In that file, enter your name, email and/or phone number – whatever information you are willing toshare with others so they can contact you they find your flash drive.NOTE: Flash drives with identifying information can be returned to the owner; any flash drives turnedin to us without an IFFOUND file are erased.Data Representation: Numbers1. Think about the examples we discussed in class – how numbers can be represented in 4 bits or8 bits, etc. Expand this thinking to 16 bits. If you were given 16 bits to work with, as the basisfor your representation scheme:a. Assuming that all 16 bits are used only to represent digits (no excess bit), what wouldbe the lowest integer you could represent? What would be the highest?b. Assuming that the leftmost bit is reserved as an excess bit and the remaining 15 bitsrepresent digits of the number, what would be the lowest integer you couldrepresent? What would be the highest?c. How many unique numbers can be represented?2. You were recently hired to operate the MSU scoreboard for a variety of sporting eventshosted on campus. Unfortunately, the MSU scoreboard requires that the operator enter inthe appropriate score using a series of binary switches where a switch in the UP positiondenotes a ‘0’ and a switch in the DOWN position denotes a ‘1’ (ex. UP-DOWN-DOWN-UPwould be 0110).a. For MSU football events, the scores are always positive integers that never exceed160 points. Assuming that all of the switches will be used only to represent digits (noexcess bit), what is the minimum number of switches needed to represent any scorewithin this range? What is the lowest score you could represent with this number ofswitches? What is the highest score you could represent with this number ofswitches? Describe how you would represent the score ‘92’ using UP/DOWNnotation.b. For MSU disc golf events, each score represents the number of strokes the player isabove or below a certain threshold (par). Disc golf scores can be either positive ornegative integers that never exceed +/- 27. Assuming that the leftmost switch isreserved as an excess bit and all of the remaining switches represent digits, what is3.4.5.6.the minimum number of switches needed to represent any disc golf score within thisrange? What is the lowest score you could represent with this number of switches?What is the highest score you could represent with this number of switches? Describehow you would represent a score of ‘-35’ using UP/DOWN notation.c. How many unique scores can be generated if you are required to use 11 switches?Evaluate the following string of binary digits 11100010 as:a. An unsigned integer (assuming all bits are used to represent numerical information)b. A signed integer (assuming that the leftmost bit is an excess bit, with 1 denoting anegative sign)c. A real number, assuming that the leftmost bit is an excess bit, with 1 denoting anegative sign) , the next four are the whole part of the number, and the last three thefractional part of the numberTo be promoted to the level of Lead supervisor/scorekeeper on campus, you mustdemonstrate that you can easily and effortlessly convert a configuration of binary switchesinto their corresponding decimal value. As a reminder, a switch in the DOWN positionrepresents a ‘1’ and a switch in the UP position represents a ‘0’.a. What does the configuration DOWN-UP-UP-DOWN-UP-DOWN-UP-DOWN-UP-UPrepresent where the leftmost switch (excess bit) UP DOWN denotes that the score isnegative? (DOWN=1 per intro description)b. What does the configuration DOWN-UP-UP-UP-DOWN-UP-DOWN-UP-DOWN-UPrepresent where all switches are used to represent numerical information?c. What does the configuration DOWN-UP-DOWN-UP-DOWN-DOWN-UP-DOWN-UPDOWN-UP-UP represent where the leftmost switch is an excess bit, the next 5switches represent the whole part of the number, and the remaining switchesrepresent the fractional part of the number?Convert the following numbers from decimal to binary (show your work). Use the followingconvention when giving the final binary equivalent: excess bit should be the leftmost bit (use1 to denote the negative sign), followed by 7 bits for the whole part of the number, followedby 4 bits to represent the fractional part of the number:a. -45.5625b. 36.875c. 100.2d. -127.25You have been asked to perform scorekeeping for the swimming and diving program here atMSU starting in the Spring semester. Although the scorekeeping system has been upgraded tosupport fractional parts of an athlete’s time, you must demonstrate your proficiency inconverting the following decimal numbers to the appropriate configuration of binaryswitches. As a reminder, a switch in the DOWN position represents a ‘1’ and a switch in theUP position represents a ‘0’.a. Convert -28.375 to the appropriate ON/OFF configuration where the leftmost switchis the excess bit, followed by 5 switches for the whole part of the number, followedby 4 switches to represent the fractional part of the number.b. Convert 46.78125 to the appropriate ON/OFF configuration where the leftmostswitch is the excess bit, followed by 6 switches for the whole part of the number,followed by 5 switches to represent the fractional part of the number.c. Convert -13.46875 to the appropriate ON/OFF configuration where the 4 leftmostswitches represent the whole part of the number, followed by 1 switch for the excessbit, followed by 5 switches to represent the fractional part of the number.d. Convert -58.65625 to the appropriate ON/OFF configuration where the 6 leftmostswitches represent the whole part of the number, followed by 1 switch for the excessbit, followed by 5 switches to represent the fractional part of the number.7. The Library of Congress has a collection of ~ 29 million books. Assume it takes about 2048bytes to store a single page of text from a book and a typical book is 200 pages long. Howmuch storage is required to store all the books in the Library of Congress? (use the metricsystem for calculation; based on “Blown to Bits”).8. The Michigan State University electronic mail (email) system supports 50,138 undergraduateand graduate students. Assume that each student tends to store approximately 250 emails intheir inbox and another 155 emails in their outgoing mailbox. Given that the average size of asingle email is 35 kilobytes, how much storage does the MSU email system require to storestudent emails? Use the metric system for calculation and report your answer in gigabytes(GB).Excel Exercises9. In the homework folder, you will find an Excel spreadsheet called day03hw_units.xlsx thatshows the number of bits represented by a metric prefix (e.g. gigabits, petabits, etc). Thereare 3 mistakes in this spreadsheet: find them and fix them. Even after fixing the mistakes, thissheet will not show correct results. Why and at what prefix level does Excel start makingmistakes when calculating the actual number of bits despite correct formulas? (use acalculator to compare)10. In this exercise you will create an Excel calculator that takes in decimal digits and calculatesthe resulting number. Start by creating a copy of day03tables.xlsx you used in class and callthe new file day03hwtables_decimal.xlsx. Make the following changes in the decimal sheetof this file:a. Replace column headings indicating the column value with formulas, e.g. 10^3 with=10^3b. Below the headings, delete all table rows except for a single row for entering indecimal digits (delete spreadsheet rows 4 and below)c. In the rightmost results column, enter a formula that calculates the equivalentdecimal number based on the digits entered by the user into each column.Now, regardless of the digits entered in the first row of your table, your final column willautomatically calculate the overall number, e.g. if 1-0-8-4 is entered into the table’s columns,the results column should show/calculate 1084; if 7-3-1-5 is entered, the results column willshow/calculate 7315.11. In this exercise you will create an Excel calculator that takes in binary digits and calculates theresulting decimal number. Start by creating a copy of day03tables.xlsx you used in class andcall the new file day03hwtables_binary.xlsx. Make the following changes in the binary sheetof this file:d. Replace column headings indicating the column value with formulas, e.g. 2^3 with=2^3e. Below the headings, delete all table rows except for a single row for entering in binarydigits (delete spreadsheet rows 4 and below)f. In the rightmost results column, enter a formula that calculates the equivalentdecimal number based on the binary digits entered by the user into each column.(hint: N x 1 = N, N x 0 = 0)Now, regardless of the digits entered in the first row of your table, your final column willautomatically calculate the overall number, e.g. if 1-0-1-1 is entered into the table’s columns,the results column should show/calculate 11; if 0-1-0-0 is entered, the results column willshow/calculate 4.12. In this exercise you will create an Excel file called day03hw_binaryInts.xlsx that calculates thehighest and lowest signed and unsigned integers that can be implemented given a specificnumber of bits. Overall, your spreadsheet should have the following columns:g. Number of Bits (2 to 24)h. Lowest unsigned integer (conveyed by that number of bits – you may manually enterthe values into this column)i. The highest unsigned integer (conveyed by that number of bits – use a formula)j. The lowest signed integer (conveyed by that number of bits – use a formula)k. The highest signed integer (conveyed by that number of bits – use a formula)l. Units of Information (conveyed by that number of bits – use a formula)Excel Exercises: Solution SnapshotsExercise 10: Decimal Sheet (cells A2-E2 and G3 contain formulas)Exercise 12 (columns B, D, E, and F, other than column headings contain formulas)