MASTER OF COMPUTER APPLICATIONS
Course Code : MCS-012
Course Title : Computer Organisation and Assembly Language Programming
Assignment Number : MCA (2)/012/Assign /2014-15
Maximum Marks : 100
Weightage : 25%
Perform the following arithmetic operations :-
using binary signed 2’s complement notation for integers. You may assume that the maximum size of integers is of 9 bits including the sign bit. (Please note that the numbers given here are in decimal notation).
i) Add – 256 and 206
ii) Subtract 224 from –99
iii) Add 124 and 132
Please indicate the overflow if it occurs. Also write how you identify overflow.
i) Add – 256 and 206
First, we have to represent the number in binary notation
The sign of a binary number is represented by 0 as plus and 1 as minus
Sign bit 8 -bits
0 / 1 |
Now, Binary value of the given number
206 – 11001110
256 – 100000000
This number value is of more than 8-bits (i.e.9-bits) in signed 2’s complement notation also the value remains the same. Hence this number cannot fit inside it.
To add this numbers we will need one more bit, hence Addition not possible.