Question: 4. [Ref: 2.2 of the Chapter 2 lecture notes - Representing Unsigned Integers] Background: The word size of a microprocessor is a term that refers
4. [Ref: 2.2 of the Chapter 2 lecture notes - Representing Unsigned Integers] Background: The word size of a microprocessor is a term that refers to the number of bits, n, that are used in various places of the computing system, e.g., the sizes of the general-purpose registers, the width of the data bus, and possibly the width of the address bus as well. Also, in a high-level language like C or C++, if the word size of a pro cessor is n-bits, integer values of the data types int/signed int and unsigned int will also be represented in n-bits (henceforth, understand that in C, the int and signed int data types are interchangeable, so we will just use the term int here to represent both int and signed int). In modern computing systems, n is always a power of 2 and is also a power of 8, so common microprocessor word sizes are 8-bits, 16-bits, 32-bits, 64-bits, and 128-bits. For this exercise, suppose the word size of our microprocessor is n = 16-bits. (a) Suppose the C statement unsigned int x = 7183; is executed. What is the 16-bit binary value that stored in the memory location associated with variable x? Enter 16-bits (i.e., 16 1's and 0's) for the answer in Canvas, even if one or more of the most-signifcant bits are 0's. (b) In the C programming language, the C Standard Library contains a fle which defnes a constant which specifes the minimum value, in decimal, of an n-bit unsigned int. Let us call this constant UINT_MIN. What would be the decimal value of UINT_MIN for a C compiler designed to run on our 16-bit microprocessor system? (c) Similarly, the C library defnes a constant which specifes the maximum value, in decimal, of an n-bit unsigned int. Let us call this constant UINT_MAX. What would be the decimal value of UINT_MAX?
5. [Ref: 2.2 of the Chapter 2 lecture notes - Representing Signed Integers] (a) Continuing the previous exercise, again assume the word size of the microprocessor in our computing system is n = 16 bits. Suppose the C statement int y = -7183; is executed. What is the 16-bit binary value that is stored in the memory location associated with variable y? Enter 16-bits (i.e., 16 1's and 0's) for the answer in Canvas, even if one or more of the most-signifcant bits are 0's. Hint: signed ints can be negative or non-negative and are always represented in two's complement. (b) Assuming the defnition of a constant named MIN_INTwhich is the decimal value of the most negative int what would be the value of MIN_INT. (c) And to conclude the fun, what would be the decimal value of the constant MAX_INT, which is the decimal value of the most positive int.
6. [Ref: 2.2 of the Chapter 2 lecture notes - Base conversions of integer values] A computing professional, especially a programmer (and especially a systems programmer), must understand the diferent commonly-used mathematical bases or numeral systems that are used to represent integers in computing, of which there are four: binary or base 2; octal or base 8; decimal or base 10; and hexadecimal or base 16. Additionally, he/she must be able to convert integer values among these bases. Consequently, you are being provided with the opportunity now to demonstrate your knowledge of how to do this. We shall continue to assume we are dealing with an n = 16-bit microprocessor, so each integer value is represented using 16-bits. We will not ask you any questions above converting to or from octal because that base is not as commonly used today as it was in the past. Note that when we say "unsigned" we mean the value is non-negative and is not represented in two's complement notation. When we say "signed" we mean the value can be negative or non-negative and is represented in two's complement. For each exercise, explain how you obtained your answeri . (a) Convert the unsigned binary integer 1010_0101_0011_11002 to the equivalent value in decimalii . (b) Convert 215210 to the equivalent hex value. (c) Convert the unsigned hexadecimal integer CAFE16 to binary. (d) Convert the signed hexadecimal integer DEAD16 to decimal. (e) Convert the signed binary integer 00101011111101112 to hex. (f) Convert the signed binary integer 10000000000000002 to decimal. (g) Convert -589110 to a signed binary integer (two's complement). Kevin R. Burger :: Computer Science & Engineering :: Arizona State University :: Rev 041201 Page 2 i For example, if binary number we are converting is 11012, then your explanation would be something to the efect that 11012 = 1 x 23 + 1 x 22 + 1 x 20 = 8 + 4 + 1 = 1310. For conversions among other bases, your explanation will be a similar equation. ii It is fairly common to use underscores to partition the digits of binary and hex numbers in order to make the number more readable (in the same way we use commas to partition the digits of decimal numbers into groups of three digits each because 2130891231257 is not as readable as 2,130,891,231,257). Also, I will often write a subscript of 2, 8, 10, or 16, following the number to indicate the base, especially when it is not obvious, e.g., what is 111? Well, it could be 710 if 111 is a binary number, or it could be 11110 if 111 is a decimal number, or it could be 7310 if 111 is an octal number, or it could be 27310 if 111 is a hex number, or it could be 13 if 111 is a ternary number, etc.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
