0% found this document useful (0 votes)
43 views13 pages

CAO Mid

Uploaded by

akanksha hatale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views13 pages

CAO Mid

Uploaded by

akanksha hatale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

CAO mid- semester Answer sheet

1. Explain the functions of ALU?

Arithmetic Logic Unit (ALU): -


The ALU is responsible for performing arithmetic and logic operations within the CPU. It is
the part of the processor that actually carries out calculations and logical comparisons.

Functions of the Arithmetic Logic Unit (ALU): -

1. Arithmetic Operations: The ALU performs basic arithmetic operations like addition,
subtraction, multiplication, and division, which are essential for calculations in various
applications.
2. Logical Operations: It executes logical operations (AND, OR, XOR, NOT) that allow the
CPU to make decisions based on conditions, enabling complex program logic.
3. Shift Operations: The ALU shifts bits to the left or right within binary numbers, which aids
in efficient data manipulation and helps perform tasks like multiplication and division by
powers of two.
4. Comparison Operations: It compares values to determine conditions (greater than, less than,
equal to), enabling decision-making and branching in program execution.

2. Briefly explain the following representation:


i. Sign magnitude
ii. 2’s complement

Sign Magnitude Representation: -

 In Sign Magnitude representation, the leftmost bit (most significant bit) indicates the sign of
the number: 0 for positive and 1 for negative.
 The remaining bits represent the magnitude (absolute value) of the number.
 For example, in an 8-bit system:
o +5 would be represented as 0000 0101
o -5 would be represented as 1000 0101
 Advantages: Simple to understand and directly represents positive and negative values.
 Limitations: Arithmetic operations (like addition) are complex to perform due to the need to
account for both sign and magnitude separately.

2’s Complement Representation: -

 2’s Complement is a binary system used for representing both positive and negative integers
in a straightforward manner.
 To represent a negative number, invert all bits of its positive counterpart (1’s complement)
and then add 1 to the result.
 For example, in an 8-bit system:
o +5 is 0000 0101
o -5 (2’s complement of +5) is 1111 1011
 Benefits: Simplifies arithmetic operations (especially addition and subtraction) because there
is no need for separate sign handling. Negative values are seamlessly integrated into binary
arithmetic.
 Range: In an n-bit system, 2’s complement can represent values from -2^(n-1) to 2^(n-1) - 1.

3. What are the four essential elements of a number in a floating point


notation?

Four Essential Elements of Floating Point Notation: -

1. Sign Bit:
o Indicates whether the number is positive or negative.
o Typically, 0 represents a positive number, and 1 represents a negative number.

2. Mantissa (or Significand):


o Represents the significant digits of the number.
o Usually normalized to maximize precision, with an implicit leading 1 in binary
floating-point formats (e.g., IEEE 754).

3. Exponent:
o Represents the power to which the base (usually 2 in binary systems) is raised.
o Allows the number to represent a wide range of values by adjusting the scale of
the mantissa.

4. Base (or Radix):


o The foundation of the numbering system, usually 2 for binary systems.
o Defines the scale and influences the range of representable numbers .

4. Given x=1011 and y=1001 in 2’s complement i.e (x=-5) and (y=-1) draw and
compute the product p=xy with booth algorithm and flowchart?

To compute the product p=x⋅yp = x \cdot yp=x⋅y where x=−5x = -5x=−5 and y=−1y = -1y=−1 in 2's
complement, we'll follow Booth's Multiplication Algorithm for binary numbers. Here’s the solution along
with the step-by-step algorithm and a flowchart.

1. Representation of x and y in 4-bit 2's complement:

 x=−5x = -5x=−5: 101110111011


 y=−1y = -1y=−1: 100110011001

2. Booth's Multiplication Algorithm Steps

For Booth’s Algorithm, we need:

 Accumulator (A): Starts as 0000 (4-bit representation).


 Multiplier Register (Q): Holds yyy (1001 for -1).
 Multiplier Bit (Q-1): Initialized to 0.
 n: Number of bits (4 here for 4-bit numbers).

The steps are:

1. Check the last two bits (Q0 and Q-1):


o If Q0Q_0Q0 = 1 and Q−1Q_{-1}Q−1 = 0, subtract x from A and perform an arithmetic right
shift.
o If Q0Q_0Q0 = 0 and Q−1Q_{-1}Q−1 = 1, add x to A and perform an arithmetic right shift.
o If Q0Q_0Q0 and Q−1Q_{-1}Q−1 are the same, just perform an arithmetic right shift.

2. Repeat the steps n times.

Step-by-Step Calculation

Let’s apply Booth’s Algorithm on x=1011x = 1011x=1011 and y=1001y = 1001y=1001:

Initial Values:

 A=0000A = 0000A=0000
 Q=1001Q = 1001Q=1001
 Q−1=0Q_{-1} = 0Q−1=0
 x=1011x = 1011x=1011 (i.e., -5)

Iteration 1

 Q0 Q-1 = 1 0: Subtract xxx from AAA (i.e., A=A−xA = A - xA=A−x)


o A=0000−1011=0101A = 0000 - 1011 = 0101A=0000−1011=0101 (binary addition)
 Right Shift: A=0101A = 0101A=0101, Q=1100Q = 1100Q=1100

Iteration 2

 Q0 Q-1 = 0 0: Perform an arithmetic right shift.


o Right Shift: A=0010A = 0010A=0010, Q=1110Q = 1110Q=1110

Iteration 3

 Q0 Q-1 = 1 1: Perform an arithmetic right shift.


o Right Shift: A=0001A = 0001A=0001, Q=1111Q = 1111Q=1111

Iteration 4

 Q0 Q-1 = 1 1: Perform an arithmetic right shift.


o Right Shift: A=0000A = 0000A=0000, Q=1111Q = 1111Q=1111

Final Product:

The result A Q=1111A \, Q = 1111AQ=1111, which is -5 in 2's complement, confirming that −5×−1=−5-5 \
times -1 = -5−5×−1=−5.

Flowchart for Booth’s Algorithm: -

1. Start with A=0A = 0A=0, Q=yQ = yQ=y, Q−1=0Q_{-1} = 0Q−1=0, and load xxx.
2. Check Q0Q_0Q0 and Q−1Q_{-1}Q−1:
o If Q0=1Q_0 = 1Q0=1 and Q−1=0Q_{-1} = 0Q−1=0, subtract xxx from AAA.
o If Q0=0Q_0 = 0Q0=0 and Q−1=1Q_{-1} = 1Q−1=1, add xxx to AAA.
3. Perform Right Shift on A,Q,Q−1A, Q, Q_{-1}A,Q,Q−1.
4. Repeat steps 2-3 for nnn times.
5. End with A QA \, QAQ as the final product in 2’s complement form.

5. Show how the following floating point additions are perform (where
significant and mantisa are tracked to four decimal digit) show the result in
normalized form:
i. 5.566*10^2*7.777*10^3
ii. 3.344*10^1+8.877*10^-2
iii. 6.21*10^5/8.877*10^-1

To perform the floating point operations while tracking the significands (mantissas) to four decimal
digits and showing the results in normalized form, we will follow these steps for each operation:

1. For multiplication: Multiply the significands and add the exponents.


2. For addition: Align the exponents, then add the significands.
3. For division: Divide the significands and subtract the exponents.

i. 5.566×102×7.777×1035.566 \times 10^2 \times 7.777 \times 10^35.566×102×7.777×103

1. Multiply the significands: 5.566×7.777=43.347962≈43.348(rounded to four digits)5.566 \times


7.777 = 43.347962 \approx 43.348 \quad (\text{rounded to four
digits})5.566×7.777=43.347962≈43.348(rounded to four digits)
2. Add the exponents: 102×103=102+3=10510^2 \times 10^3 = 10^{2+3} =
10^5102×103=102+3=105
3. Result in normalized form: 43.348×105(not normalized)43.348 \times 10^5 \quad \text{(not
normalized)}43.348×105(not normalized) Normalize: 4.3348×1064.3348 \times 10^64.3348×106

ii. 3.344×101+8.877×10−23.344 \times 10^1 + 8.877 \times 10^{-2}3.344×101+8.877×10−2

1. Align the exponents: 3.344×101=3.344×1013.344 \times 10^1 = 3.344 \times


10^13.344×101=3.344×101 8.877×10−2=0.08877×1018.877 \times 10^{-2} = 0.08877 \times
10^18.877×10−2=0.08877×101
2. Add the significands: 3.344+0.08877=3.43277≈3.4328(rounded to four digits)3.344 + 0.08877 =
3.43277 \approx 3.4328 \quad (\text{rounded to four
digits})3.344+0.08877=3.43277≈3.4328(rounded to four digits)
3. Result in normalized form: 3.4328×1013.4328 \times 10^13.4328×101

iii. 6.21×1058.877×10−1\frac{6.21 \times 10^5}{8.877 \times 10^{-1}}8.877×10−16.21×105

1. Divide the significands: 6.218.877=0.6995(rounded to four digits)\frac{6.21}{8.877} = 0.6995 \


quad (\text{rounded to four digits})8.8776.21=0.6995(rounded to four digits)
2. Subtract the exponents: 105−(−1)=105+1=10610^{5 - (-1)} = 10^{5 + 1} = 10^6105−
(−1)=105+1=106
3. Result in normalized form: 0.6995×106(not normalized)0.6995 \times 10^6 \quad \text{(not
normalized)}0.6995×106(not normalized) Normalize: 6.995×1056.995 \times 10^56.995×105

6. Convert (100.125)10 in IEEE-154 single precision floating point


representation?

To convert the decimal number (100.125)10(100.125)_{10}(100.125)10 into IEEE 754 single precision
floating-point representation, we will follow these steps:
Step 1: Convert the Decimal to Binary

1. Convert the integer part (100) to binary:


o 100÷2=50100 \div 2 = 50100÷2=50 remainder 000
o 50÷2=2550 \div 2 = 2550÷2=25 remainder 000
o 25÷2=1225 \div 2 = 1225÷2=12 remainder 111
o 12÷2=612 \div 2 = 612÷2=6 remainder 000
o 6÷2=36 \div 2 = 36÷2=3 remainder 000
o 3÷2=13 \div 2 = 13÷2=1 remainder 111
o 1÷2=01 \div 2 = 01÷2=0 remainder 111

Reading from bottom to top, (100)10=(1100100)2(100)_{10} = (1100100)_2(100)10=(1100100)2.

2. Convert the fractional part (0.125) to binary:


o 0.125×2=0.250.125 \times 2 = 0.250.125×2=0.25 (integer part: 0)
o 0.25×2=0.50.25 \times 2 = 0.50.25×2=0.5 (integer part: 0)
o 0.5×2=1.00.5 \times 2 = 1.00.5×2=1.0 (integer part: 1)

Reading the integer parts, (0.125)10=(0.001)2(0.125)_{10} = (0.001)_2(0.125)10=(0.001)2.

Combining both parts, we have:

(100.125)10=(1100100.001)2(100.125)_{10} = (1100100.001)_2(100.125)10=(1100100.001)2

Step 2: Normalize the Binary Number

To normalize the binary number, we express it in the form 1.x×2n1.x \times 2^n1.x×2n:

1100100.001 can be written as 1.100100001×261100100.001 \text{ can be written as } 1.100100001 \times


2^61100100.001 can be written as 1.100100001×26

Step 3: Determine the Sign, Exponent, and Mantissa

1. Sign bit:
o Since the number is positive, the sign bit is 000.

2. Exponent:
o The exponent in the normalized form is 666.
o IEEE 754 single precision uses a bias of 127127127:

Exponent=6+127=133\text{Exponent} = 6 + 127 = 133Exponent=6+127=133

o Convert 133133133 to binary:

133÷2=66 remainder 166÷2=33 remainder 033÷2=16 remainder 116÷2=8 remainder 08÷2=4 remain
der 04÷2=2 remainder 02÷2=1 remainder 01÷2=0 remainder 1133 \div 2 = 66 \text{ remainder } 1 \\
66 \div 2 = 33 \text{ remainder } 0 \\ 33 \div 2 = 16 \text{ remainder } 1 \\ 16 \div 2 = 8 \
text{ remainder } 0 \\ 8 \div 2 = 4 \text{ remainder } 0 \\ 4 \div 2 = 2 \text{ remainder } 0 \\ 2 \div 2
= 1 \text{ remainder } 0 \\ 1 \div 2 = 0 \text{ remainder }
1133÷2=66 remainder 166÷2=33 remainder 033÷2=16 remainder 116÷2=8 remainder 08÷2=4 remai
nder 04÷2=2 remainder 02÷2=1 remainder 01÷2=0 remainder 1

Reading from bottom to top, 13310=100001012133_{10} = 10000101_213310=100001012.


3. Mantissa:
o The mantissa is formed from the digits following the binary point in the normalized form.
o We take the first 23 bits after the leading 1:

100100001000000000000001001000010000000000000010010000100000000000000

Step 4: Assemble the IEEE 754 Representation

Putting it all together, we have:

 Sign bit: 000


 Exponent: 100001011000010110000101
 Mantissa: 100100001000000000000001001000010000000000000010010000100000000000000

The final IEEE 754 single precision representation is:

IEEE 754=0 ∣ 10000101 ∣ 10010000100000000000000\text{IEEE 754} = 0 \ | \ 10000101 \ | \


10010000100000000000000IEEE 754=0 ∣ 10000101 ∣ 10010000100000000000000

Final Result

Thus, the IEEE 754 single precision floating-point representation of (100.125)10(100.125)_{10}


(100.125)10 is:

01000010110010000100000000000000\boxed{0 10000101
10010000100000000000000}01000010110010000100000000000000

Or, in a more compact format:

01000010110010000100000000000000\
boxed{01000010110010000100000000000000}01000010110010000100000000000000
7. Sketch and explain flowchart for multiplication for floating point numbers?

Creating a flowchart for multiplying floating point numbers involves breaking down the steps required to
perform the multiplication while adhering to the IEEE 754 floating-point standard. Below is an explanation
of each step along with a textual representation of a flowchart.

Steps for Multiplying Floating Point Numbers

1. Input: Read two floating-point numbers in IEEE 754 format. Each number consists of a sign bit, an
exponent, and a mantissa.
2. Extract Components:
o Extract the sign bits, exponents, and mantissas from both numbers.
o The sign is typically represented by S1S_1S1 and S2S_2S2, the exponent by E1E_1E1 and
E2E_2E2, and the mantissa by M1M_1M1 and M2M_2M2.

3. Determine the Sign of the Result:


o The sign of the result is determined by the XOR of the two sign bits: Sresult=S1⊕S2S_{\
text{result}} = S_1 \oplus S_2Sresult=S1⊕S2

4. Add the Exponents:


o Add the exponents together and account for the bias (127 for single precision):
Eresult=(E1+E2)−biasE_{\text{result}} = (E_1 + E_2) - \text{bias}Eresult=(E1+E2)−bias
5. Multiply the Mantissas:
o Multiply the mantissas together: Mresult=M1×M2M_{\text{result}} = M_1 \times
M_2Mresult=M1×M2

6. Normalization:
o Normalize the result if necessary. This involves adjusting the mantissa so that it is in the form
1.x1.x1.x, and updating the exponent accordingly.

7. Check for Overflow or Underflow:


o Check if the exponent is too large (overflow) or too small (underflow). Adjust the result
accordingly.

8. Round the Result:


o Round the mantissa to fit the precision limits (23 bits for single precision).

9. Output: Combine the sign, exponent, and mantissa to form the final result in IEEE 754 format.

Textual Flowchart Representation

Here's a textual representation of the flowchart steps:

csharp
Copy code
[Start]
|
v
[Input: Read two floating point numbers (A, B)]
|
v
[Extract sign, exponent, and mantissa]
|
v
[Determine sign of result]
|
v
[Add exponents]
|
v
[Multiply mantissas]
|
v
[Normalize the result]
|
v
[Check for overflow/underflow]
|
v
[Round the result]
|
v
[Output final result in IEEE 754 format]
|
v
[End]
Flowchart Explanation

1. Start: The process begins.


2. Input: Two floating-point numbers are inputted.
3. Extract Components: The sign, exponent, and mantissa of both numbers are extracted.
4. Determine Sign: The result's sign is calculated using the XOR of the two sign bits.
5. Add Exponents: The exponents are added together, and the bias is subtracted.
6. Multiply Mantissas: The mantissas are multiplied together.
7. Normalization: The result is normalized to ensure it fits the required format.
8. Check for Overflow/Underflow: The exponent is checked to ensure it is within the allowed range.
9. Round the Result: The mantissa is rounded as needed to fit within the precision limits.
10. Output: The final result is constructed in IEEE 754 format and outputted.
11. End: The process concludes.

8. Explain integer representation in details

Integer representation in computer systems is fundamental for data storage, processing, and
computational tasks. This representation can be categorized primarily into binary, octal, decimal, and
hexadecimal systems, with binary being the most prevalent in computing. Below, we will delve into the
various aspects of integer representation, focusing on binary representation, its types, and the significance of
signed and unsigned integers.

1. Binary Representation

Computers use the binary number system, which consists of only two digits: 0 and 1. Each binary digit (bit)
represents a power of two, allowing the representation of integers in a compact and efficient manner.

Binary Basics

 A binary number is read from right to left, where each bit represents 2n2^n2n, with nnn starting at 0.
 For example, the binary number 101121011_210112 represents:
1×23+0×22+1×21+1×20=8+0+2+1=11101 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0 =
8 + 0 + 2 + 1 = 11_{10}1×23+0×22+1×21+1×20=8+0+2+1=1110

2. Signed vs. Unsigned Integers

Unsigned Integers

 Unsigned integers can only represent non-negative values (0 and positive integers).
 For an nnn-bit unsigned integer, the range of values is from 000 to 2n−12^n - 12n−1.
o Example: For an 8-bit unsigned integer, the range is 000 to 255255255 (i.e., 28−12^8 -
128−1).

Signed Integers

 Signed integers can represent both negative and positive values.


 The most common methods for representing signed integers are:
o Sign-Magnitude Representation
o Two's Complement Representation
Sign-Magnitude Representation

 The first bit (most significant bit, MSB) represents the sign of the integer (0 for positive, 1 for
negative), while the remaining bits represent the magnitude.
 Example: In an 8-bit system:
o 000001010000010100000101 represents +5+5+5
o 100001011000010110000101 represents −5-5−5

Limitations: This method has two representations for zero: +0+0+0 (00000000) and −0-0−0 (10000000),
which can lead to complications.

Two's Complement Representation

 Two's complement is the most widely used method for representing signed integers in computers.
 The MSB still indicates the sign (0 for positive, 1 for negative), but negative values are represented
by inverting all bits of the absolute value (the positive version) and then adding 1 to the result.
 Range: For an nnn-bit signed integer, the range is from −2n−1-2^{n-1}−2n−1 to 2n−1−12^{n-1} -
12n−1−1.
o Example: In an 8-bit system, the range is from −128-128−128 to 127127127.

Example of Two's Complement:

 To find −5-5−5:
1. Start with +5+5+5: 000001010000010100000101
2. Invert the bits: 111110101111101011111010
3. Add 111: 11111010+00000001=1111101111111010 + 00000001 =
1111101111111010+00000001=11111011

3. Conversion Between Bases

To work with integers in different bases (like binary, decimal, octal, or hexadecimal), conversions are
essential:

Decimal to Binary

1. Divide the decimal number by 2.


2. Record the remainder.
3. Continue dividing the quotient by 2 until the quotient is 0.
4. The binary representation is the remainders read in reverse order.

Binary to Decimal

1. Multiply each bit by 2n2^n2n based on its position and sum the results.

Octal and Hexadecimal

 Octal uses base 8 and can be converted from binary by grouping bits in sets of three (e.g.,
000000000 = 0, 001001001 = 1, ..., 111111111 = 7).
 Hexadecimal uses base 16 and can be converted from binary by grouping bits in sets of four (e.g.,
000000000000 = 0, 000100010001 = 1, ..., 111111111111 = F).

4. Applications of Integer Representation

 Data Storage: Integers are used for counting, indexing, and as identifiers in databases.
 Mathematical Operations: They are the basis for arithmetic operations in programming and
computer algorithms.
 Control Structures: Integer values are commonly used in loops and conditional statements in
programming.

9. Subtract (11011)2 – (10011)2 using 1’s complement and 2’s complement

To perform the subtraction (11011)2−(10011)2(11011)_2 - (10011)_2(11011)2−(10011)2 using both 1's


complement and 2's complement, we need to follow specific procedures for each method. Let's go through
both methods step by step.

1. Subtraction Using 1's Complement

Step 1: Find the 1's Complement of the Subtrahend

The subtrahend is (10011)2(10011)_2(10011)2. To find its 1's complement, we invert each bit.

 1→01 \rightarrow 01→0


 0→10 \rightarrow 10→1

So, the 1's complement of (10011)2(10011)_2(10011)2 is:

(01100)2(01100)_2(01100)2
Step 2: Add the Minuend and the 1's Complement of the Subtrahend

Now we add (11011)2(11011)_2(11011)2 and (01100)2(01100)_2(01100)2.

markdown
Copy code
11011
+ 01100
-------
001111
Step 3: Handle the Carry

If there is a carry-out (which there is), we add it back to the result:

markdown
Copy code
001111
+ 1 (carry)
-------
010000
Step 4: Final Result

The result of the addition is (01000)2(01000)_2(01000)2. This represents the positive binary result of the
subtraction. The final result can be interpreted as:

(01000)2=(8)10(01000)_2 = (8)_{10}(01000)2=(8)10

2. Subtraction Using 2's Complement


Step 1: Find the 2's Complement of the Subtrahend

To find the 2's complement of (10011)2(10011)_2(10011)2, we first find its 1's complement and then add
111.

1. Find the 1's complement:


o (10011)2(10011)_2(10011)2 becomes (01100)2(01100)_2(01100)2.

2. Now, add 111 to the 1's complement:

markdown
Copy code
01100
+ 00001
-------
01101

So, the 2's complement of (10011)2(10011)_2(10011)2 is:

(01101)2(01101)_2(01101)2
Step 2: Add the Minuend and the 2's Complement of the Subtrahend

Now, we add (11011)2(11011)_2(11011)2 and (01101)2(01101)_2(01101)2:

markdown
Copy code
11011
+ 01101
-------
101000
Step 3: Handle the Carry

In 2's complement, if there is a carry out of the most significant bit, it is ignored. Thus:

 The result is (01000)2(01000)_2(01000)2 after ignoring the carry.

Step 4: Final Result

The result is the same as with the 1's complement method:

(01000)2=(8)10(01000)_2 = (8)_{10}(01000)2=(8)10
10. Represent the decimal values 12-10 and 15 assign 8 bit numbers in following binary formats:
i. Sign magnitude
ii. 1’s complement
iii. 2’s complement

To represent the decimal values 121012_{10}1210, 101010_{10}1010, and 151015_{10}1510 in 8-bit


binary formats (sign magnitude, 1's complement, and 2's complement), we will follow the conventions for
each representation type. We will represent both positive and negative values as needed.

i. Sign Magnitude Representation

In sign magnitude representation, the most significant bit (MSB) is used as the sign bit, where 0 indicates a
positive number and 1 indicates a negative number. The remaining bits represent the magnitude.
1. Decimal 12:
o Binary: 000011000000110000001100 (Sign bit = 0, Magnitude = 12)

2. Decimal -10:
o Positive 10 in binary: 000010100000101000001010
o Sign bit: 1 (indicating negative)
o Result: 100010101000101010001010

3. Decimal 15:
o Binary: 000011110000111100001111 (Sign bit = 0, Magnitude = 15)

Summary for Sign Magnitude

 121212 → 000011000000110000001100
 −10-10−10 → 100010101000101010001010
 151515 → 000011110000111100001111

ii. 1's Complement Representation

In 1's complement representation, the MSB is the sign bit. To get the negative representation, we invert all
bits of the positive representation.

1. Decimal 12:
o Binary: 000011000000110000001100

2. Decimal -10:
o Positive 10 in binary: 000010100000101000001010
o 1's complement (invert bits): 111101011111010111110101

3. Decimal 15:
o Binary: 000011110000111100001111

Summary for 1's Complement

 121212 → 000011000000110000001100
 −10-10−10 → 111101011111010111110101
 151515 → 000011110000111100001111

iii. 2's Complement Representation

In 2's complement representation, the MSB is also the sign bit. To get the negative representation, we take
the 1's complement and add 1.

1. Decimal 12:
o Binary: 000011000000110000001100

2. Decimal -10:
o Positive 10 in binary: 000010100000101000001010
o 1's complement: 111101011111010111110101 (invert bits)
o Add 1:
Copy code
11110101
 Copy code
 1

11110110

You might also like