Answer:
a) 255
b) 61602
c)
d)
Explanation:
You need to understand the decimal equivalent of hexadecimal numbers, <em>from 0 to 9 numbers are represented the same way, from 10 to 15 we use the alphabet, meaning 10 equals A in hexadecimal base, 11-B, 12-C, 13-D, 14-E, and 15-F.</em>
For your first exercise you'll enumerate the number's positions fromright to lef begining with 0:
a. F F
position 1 0
Now you'll multiply your hexadecimal number (using the decimal equivalent for your letters) for the base (16) elevated to the number of the position:
Finally, you'll add your results:
240+15=255
FF=255
b. F 0 A 2
position 3 2 1 0
F0A2=61602
c. F 1 0 0
position 3 2 1 0
0F100=61696
d. 1 0 0
position 2 1 0
100=256
I hope you find this information useful! Good luck!
Answer:
Explanation:
Since all of the items in the array would be integers sorting them would not be a problem regardless of the difference in integers. O(n) time would be impossible unless the array is already sorted, otherwise, the best runtime we can hope for would be such a method like the one below with a runtime of O(n^2)
static void sortingMethod(int arr[], int n)
{
int x, y, temp;
boolean swapped;
for (x = 0; x < n - 1; x++)
{
swapped = false;
for (y = 0; y < n - x - 1; y++)
{
if (arr[y] > arr[y + 1])
{
temp = arr[y];
arr[y] = arr[y + 1];
arr[y + 1] = temp;
swapped = true;
}
}
if (swapped == false)
break;
}
}
Answer:
a) the average CPI for machine M1 = 1.6
the average CPI for machine M2 = 2.5
b) M1 implementation is faster.
c) the clock cycles required for both processors.52.6*10^6.
Explanation:
(a)
The average CPI for M1 = 0.6 x 1 + 0.3 x 2 + 0.1 x 4
= 1.6
The average CPI for M2 = 0.6 x 2 + 0.3 x 3 + 0.1 x 4
= 2.5
(b)
The average MIPS rate is calculated as: Clock Rate/ averageCPI x 10^6
Given 80MHz = 80 * 10^6
The average MIPS ratings for M1 = 80 x 10^6 / 1.6 x 10^6
= 50
Given 100MHz = 100 * 10^6
The average MIPS ratings for M2 = 100 x 10^6 / 2.5 x 10^6
= 40
c)
Machine M2 has a smaller MIPS rating
Changing instruction set A from 2 to 1
The CPI will be increased to 1.9 (1*.6+3*.3+4*.1)
and hence MIPS Rating will now be (100/1.9)*10^6 = 52.6*10^6.
Iinear because it has to be straight and the true detention of linear is a straight line going through something