subject

2.81: we are running programs on a machine where values of type int are 32 bits. they are represented in two's complement, and they are right shifted arithmetically. values of type unsigned are also 32 bits. we generate arbitrary values x and y, and convert them to unsigned values as follows: /* create some arbitrary values */ 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 0. (x < y) == (-x > -y) ((x + y) < < 4) + y - x == 17*y + 15*x ~x + ~y + 1 == ~(x+y) (ux - uy) == -(unsigned) (y - x) ((x > > 2) < < 2) < = x

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:20
Write a program called assignment3 (saved in a ļ¬le assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b.c. it is a simple but very eā†µective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the ā€œlargerā€ integer is replaced by the diā†µerence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
question
Computers and Technology, 22.06.2019 07:20
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display ā€œenter a value to be cubed.ā€ input value; set cube = value ^ 3 display value, ā€œ cubed is ā€œ, cube end while
Answers: 2
question
Computers and Technology, 22.06.2019 17:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argumentā€”a list of strings of the format "lastname, firstname" ā€”and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
You know the right answer?
2.81: we are running programs on a machine where values of type int are 32 bits. they are represent...
Questions
question
Mathematics, 01.02.2022 02:10
question
Mathematics, 01.02.2022 02:10
question
History, 01.02.2022 02:10