1answer.
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
masya89 [10]
2 years ago
8

Find the word-length 2's complement representation of each of the following decimal numbers:a. 845b. 15000c. 100d. -923

Computers and Technology
2 answers:
Norma-Jean [14]2 years ago
8 0

Answer:

Using 32bits.

a:0000 0000 0000 0000 0000 0011 0100 1101

b:0000 0000 0000 0000 0011 1010 1001 1000

c:0000 0000 0000 0000 0000 0000 0110 0100

d:1111 1111 1111 1111 1111 1100 0110 0101

Explanation:

Conversion to Two's Complement

The 2's complement system is commonly used for signed integer representation on computers.  The 2's complement operation is done by inverting the binary digits of an integer and then adding one.

For the purpose of explanation lets make use of a negative number for clarity. In this case lets use -923.

Note that the use of 32bits for this question is objective, you can use a range of bits for this operation. this question can go as low as 16bits and as high as 64bits depending on application and specification.

For Example:

we have -923, and want to represent it in 2's complement, you take the binary representation of positive 923:

0000 0000 0000 0000 0000 0011 1001 1011

Invert the digits.

1111 1111 1111 1111 1111 1100 0110 0100

And add one.

1111 1111 1111 1111 1111 1100 0110 0100 + 1

=

1111 1111 1111 1111 1111 1100 0110 0101

(The Binary 2's complement representation of -923)

tino4ka555 [31]2 years ago
3 0

Answer:

(a) 845 = 0000 0011 0100 1101

(b) 1500 = 0011 1010 1001 1000

(c) 100 = 0000 0000 0110 0100

(d) -923 = 1111 1100 0110 0101

Explanation:

<u>NOTES:</u>

<em>First Note: The question requests that the numbers be represented in word-length. That means they should be represented in 16bits (a word is 2 bytes).</em>

<em>Second Note: To convert a number to its 2's complement representation,</em>

<em>(i) if the number is positive, the usual conversion to binary will suffice. You might just need to add zero at the beginning of the sequence of bits to ensure that the leftmost bit is a zero(0).</em>

<em>(ii) if the number is negative, then;</em>

<em>=> convert the magnitude of the number to its binary</em>

<em>=> add zeros to the beginning of the sequence of binary until the sequence has the specified length</em>

<em>=> flip each bit in the sequence and add 1 to the result.</em>

<u>SOLUTION:</u>

Applying the rules in the notes above, lets convert the numbers.

(a) 845 => The number is positive, conversion to its binary will suffice

<u>2  |  845</u>

<u>2  |  422 R 1</u>

<u>2  |  211 R 0</u>

<u>2  |  105 R 1</u>

<u>2  |  52 R 1</u>

<u>2  |  26 R 0</u>

<u>2  |  13 R 0</u>

<u>2  |  6 R 1</u>

<u>2  |  3 R 0</u>

<u>2  |  1 R 1</u>

<u>2  |  0 R 1</u>

Writing the remainders upwards, we have

845 = 1101001101

Pad with zeros to convert it to its word-length representation.

845 = 0000 0011 0100 1101

(b) 15000 => The number is also positive, so following the same step as above,

15000 = 11101010011000

Pad with zeros to convert it to its word-length representation.

15000 = 0011 1010 1001 1000

(c) 100 => The number is also positive, so following the same step as above,

100 = 1100100

Pad with zeros to convert it to its word-length representation.

100 =  0000 0000 0110 0100

(d) -923 => The number is negative;

-->  first convert its magnitude (923) to binary

923 = 1110011011

--> Pad with zeros to convert it to its word-length representation.

923 =  0000 0011 1001 1011

--> Flip the bits

0000 0011 1001 1011 = 1111 1100 0110 0100

--> Add 1 to the result above

1111 1100 0110 0100 + 1 = 1111 1100 0110 0101

Therefore;

-923 = 1111 1100 0110 0101

You might be interested in
Write two sentences but each one having either computer in it or technology in it. You can use a word more than once in a senten
Ksju [112]

Answer:

Sentences:

1.My computer has a virus

2.Technology may take over the world someday

Explanation:

7 0
2 years ago
Read 2 more answers
Write a program that prompts the user for an integer, then asks the user to enter that many values. Store these values in an arr
Svetllana [295]

Answer:

//The Scanner class is imported to allow the program receive user input

import java.util.Scanner;

//The class Solution is defined

public class Solution {

   //The main method is defined here and signify the beginning of program execution

   public static void main(String args[]) {

       

       //Scanner object 'scan' is created to receive user input

       Scanner scan = new Scanner(System.in);

       //Prompt display to the user to enter size of array

       System.out.print("Enter the range of array: ");

       //User input is assigned to arraySize

       int arraySize = scan.nextInt();

       //userArray is initialized with arraySize as its size

       int[] userArray = new int[arraySize];

       

       //counter to count number of array element

       int count = 0;

       //while loop which continue executing till the user finish entering the array element

       while (count < arraySize){

           System.out.print("Enter each element of the array: ");

           userArray[count] = scan.nextInt();

           count++;

       }

       

       //A blank line is printed for clarity

       System.out.println();

       

       //for loop to print each element of the array on straight line

       for(int i =0; i <userArray.length; i++){

           System.out.print(userArray[i] + " ");

       }

       

       //A blank line is printed for clarity

       System.out.println();

       

       //for loop is use to reverse the array in-place

       for(int i=0; i<userArray.length/2; i++){

           int temp = userArray[i];

           userArray[i] = userArray[userArray.length -i -1];

           userArray[userArray.length -i -1] = temp;

       }

       

       //for loop to print each element of the reversed array on straight line

       for(int i =0; i <userArray.length; i++){

           System.out.print(userArray[i] + " ");

       }

     

   }

}

Explanation:

The program is commented to give detailed explanation.

The for-loop use in reversing the array works by first dividing the array into two half and exchanging the first half elements with the second half elements. The element from the first half is assigned to temp variable on each loop, then the element is replaced with the equivalent element from the second half. And the element from the second half is replaced with the value of temp.

3 0
3 years ago
Write 'T' for true and 'F' for false statements.
asambeis [7]
1-F
2-T
3-F
4-F
5-F
6 T
7-T
3 0
2 years ago
What is the best website to get a iphone
sveticcg [70]
Generally I'd recommend not buying one online, tends to be cheaper from a shop - and better used, although their are some risks with 2nd hand devices, I think the big price cut it worth it. 

If you did want to buy online, maybe Amazon or Ebay?
7 0
3 years ago
Read 2 more answers
What is the role of memory in a computer​
Anuta_ua [19.1K]

Answer:

Computer random access memory (RAM) is one of the most important components in determining your system's performance. RAM gives applications a place to store and access data on a short-term basis. It stores the information your computer is actively using so that it can be accessed quickly.

5 0
3 years ago
Other questions:
  • Write a pseudocode thats accept and then find out whether the number is divisible by 5 ​
    6·1 answer
  • The seven basic internal components found in a computer tower
    9·1 answer
  • Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. Promp
    10·1 answer
  • Es la actividad que posibilita comunicar gráficamente ideas, hechos y valores procesados y sintetizados en términos de forma y c
    11·1 answer
  • Take the MBTI test and research information about this tool. Several websites have different versions of the test, including www
    5·1 answer
  • Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a
    12·1 answer
  • Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.
    14·1 answer
  • Which of the following is not a component of Power BI?
    5·1 answer
  • A screen capture is a digital image of your screen, as if you took a picture of it with a camera. For instance, you might want t
    15·1 answer
  • In _________, the process requests permission to access and modify variables shared with others. a) entry section b) critical se
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!