Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have CS question that i really confuse, can you help me answer those question

ID: 3791460 • Letter: I

Question

I have CS question that i really confuse, can you help me answer those question (This is not Programming, just answer the question):

Exercise 1

2's Complement...

Find the 2's complement for the base 2 numbers:

11010110 and 01101001

Why is the 2's complement used with computers ?

Are there alternative methods ?

Exercise 2

10's complement

What is the formula for the 10's complement for a positive decimal number ?

Why use it ?

Find the 10's complement for the base 10 numbers:

1024 and 512

Exercise 3

Given a 32 bit register, find the base 2 version of the following base 10 numbers:

32,101    12.333    and 12.064

Exercise 4

What is the purpose of the shift left and shift right assembly commands ?

Give an example.

Exercise 5

What is the main problem with representing some numbers in a computer ?

Give 3 examples

Exercise 6

How do you represent a negative number ?

Explain and give example.

Exercise 7

Summarize the tricks in performing the each of the basic math operations on a computer ...

Add

Subtract

Multiply

Divide

Explanation / Answer

Exercise 1

1: Substract 1 from x

11010110 - 00000001 = 11010101

2: Invert it

00101010

3: calculate binary to dec(but ignaore first bit)

2 + 8 + 32 = 42

4: remember the first bit of original value (==1) if 1 => invert it => -42

2's complements allows both negetive and positive numbers to be added together without any special logic

alternate methos of finding the 2's complement of a binary number is as fallows

1 : Start at the right with the LSB and write the bits as they are up to and including the first 1

2 : ' Take the 1's complements of the remaining bits

Exercise 2:

10's complement of a positive decimal integer n is 10 to the power of k minus n, where k is the number of digits in the decimal representation of n.

used to make the arithematic operations in the digital system easier

10's complement of 1024 is 8976 and 512 is 488

Excerise 3

32101 = 111110101100101

12.333 = 1100.0101010100

12.064 = 1100.0001000001

Exercise 4:

Shift left : zeros are shifted into low order bit

Shift right : sign bit(most significant bit) is shifted into high order bit

for example if we have a binary number 11110000

using shift instructions we can make 2 decisions

1. if we use shift left by one bit the out come will be 11100000

2.if we use shift right by one bit the out come will be 01111000

exercise 6

the simplest is to use the leftmost digit of the number as a special value to represent the sign of the number : 0 = positive, 1= negetive.

example value of a negetive 12 ( decimal) would be written as 11100. notice that in this system, it is important to show the leading 0(to indiacte a positive value)

exercise 7:

addition: achieved by 2's complement

substraction : is achieved by 2's complement of addition - adding one number with 2's complement of other number

multiplication and division : are achieved using shift and add/substract combos repeated a certain number of times . shifting is also achieved by multiplication or division by multiples of 2 which takes us back to addition