{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cse-110-homework-2 - y = 4 What is the output if x = 2 and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Name: Student ID # CSE 110 Homework 2 Due: Friday, March 11, by 11:59 PM. Submit your answers via the link on Blackboard. Please include your lab section (day and time) along with your name at the top of your paper. This assignment is worth a total of 15 points. You must show all work in order to receive any credit for your solutions. 1. Write a Boolean expression that corresponds to the following gate diagram: (4 points) 2. The (fictional) MST 3000 CPU has a 5-stage pipeline (fetch, decode, execute, writeback, and update), where each stage requires 1 CPU clock cycle to complete. Compute the number of CPU cycles required to completely process a sequence of 6 machine instructions with and without pipelining (1 point each). How many clock cycles are saved by using pipelining? (1 point) Be sure to show how you calculated your answers. 3. Suppose x = 3 and y = 2; show the output, if any, of the following code. What is the output if x = 3 and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: y = 4? What is the output if x = 2 and y = 2? (1 point each; 3 points total) if (x > y) { if (y > 2) { int z = x + y; System.out.println(“z is ” + z); } } else System.out.println(“x is ” + x); NOT OR XOR AND A B C D 4. What would be the result of performing a two-bit right circular shift on the byte represented in hexadecimal notation as 0D? Give your answer in hexadecimal notation. (2 points) 5. Use a switch statement to rewrite the following if statement (3 points): if (a == 1) x += 5; else if (a == 2) x += 10; else if (a == 3) x += 16; else if (a == 4) x += 34; 6. Extra Credit: Translate the following pattern of 32 bits into a real number (in base 10). You may assume that the Frst bit represents the sign, the next 8 bits represent the (biased) exponent, and the remaining 23 bits represent the mantissa. Use a value of 127 for the bias. (3 points) 1100 0010 0100 1011 0000 0000 0000 0000...
View Full Document

{[ snackBarMessage ]}