Question: ( 7 ) ( 4 marks ) Perform the subtraction on the following given unsigned binary numbers using 2 s complement method. Represent your final

(7)(4 marks) Perform the subtraction on the following given unsigned binary numbers using 2s complement method. Represent your final results using the positive or negative decimal format, whenever it is applicable.
(a)1001110001(b)100010101011
(8)(4 marks) Perform the subtraction on the given signed binary numbers using 2s complement method. Note that you first need to convert the decimal numbers into the appropriate format. Assume that we are using an 8-bit CPU. Represent your final results using the positive or negative decimal format, whenever it is applicable.
(a)(+29)10+(-49)10(b)(-29)10+(-49)10
(9)(8 marks) Given a binary number 10110110 in an 8-bit CPU, calculate its original number in the decimal format, if it is encoded in each of the following formats.
(a) Unsigned binary format
(b) Signed 1s complement format (c) Signed 2s complement format (d) BCD format
is 50, while the median of the list
is 62.5.
(a) Write the function:
1,3,50,75,80
1,3,50,75,80,100
void sort(int *A, int n);
which sorts the array A of n elements in ascending order. You may use any sorting
algorithm you learned from CPSC 1620.
(b) Write the function:
double median(int *A, int n);
which computes the median of the array A of n elements. It is acceptable if the
function rearranges the elements of A.
(c) Write the main program which asks the user to enter n, allocates an array of n elements, and displays the median. The program should repeat as long as n >=1. When n <1, exit the program. Be sure that there is no memory leak.
1
Sample session:
Enter the size of the list (<1 to quit): 6
Enter element 1: 100
Enter element 2: 50
Enter element 3: 75
Enter element 4: 1
Enter element 5: 80
Enter element 6: 3
The median is 62.5.
Enter the size of the list (<1 to quit): 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!