answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
EleoNora [17]
2 years ago
8

Add the following 2's complement binary numbers. Also express the answer in decimal. a. 01+ 1011b. 11+ 01010101c. 0101+ 110d. 01

+10
Computers and Technology
1 answer:
kenny6666 [7]2 years ago
7 0

Answer:

(a) 01 + 1011

Convert the two numbers into their 4-bit representation.

=> 01 = 0001

=> 1011

Addition of the two numbers (in their 2's complement form) gives the following:

0 0 0 1       ------------------> + 1 (in decimal)

<u>1  0 1  1 </u>      ------------------> - 5 (in decimal)

<u>1  1  0 0 </u>    -------------------> - 4 (in decimal)

Explanation for (a)

<em>01 or 0001</em>

Since the most significant bit is 0 (leftmost bit), it shows that it is a positive number. Therefore, it can be directly converted to its decimal representation as follows:

0001 = 0 x 2^{3} + 0 x 2^{2} + 0 x 2^{1} + 1 x 2^{0} = 1

0001 is + 1 in decimal.

<em>1011</em>

Its most significant bit(MSB) is 1 showing that it is negative.

Flipping all its bits and adding 1 to the result, will convert it to it's positive counterpart.

i.e 1011 => 0100 + 1 = 0101.

Converting the result (0101) to decimal gives

0101 = 0 x 2^{3} + 1 x 2^{2} + 0 x 2^{1} + 1 x 2^{0} = 5

1011 is -5 in decimal

<em>01 + 1011 or 0001+ 1011 = 1100</em>

The result (1100), of the addition of the two numbers, is a negative number as the MSB is 1.

Convert it to it's positive counterpart.

i.e 1100 => 0011 + 1 = 0100.

Converting the result (0100) to decimal gives

0100 = 0 x 2^{3} + 1 x 2^{2} + 0 x 2^{1} + 0 x 2^{0} = 4

Therefore, the result, 1100 is -4 in decimal.

===================================================

(b) 11 + 01010101

Convert the two numbers into their 8-bit representation since one of them is in 8-bit.

PS: Taking 11, its MSB is 1 showing that it is a negative number. Also, it's 8-bit representation will mean pre-padding it with ones(1s) rather than zeros as follows. In other words, pre-padding a 2's complement  number is done using its sign bit.

=> 11 = 11111111

=> 01010101

Addition of the two numbers (in their 2's complement form) gives the following:

  1  1  1  1  1  1  1  1       ------------------> - 1 (in decimal)

<u>   0 1  0 1  0  1 0 1 </u>      ------------------> + 85 (in decimal)

<u>1 0 1  0 1  0  1 0 0</u>    ------------------->  + 84 (in decimal)

Discard the carry-out bit (1) making the result 01010100

Explanation for (b)

<em>11 or 11111111</em>

Its MSB is 1 showing that it is negative.

Convert it to it's positive counterpart.

11111111 => 00000000 + 1 = 00000001

Converting the result (00000001) to decimal gives 1

11 or 11111111 is  - 1 in decimal.

<em>01010101</em>

Its MSB is 0 showing that it is also positive. Now, convert to decimal

01010101 = 85

01010101 is + 85 in decimal.

<em>11111111 + 01010101 = 01010100</em>

The result (01010100), is also positive as the MSB is 0. Now, convert to decimal.

01010100 = 84

Therefore the result (01010100) is + 84 in decimal.

===================================================

(c) 0101 + 110

Convert the two numbers into their 4-bit representations.

=> 0101 = 0101

=> 110 = 1110

Addition of the two numbers (in their 2's complement form) gives the following:

     0 1 0 1       ------------------> + 5 (in decimal)

<u>      1  1 1  0 </u>      -----------------> - 2 (in decimal)

<u>   1 0 0 1  1 </u>    -------------------> + 3 (in decimal)

Dicard the carry-out bit (leftmost bit) to get 0011 as result.

Explanation for (c)

<em>0101</em>

Since the MSB is 0 (leftmost bit), it shows that it is a positive number. Now, convert to decimal.

0101 =  5

0101 is +5 in decimal.

<em>110 or 1110</em>

Its MSB is 1 showing that it is negative.

Convert it to it's positive counterpart.

i.e 1110 => 0001 + 1 = 0010.

Converting the result (0010) to decimal gives

0010 =  2

1110 is -2 in decimal

<em>0101 + 110 = 0101+ 1110 = 0011</em>

The result (0011), is a positive number as the MSB is 0.

Converting the result (0011) to decimal gives

0011 = 3

Therefore, the result, 0011 is 3 in decimal.

===================================================

(d) 01 + 10

Convert the two numbers into their 4-bit representation.

=> 01 = 0001

=> 10 = 1110

Addition of the two numbers (in their 2's complement form) gives the following:

0 0 0 1       ------------------> + 1 (in decimal)

<u>1  1  1  0 </u>      ------------------> - 2 (in decimal)

<u>1  1  1  1 </u>    -------------------> - 1 (in decimal)

Explanation for (d)

<em>01 or 0001</em>

Since the MSB is 0 (leftmost bit), it shows that it is a positive number. Now convert to decimal.

0001 = 1

0001 is + 1 in decimal.

<em>1110</em>

Its MSB is 1 showing that it is negative.

Convert it to it's positive counterpart.

i.e 1110 => 0001 + 1 = 0010.

Converting the result (0010) to decimal gives

0010  = 2

1110 is -2 in decimal

<em>01 + 1011 or 0001+ 1110 = 1111</em>

The result (1111), is a negative number as the MSB is 1.

Convert it to it's positive counterpart.

i.e 1111 => 0000 + 1 = 0001.

Converting the result (0001) to decimal gives

0001 = 1

Therefore, the result, 1111 is -1 in decimal.

You might be interested in
Write a class named Employee that has private data members for an employee's name, ID_number, salary, and email_address. It shou
mario62 [17]

Solution :

class Employee:

   #Define the

   #constructor.

   def __$\text{init}$__($\text{self, nam}e$,  ID_number, $\text{salary}$, email):

       #Set the values of

       #the data members of the class.

       $\text{self.nam}e$ = name

       $\text{self.ID}$_number = ID_number

       $\text{self.salary}$ = salary

       self.email_address = email

#Define the function

#make_employee_dict().

def make_employee_dict(list_names, list_ID, list_salary, list_email):

   #Define the dictionary

   #to store the results.

   employee_dict = {}

   #Store the length

   #of the list.

   list_len = len(list_ID)

   #Run the loop to

   #traverse the list.

   for i in range(list_len):

       #Access the lists to

       #get the required details.

       name = list_names[i]

       id_num = list_ID[i]

       salary = list_salary[i]

       email = list_email[i]

       #Define the employee

       #object and store

       #it in the dictionary.

       employee_dict[id_num] = Employee(name, id_num, salary, email)

   #Return the

   #resultant dictionary.

   return employee_dict

6 0
1 year ago
BlockPy: #35.2) Animal Splits Write a function all_cats that consumes a comma-separated string of animals and prints whether all
maks197457 [2]

Answer:

def all_cats(data):

 dataArray = data.split(',')

 if(data==""):

   return True

 for i in dataArray:

   if('cat' not in i):

     return False

 

 return True

print(all_cats("gerbil,catfish,dog,cat"))

print(all_cats("cat,catfish"))

print(all_cats(""))

Explanation:

Step 1: define de function and the parameters

def all_cats(data):

Step 2: split the data by ,

dataArray = data.split(',')

Step 3 : validate if is an empty data and return true

if(data==""):

   return True

Step 4: Loop over de array data and validate if have cat in each data if not, then return false

for i in dataArray:

   if('cat' not in i):

     return False

Step 5 if have cat in each one return true

return True

Step 6 Validate with examples

print(all_cats("gerbil,catfish,dog,cat"))

print(all_cats("cat,catfish"))

print(all_cats(""))

6 0
1 year ago
Which sources could provide reliable evidence for your claim? Check all that apply. a step-by-step guide listed at www.gettingto
kozerog [31]
The correct answer is:
<span>an article from the New York Times</span>a book by an educational researcher and  professor<span>a report from the US Department of Education at www.ed.gov</span>
7 0
1 year ago
Read 2 more answers
Every employee of your company has a Google account. Your operational team needs to manage a large number of instances on Comput
Blizzard [7]

Answer:

Generate the fresh set of SSH keys. Offer every member of the team that private key. Customize the public key as a public SSH key for a project in the Cloud Platform project as well as require public SSH keys for each instance

Explanation:

Almost many person seems to have a google profile at their corporation. The vast amount of incidents on Compute Machine have to be handled by the operating staff. Any team member just requires operational accessibility towards the network. The safety department needs to ensure that credentials are distributed in such an administratively efficient way and have to be prepared to recognize that has accessed the specified case.

So, they are creating the latest key set for SSH. Offer every members of the team their private key. Customize its public key as just a public SSH key for such a program in the Cloud Platform project as well as require public SSH keys for each instance.

7 0
2 years ago
Which of the following corresponds to the computer interface technology that uses icon, etc?
Aleksandr [31]

Answer:

D) GUI

Explanation:

GUI an acronym for Graphical user interface, is a type of user interface where a user interacts with a computer or an electronic device through the use of graphics. These graphics include icons, images, navigation bars etc.

GUIs use a combination of technologies and devices to create a layout that users can interact with and perform tasks on. This makes it easier for users who do have basic computer skills to utilize.

The most common combination of these elements is the windows, icons, menus and pointer paradigm (WIMP) . GUIs are used in mobile devices, gaming devices, smartphones, MP3 players etc.

6 0
1 year ago
Other questions:
  • bill and melinda have two young children ages 2 and 4 and they are not covered under any life insurance policy. Melinda is full
    8·1 answer
  • The Web can play a significant role in making large amounts of information available to decision makers. Decision makers must be
    10·1 answer
  • Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i
    8·1 answer
  • Write a method for the Customer class that that will return a string representing a bill notice when passed a double value repre
    14·1 answer
  • int decode2(int x, int y, int z); is compiled into 32bit x86 assembly code. The body of the code is as follows: NOTE: x at %ebp+
    5·1 answer
  • Write an expression to print each price in stock prices.
    15·1 answer
  • In order to avoid slipping in the shop, your footwear should ___________.
    10·1 answer
  • Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
    5·1 answer
  • An online retailer is looking to implement an enterprise platform. Which component of the enterprise platform will help the comp
    8·1 answer
  • George has to present the goals of information management to his team member. What is a goal of information management? The goal
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!