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.
iii) Add 124 and 132
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
+124 – 01111100
+132 – 10000100
+124:-
Sign bit 8 -bits
0 |
0 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
+132:-
Sign bit 8 -bits
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
+124:-
Sign bit 8 -bits
0 |
0 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
+132:-
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
+256 :-
Carry bit
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
Overflow condition occured.
The magnitude has been overflowed into sign bit and sign into carry the given 8-bits are not sufficient for the result of the magnitude.