We are running programs where values of type int are 32 bits. They are represent
ID: 3781327 • Letter: W
Question
We are running programs where values of type int are 32 bits. They are represented in two'2 complement, and they are right shifted arithmetically. Values of type unsigned are also 32-bits. We are generating arbitrary vlayes x and y, and converting them to unsigned values as follows:/* Create some arbitrary vlayes */int x = random(); int y = random();/* Convert to unsigned */unsigned ux = (unsigned) x; unsigned uy = (unsigned) y; For each of the following C expressions, you are to indicate whether or not the expression always yields 1. If it always yields 1, describe the underlying mathematical principles. Otherwise, give an example of arguments that make it yield theta.Explanation / Answer
Ans)
A:-False,i.e 1>INT_MIN != -1<-INT_MIN.
B:-True,Suffice multiple distribution.
C:-False.~(1100)+ ~(1100) !=~(11000)
D:-True.Unsigned and sign numeral bit pattern is completely identical.
E:-True.Arithmetically shift right clear the least significant bit,even numeral is not changed,but old numeral decreasing 1.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.