Consider a new data type, the smallchar, which can hold 6 bits. What is the larg
ID: 3795055 • Letter: C
Question
Consider a new data type, the smallchar, which can hold 6 bits. What is the largest integer that an unsigned smallchar can hold? What is the largest positive integer that a signed smallchar can hold? What is the most negative integer that a signed smallchar can hold? Consider the following table. You input the given values of variable x where x is of type unsigned smallchar. What decimal values will the PIC assign to these numbers? What are the binary values of these numbers? Consider the following table. You input the given the values of variable y where y is of type signed smallchar. What true decimal values will the PIC assign to these numbers? What are the binary values of these numbers? Consider the following table. You input the given values of variable z where z in of type signed smallchar. What decimal values will the PIC assign to these numbers?Explanation / Answer
Here I answered the first 2 questions for you:
3. Consider a new data type, the smallchar, which can hold 6 bits.
a. What is the largest integer than an unsigned smallchar can hold?
As there are 6 bits, all 1's will give you the max number. i.e., 111111 base 2.
Therefore, the largest unsigned integer for the given datatype is:
2^0 + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 = 1 + 2 + 4 + 8 + 16 + 32 = 63.
b. What is the largest positive integer that a signed smallchar can hold?
As it is a signed bit, the most significant bit will be assigned for sign, and a
positive sign will have a 0 bit, so, to mark a largest signed integer, the value is 011111 base 2.
2^0 + 2^1 + 2^2 + 2^3 + 2^4 = 1 + 2 + 4 + 8 + 16 = 31.
c. What is the most negative integer that a signed smallchar can hold?
As it is a signed bit, the most significant bit will be assigned for sign, and a
negative sign will have a 1 bit, so, to mark a largest signed integer, the value is 111111 base 2.
Note the the MSB 1, is sign and not a value. So, value is: -30.
4. Consider the following table. You input the given values of variable x where x is of type
unsigned smallchar. What decimal values will the PIC assign to these numbers?
What are the binary values of these numbers?
unsigned smallchar x = Binary True decimal
200 (11)001000 8
100 (01)100100 36
80 (01)010000 16
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.