ASANSOL INSTITUTE OF ENGINEERING AND MANAGEMENT – POLYTECHNIC
ASANSOL
Subject : Computer System Organization
Course Code : CST207
Pre Test:
UNIT-2 (Part-2)
Computer Arithmetic:
Computer arithmetic focuses on the operations of addition, subtraction, multiplication, division, and floating-point
arithmetic, performed by computers using binary numbers.
1. Addition and Subtraction :
Binary Addition
Binary addition works similar to decimal addition, but it operates with two digits, 0 and 1.
Rules for Binary Addition:
1. 0+0=0
2. 0+1=1
3. 1+0=1
4. 1 + 1 = 10 (which means 0 with a carry of 1)
Example of Binary Addition:
Let’s add two binary numbers:
1011 (11 in decimal)
1101 (13 in decimal)
1011
+ 1101
----------
11000 (24 in decimal)
Binary Subtraction
Subtraction in binary works using similar rules, but borrowing is required when subtracting a larger bit from a smaller one.
Rules for Binary Subtraction:
1. 0-0=0
2. 1-0=1
3. 1-1=0
4. 0 - 1 = 1 (with a borrow of 1 from the next higher bit)
Example of Binary Subtraction:
Let’s subtract two binary numbers:
1101 (13 in decimal)
1011 (11 in decimal)
1101
- 1011
--------
0010 (2 in decimal)
Two's Complement Method for Subtraction
To subtract numbers using two’s complement, convert the second number to its two’s complement and then add it to the
first number.
1. Find the two’s complement of the number to be subtracted (invert all bits and add 1).
2. Add the two’s complement to the first number.
Example:
Subtract 1101 from 1011 using two’s complement.
1. Find two's complement of 1101:
o Invert 1101: 0010
o Add 1: 0011 (This is the two's complement of 1101)
2. Now add:
1011
+ 0011
--------
1110
Since the most significant bit is 1, it indicates a negative result. Therefore, the result in two's complement is -2.
Floating-Point Addition and Subtraction
When adding or subtracting floating-point numbers, align the exponents first, and then add/subtract the mantissas.
Example of Floating-Point Addition:
Add 1.5 × 10^3 and 2.25 × 10^2:
1. Align the exponents: Convert 2.25 × 10^2 to 0.225 × 10^3.
2. Add the mantissas: 1.5 + 0.225 = 1.725.
3. The result is 1.725 × 10^3.
Floating-Point Multiplication and Division
For multiplication, multiply the mantissas and add the exponents. For division, divide the mantissas and subtract the
exponents.
Example of Floating-Point Multiplication:
Multiply 2.5 × 10^2 by 4.0 × 10^1:
1. Multiply mantissas: 2.5 × 4.0 = 10.0.
2. Add exponents: 2 + 1 = 3.
3. The result is 1.0 × 10^4.
Error Detection in Floating-Point Arithmetic :
Errors such as overflow, underflow, and rounding errors can occur during floating-point arithmetic due to limited precision.
Proper handling and checking of these errors are essential to maintain accuracy.
Overflow: When the result is too large to be represented.
Underflow: When the result is too small to be represented.
Rounding Errors: Due to limited precision, results are rounded, which can cause small inaccuracies.
These errors arise because floating-point numbers have limited precision due to the fixed number of bits used to represent
them.
IMPORTANT QUESTIONS
A. Multiple Choice Questions :
1. What is the result of the binary addition: 1011 + 1101?
a) 11000
b) 10100
c) 10000
d) 11110
Answer: a) 11000
2. In binary subtraction, what is the result of 1010 - 0011?
a) 0111
b) 1001
c) 0101
d) 0110
Answer: d) 0111
3. Which of the following methods is used for binary subtraction of signed numbers?
a) One’s complement
b) Two’s complement
c) Half-adder
d) Full-adder
Answer: b) Two’s complement
4. In binary arithmetic, what happens when you add 1 + 1?
a) 1 with no carry
b) 10 with a carry of 1
c) 11
d) 00
5. Which algorithm is commonly used for multiplying two binary numbers?
a) Booth's algorithm
b) Dijkstra's algorithm
c) Restoring division algorithm
d) Euclidean algorithm
Answer: a) Booth's algorithm
6. In binary multiplication, if you multiply 1010 (10 in decimal) by 0110 (6 in decimal), what is the result?
a) 00111100
b) 00111000
c) 01101000
d) 01110000
Answer: b) 00111000
7. What is the key advantage of using Booth’s multiplication algorithm?
a) It reduces the number of required operations.
b) It avoids overflow errors.
c) It ensures faster addition of binary numbers.
d) It simplifies floating-point arithmetic.
Answer: a) It reduces the number of required operations.
8. The shift-and-add method is commonly used for:
a) Division of binary numbers
b) Multiplication of binary numbers
c) Addition of floating-point numbers
d) Subtraction of binary numbers
Answer: b) Multiplication of binary numbers
9. Which algorithm is commonly used for dividing unsigned binary numbers?
a) Restoring division algorithm
b) Booth’s multiplication algorithm
c) Dijkstra’s algorithm
d) Two’s complement method
Answer: a) Restoring division algorithm
10) In binary division, if you divide 1110 (14 in decimal) by 0011 (3 in decimal), what is the quotient?
a) 0010 (2 in decimal)
b) 0100 (4 in decimal)
c) 0110 (6 in decimal)
d) 1110 (14 in decimal)
Answer: b) 0100 (4 in decimal)
11. Which of the following is an advantage of the non-restoring division algorithm over the restoring division
algorithm?
a) It avoids overflow errors.
b) It is faster and requires fewer steps.
c) It is easier to implement.
d) It works only with signed numbers.
Answer: b) It is faster and requires fewer steps.
12. What is the main difference between restoring and non-restoring division algorithms?
a) Non-restoring does not restore the dividend after a negative result.
b) Restoring requires an additional register.
c) Non-restoring algorithm works only for signed numbers.
d) Restoring algorithm is used only in floating-point division.
Answer: a) Non-restoring does not restore the dividend after a negative result.
13. Floating-point numbers in computers are typically represented using which standard?
a) ASCII
b) IEEE 754
c) Unicode
d) Gray code
Answer: b) IEEE 754
14. In floating-point representation, the value of a number is represented as:
a) Sign, Mantissa, and Exponent
b) Sign and Mantissa only
c) Mantissa and Exponent only
d) Sign, Base, and Mantissa
Answer: a) Sign, Mantissa, and Exponent
15. In IEEE 754 floating-point standard, which part determines whether the number is positive or negative?
a) Exponent
b) Mantissa
c) Sign bit
d) Bias
Answer: c) Sign bit
16. What is the main purpose of normalizing a floating-point number?
a) To adjust the exponent to zero
b) To align the mantissa with the exponent
c) To ensure a single non-zero digit before the binary point
d) To eliminate overflow errors
Answer: c) To ensure a single non-zero digit before the binary point
17. Which of the following is a valid representation of a floating-point number in IEEE 754 format?
a) -1.101 × 2^3
b) 1.0101 × 10^5
c) 10011 × 2^-4
d) 10.11 × 2^2
Answer: a) -1.101 × 2^3
18. In floating-point addition, what must be done first before adding two numbers?
a) Align the mantissas
b) Align the exponents
c) Adjust the sign bit
d) Normalize the result
Answer: b) Align the exponents
19. Which of the following is a common issue with floating-point arithmetic?
a) Division by zero
b) Overflow and underflow
c) Inconsistent data representation
d) Ambiguity in data storage
Answer: b) Overflow and underflow
20. In floating-point arithmetic, multiplying two numbers involves:
a) Adding the exponents and multiplying the mantissas
b) Adding the mantissas and subtracting the exponents
c) Subtracting the exponents and dividing the mantissas
d) Dividing both the exponents and mantissas
Answer: a) Adding the exponents and multiplying the mantissas
B. Answer the following questions :
Q1. How does binary addition work? Explain with an example.
Q2. How does binary subtraction work using two’s complement?
Q3. How does floating-point addition work? Explain with an example.
Q4. What is floating-point multiplication? Provide an example.
Q5. What are common errors in floating-point arithmetic?