Binary Arithmetic and Bitwise Logic: Add, Subtract, AND, OR, XOR, NOT – Grade 12 A/L ICT Notes 3.3

© 2026 schoolict.net (Ruwan Mangala Suraweera)

3.3 Binary Arithmetic and Bitwise Logic: Add, Subtract, AND, OR, XOR, NOTද්වීමය අංක ගණිතය සහ බිටු-අනුව තර්කය: එකතු, අඩු, AND, OR, XOR, NOT

Grade 12 A/L ICT · Lesson 312 ශ්‍රේණිය A/L ICT · පාඩම 3

Prints all tabs in the language you are reading. Use “Save as PDF” in the print window to keep a copy.ඔබ කියවන භාෂාවෙන් සියලු tabs මුද්‍රණය වේ. පිටපතක් තියාගන්න print window එකේ “Save as PDF” තෝරන්න.
🎬Video coming soon in this language. Switch language to watch the other video.මේ භාෂාවෙන් වීඩියෝව ඉක්මනින් එනවා. අනෙක් වීඩියෝව බලන්න භාෂාව මාරු කරන්න.

In this videoමේ වීඩියෝවේ

  • Binary addition: 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1; work from the right.ද්වීමය එකතු කිරීම: 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1; දකුණේ සිට කරන්න.
  • For many numbers, count the 1s in each column plus the carry.සංඛ්‍යා බොහොමයක් සඳහා, සෑම තීරුවකම 1 ගණන සහ carry ගණන් කරන්න.
  • Subtraction: 0 − 1 borrows 1 (worth 2) from the left column.අඩු කිරීම: 0 − 1 වම් තීරුවෙන් 1 (අගය 2) ණයට ගනී.
  • A CPU subtracts by adding the 2’s complement and dropping the extra carry.CPU එක 2 හි අනුපූරකය එකතු කර අමතර carry එක ඉවත් කිරීමෙන් අඩු කරයි.
  • Overflow: the true answer is outside the range of the bits (8-bit: −128 to +127).පිටාර ගැලීම: සත්‍ය පිළිතුර බිටුවල පරාසයෙන් පිටත (බිටු 8: −128 සිට +127).
CarryBorrowOverflowSum bitBitwise operationANDOR

Notesසටහන්

Syllabus 3.3. The ALU inside the CPU does all its work with bits. In this part you learn binary addition (with carries, even when adding several numbers), binary subtraction (with borrowing, and with 2’s complement), what overflow is, and the bitwise logical operations NOT, AND, OR and XOR.විෂය නිර්දේශය 3.3. CPU තුළ ඇති ALU එක සියලු වැඩ බිටු මගින් කරයි. මෙම කොටසින් ද්වීමය එකතු කිරීම (සංඛ්‍යා කිහිපයක් එකතු කරන විට පවා රැගෙන යාම් සමඟ), ද්වීමය අඩු කිරීම (ණයට ගැනීම සමඟ, සහ 2 හි අනුපූරකය සමඟ), පිටාර ගැලීම (overflow) යනු කුමක්ද, සහ බිටු-අනුව තාර්කික මෙහෙයුම් NOT, AND, OR සහ XOR ඉගෙන ගනී.

1. The rules of binary addition1. ද්වීමය එකතු කිරීමේ නීති

Binary addition works exactly like decimal addition, column by column from the right. The only difference: in binary, 2 is written as 10, so you write 0 and carry 1 to the next column.ද්වීමය එකතු කිරීම දශම එකතු කිරීම මෙන්ම ක්‍රියා කරයි, දකුණේ සිට තීරුවෙන් තීරුව. එකම වෙනස: ද්වීමයේ 2 ලියන්නේ 10 ලෙස, එබැවින් 0 ලියා ඊළඟ තීරුවට 1 රැගෙන යන්න (carry).

Bits addedඑකතු කරන බිටු0 + 00 + 00 + 10 + 11 + 11 + 11 + 1 + 11 + 1 + 1Sum bitඑකතු බිටුව00110011Carryරැගෙන යාම00001111
The four rules of binary additionද්වීමය එකතු කිරීමේ නීති හතර
  • 0 + 0 = 00 + 0 = 0
  • 0 + 1 = 10 + 1 = 1
  • 1 + 1 = 10 → write 0, carry 11 + 1 = 10 → 0 ලියන්න, 1 රැගෙන යන්න
  • 1 + 1 + 1 = 11 → write 1, carry 11 + 1 + 1 = 11 → 1 ලියන්න, 1 රැගෙන යන්න
🧮 Worked exampleවිසඳූ උදාහරණය Add 1011₂ + 0110₂.1011₂ + 0110₂ එකතු කරන්න.
Right column: 1 + 0 = 1. Next: 1 + 1 = 10, write 0 carry 1. Next: 0 + 1 + 1 = 10, write 0 carry 1. Next: 1 + 0 + 1 = 10, write 0 carry 1. Last carry goes down. Answer 10001₂. Check: 11 + 6 = 17 ✔දකුණු තීරුව: 1 + 0 = 1. ඊළඟ: 1 + 1 = 10, 0 ලියා 1 රැගෙන යන්න. ඊළඟ: 0 + 1 + 1 = 10, 0 ලියා 1 රැගෙන යන්න. ඊළඟ: 1 + 0 + 1 = 10, 0 ලියා 1 රැගෙන යන්න. අවසාන carry එක පහළට. පිළිතුර 10001₂. පරීක්ෂාව: 11 + 6 = 17 ✔
2⁴2⁴2³2³2²2²2¹2¹2⁰2⁰
Carryරැගෙන යාම (carry)111111
0011001111
0000111100
Sumඑකතුව1100000011
🧮 Worked exampleවිසඳූ උදාහරණය Add three numbers: 1011 + 1101 + 0111.සංඛ්‍යා තුනක් එකතු කරන්න: 1011 + 1101 + 0111.
In every column three or four 1s may meet. Count the 1s (plus the carry): 3 = 11, so write 1 and carry 1. Doing this for each column gives 11111₂. Check: 11 + 13 + 7 = 31 ✔සෑම තීරුවකම 1 තුනක් හෝ හතරක් හමු විය හැක. 1 ගණන් කරන්න (carry ද සමඟ): 3 = 11, එබැවින් 1 ලියා 1 රැගෙන යන්න. සෑම තීරුවකටම මෙසේ කළ විට 11111₂. පරීක්ෂාව: 11 + 13 + 7 = 31 ✔
2⁴2⁴2³2³2²2²2¹2¹2⁰2⁰
Carryරැගෙන යාම (carry)11111111
0011001111
0011110011
0000111111
Sumඑකතුව1111111111
💡 Many numbers? If a column adds up to 4 (100 in binary), write 0 and carry 1 two columns to the left. Or add two numbers first, then add the third to the answer – this is safer in an exam.සංඛ්‍යා බොහොමයක්ද? තීරුවක එකතුව 4 (ද්වීමයෙන් 100) නම්, 0 ලියා තීරු දෙකක් වමට 1 රැගෙන යන්න. නැත්නම් මුලින් සංඛ්‍යා දෙකක් එකතු කර, පසුව තුන්වැන්න පිළිතුරට එකතු කරන්න – විභාගයේදී මෙය වඩා ආරක්ෂිතයි.

2. Binary subtraction with borrowing2. ණයට ගැනීම සමඟ ද්වීමය අඩු කිරීම

  • 0 − 0 = 0, 1 − 0 = 1, 1 − 1 = 00 − 0 = 0, 1 − 0 = 1, 1 − 1 = 0
  • 0 − 1: borrow 1 from the next column on the left. The borrowed 1 is worth 2 here, so 2 − 1 = 1.0 − 1: වම් පස ඊළඟ තීරුවෙන් 1 ණයට ගන්න. ණයට ගත් 1 මෙහි අගය 2, එබැවින් 2 − 1 = 1.
  • The column that lent the 1 is now one less.1 ණයට දුන් තීරුව දැන් එකකින් අඩුයි.
🧮 Worked exampleවිසඳූ උදාහරණය Subtract 11010₂ − 01011₂.11010₂ − 01011₂ අඩු කරන්න.
Right column: 0 − 1, borrow → 2 − 1 = 1. Next: 1 − 1 − 1 (paying back the borrow) is below 0, so borrow again: 2 + 1 − 1 − 1 = 1. Continue the same way; the table shows where each borrow was paid. Answer 01111₂. Check: 26 − 11 = 15 ✔දකුණු තීරුව: 0 − 1, ණයට ගන්න → 2 − 1 = 1. ඊළඟ: 1 − 1 − 1 (ණය ආපසු ගෙවීම) 0 ට අඩු නිසා නැවත ණයට ගන්න: 2 + 1 − 1 − 1 = 1. එලෙසම ඉදිරියට; සෑම ණයක්ම ගෙවූ තැන වගුවේ ඇත. පිළිතුර 01111₂. පරීක්ෂාව: 26 − 11 = 15 ✔
2⁴2⁴2³2³2²2²2¹2¹2⁰2⁰
Borrow paidණයට ගත් (borrow)−1−1−1−1−1−1−1−1
1111001100
−−0011001111
Differenceවෙනස0011111111
🧮 Worked exampleවිසඳූ උදාහරණය Subtract 10000₂ − 00001₂ (a long chain of borrows).10000₂ − 00001₂ අඩු කරන්න (දිගු ණය දාමයක්).
The right column needs a borrow, but its neighbours are 0, so the borrow travels to the leftmost 1. That 1 becomes 0 and every 0 on the way becomes 1. Answer 01111₂ (16 − 1 = 15).දකුණු තීරුවට ණයක් අවශ්‍ය නමුත් අසල්වැසි තීරු 0 නිසා ණය වම්කෙළවරේ 1 දක්වා යයි. එම 1, 0 වන අතර මාර්ගයේ සෑම 0 ක්ම 1 වේ. පිළිතුර 01111₂ (16 − 1 = 15).
2⁴2⁴2³2³2²2²2¹2¹2⁰2⁰
Borrow paidණයට ගත් (borrow)−1−1−1−1−1−1−1−1
1100000000
−−0000000011
Differenceවෙනස0011111111

3. Subtraction with 2’s complement3. 2 හි අනුපූරකය සමඟ අඩු කිරීම

A CPU does not need a separate subtract circuit. To work out A − B it adds: A + (2’s complement of B). Any carry out of the left end (the 9th bit for 8-bit numbers) is thrown away.CPU එකකට වෙනම අඩු කිරීමේ පරිපථයක් අවශ්‍ය නැත. A − B සෙවීමට එය එකතු කරයි: A + (B හි 2 හි අනුපූරකය). වම් කෙළවරින් පිටතට යන carry එක (බිටු 8 සංඛ්‍යා සඳහා 9 වැනි බිටුව) ඉවත දමයි.

🧮 Worked exampleවිසඳූ උදාහරණය Work out 45 − 20 using 8-bit 2’s complement.බිටු 8 2 හි අනුපූරකය භාවිතයෙන් 45 − 20 සොයන්න.
+45 = 0010 1101. −20 = 1110 1100 (flip 00010100 and add 1). Add them: 100011001. Throw away the 9th bit → 0001 1001 = 25 ✔+45 = 0010 1101. −20 = 1110 1100 (00010100 පෙරළා 1 එකතු කරන්න). ඒවා එකතු කරන්න: 100011001. 9 වැනි බිටුව ඉවත දමන්න → 0001 1001 = 25 ✔
2⁸2⁸2⁷2⁷2⁶2⁶2⁵2⁵2⁴2⁴2³2³2²2²2¹2¹2⁰2⁰
Carryරැගෙන යාම (carry)1111111111
000000110011110011
001111110011110000
Sumඑකතුව110000001111000011

4. Overflow4. පිටාර ගැලීම (Overflow)

An 8-bit 2’s complement number can only hold −128 to +127. If the true answer is outside this range, the result is wrong. This is called overflow. A sign check finds it: adding two positives gives a negative, or adding two negatives gives a positive.බිටු 8 2 හි අනුපූරක සංඛ්‍යාවකට −128 සිට +127 පමණක් රඳවා ගත හැක. සත්‍ය පිළිතුර මෙම පරාසයෙන් පිටත නම්, ප්‍රතිඵලය වැරදියි. මෙය පිටාර ගැලීම ලෙස හැඳින්වේ. ලකුණ පරීක්ෂා කිරීමෙන් එය හමු වේ: ධන දෙකක් එකතු කළ විට සෘණ ලැබීම, හෝ සෘණ දෙකක් එකතු කළ විට ධන ලැබීම.

🧮 Worked exampleවිසඳූ උදාහරණය Add 100 + 50 in 8-bit 2’s complement. What goes wrong?බිටු 8 2 හි අනුපූරකයෙන් 100 + 50 එකතු කරන්න. වැරදෙන්නේ කුමක්ද?
0110 0100 + 0011 0010 = 1001 0110. The MSB is 1, so the computer reads −106, not 150. Two positives gave a negative: overflow, because 150 > 127.0110 0100 + 0011 0010 = 1001 0110. MSB 1 නිසා පරිගණකය −106 ලෙස කියවයි, 150 නොවේ. ධන දෙකක් සෘණයක් දුන්නේය: පිටාර ගැලීම, 150 > 127 නිසා.

5. Bitwise logical operations5. බිටු-අනුව තාර්කික මෙහෙයුම්

A bitwise operation works on each pair of bits on its own, column by column. There is no carry.බිටු-අනුව (bitwise) මෙහෙයුමක් සෑම බිටු යුගලයක් මතම වෙන වෙනම, තීරුවෙන් තීරුව ක්‍රියා කරයි. carry එකක් නැත.

AABBA AND BA AND BA OR BA OR BA XOR BA XOR BNOT ANOT A
000000000011
001100111111
110000111100
111111110000
1
ANDAND
1 only if both bits are 1.බිටු දෙකම 1 නම් පමණක් 1.
2
OROR
1 if at least one bit is 1.අවම වශයෙන් එක් බිටුවක් 1 නම් 1.
3
XORXOR
1 if the bits are different.බිටු වෙනස් නම් 1.
4
NOTNOT
Flips every bit (one input).සෑම බිටුවක්ම පෙරළයි (එක් ආදානයක්).
🧮 Worked exampleවිසඳූ උදාහරණය A = 11001010 and B = 10101100. Find A AND B, A OR B, A XOR B and NOT A.A = 11001010 සහ B = 10101100. A AND B, A OR B, A XOR B සහ NOT A සොයන්න.
Work column by column using the truth table: AND = 10001000, OR = 11101110, XOR = 01100110, NOT A = 00110101.සත්‍යතා වගුව භාවිතයෙන් තීරුවෙන් තීරුව කරන්න: AND = 10001000, OR = 11101110, XOR = 01100110, NOT A = 00110101.
b7b7b6b6b5b5b4b4b3b3b2b2b1b1b0b0
AA1111000011001100
BB1100110011110000
A AND BA AND B1100000011000000
A OR BA OR B1111110011111100
A XOR BA XOR B0011110000111100
NOT ANOT A0000111100110011
AA11001010BB10101100A AND BA AND B10001000A OR BA OR B11101110A XOR BA XOR B01100110NOT ANOT A00110101MSB = signEach bit is worked out on its own, column by column
Bitwise operations on A and BA සහ B මත බිටු-අනුව මෙහෙයුම්

6. Using bitwise operations (masks)6. බිටු-අනුව මෙහෙයුම් භාවිතය (Masks)

A mask is a bit pattern used to pick out or change certain bits. AND with a mask checks or clears bits, OR sets bits to 1, and XOR toggles (flips) bits.Mask එකක් යනු ඇතැම් බිටු තෝරා ගැනීමට හෝ වෙනස් කිරීමට භාවිත කරන බිටු රටාවකි. Mask එකක් සමඟ AND බිටු පරීක්ෂා කරයි හෝ හිස් කරයි, OR බිටු 1 ට සකසයි, සහ XOR බිටු පෙරළයි.

🧮 Worked exampleවිසඳූ උදාහරණය Is bit 3 of A = 11001010 set? Use a mask.A = 11001010 හි 3 වැනි බිටුව 1 ද? Mask එකක් භාවිත කරන්න.
11001010 AND 00001000 = 00001000. The answer is not 0, so bit 3 is 1.11001010 AND 00001000 = 00001000. පිළිතුර 0 නොවන නිසා 3 වැනි බිටුව 1 කි.
🧮 Worked exampleවිසඳූ උදාහරණය Change the ASCII letter “A” (01000001) to “a” using one bitwise operation.එක් බිටු-අනුව මෙහෙයුමකින් ASCII “A” (01000001) අකුර “a” බවට හරවන්න.
Small letters are 32 more, and 32 = 00100000. 01000001 OR 00100000 = 01100001 = 97 = “a”.සිම්පල් අකුරු 32 කින් වැඩියි, 32 = 00100000. 01000001 OR 00100000 = 01100001 = 97 = “a”.
NEW 20262026 නව Bitwise AND finds a network. A computer with IP address 192.168.1.130 and subnet mask 255.255.255.0 does 192.168.1.130 AND 255.255.255.0 to get its network address 192.168.1.0. Your home router does this for every packet.බිටු-අනුව AND මගින් ජාලය සොයයි. IP ලිපිනය 192.168.1.130 සහ subnet mask 255.255.255.0 ඇති පරිගණකයක් ජාල ලිපිනය 192.168.1.0 ලබා ගැනීමට 192.168.1.130 AND 255.255.255.0 කරයි. ඔබේ නිවසේ router එක සෑම පැකට්ටුවක් සඳහාම මෙය කරයි.
🚀 Beyond the syllabus (2026 update)🚀 විෂය නිර්දේශයෙන් ඔබ්බට (2026 යාවත්කාලීනය) Not required for the exam – read for interest.විභාගයට අවශ්‍ය නැත – දැනුම සඳහා කියවන්න. Beyond the syllabus – 2’s complement in every CPU. Every modern processor (Intel, AMD, Apple M-series, ARM chips in phones) stores signed integers in 2’s complement. The C++20 and C23 language standards now require it. The ALU sets a carry flag for unsigned overflow and an overflow flag for signed overflow. XOR is also the heart of encryption such as AES: data XOR key hides the data, and XOR with the same key again brings it back.විෂය නිර්දේශයෙන් ඔබ්බට – සෑම CPU එකකම 2 හි අනුපූරකය. සෑම නූතන සකසනයක්ම (Intel, AMD, Apple M-series, දුරකථනවල ARM චිප) ලකුණු සහිත නිඛිල 2 හි අනුපූරකයෙන් ගබඩා කරයි. C++20 සහ C23 භාෂා ප්‍රමිති දැන් එය අනිවාර්ය කරයි. ALU එක ලකුණු රහිත පිටාර ගැලීම සඳහා carry flag එකක් සහ ලකුණු සහිත පිටාර ගැලීම සඳහා overflow flag එකක් සකසයි. AES වැනි සංකේතනයේ හදවතද XOR ය: දත්ත XOR යතුර දත්ත සඟවයි, එම යතුරෙන්ම නැවත XOR කළ විට දත්ත ආපසු ලැබේ.

Key Wordsප්‍රධාන පද

Carryරැගෙන යාම (Carry)
The 1 moved to the next column when a column adds up to 2 or more.තීරුවක එකතුව 2 හෝ වැඩි වූ විට ඊළඟ තීරුවට ගෙන යන 1.
Borrowණයට ගැනීම (Borrow)
Taking 1 from the next column on the left when 0 − 1 is needed.0 − 1 අවශ්‍ය වූ විට වම් පස ඊළඟ තීරුවෙන් 1 ගැනීම.
Overflowපිටාර ගැලීම (Overflow)
When the true result is too big or too small for the number of bits.සත්‍ය ප්‍රතිඵලය බිටු ගණනට වඩා විශාල හෝ කුඩා වීම.
Sum bitඑකතු බිටුව
The bit written in a column after adding.එකතු කිරීමෙන් පසු තීරුවක ලියන බිටුව.
Bitwise operationබිටු-අනුව මෙහෙයුම
An operation done on each pair of bits separately, with no carry.carry නොමැතිව එක් එක් බිටු යුගලය මත වෙන වෙනම කරන මෙහෙයුම.
ANDAND
Gives 1 only when both bits are 1.බිටු දෙකම 1 වූ විට පමණක් 1 දෙයි.
OROR
Gives 1 when at least one bit is 1.අවම වශයෙන් එක් බිටුවක් 1 වූ විට 1 දෙයි.
XORXOR
Gives 1 when the two bits are different.බිටු දෙක වෙනස් වූ විට 1 දෙයි.
NOTNOT
Flips every bit: 0 becomes 1 and 1 becomes 0.සෑම බිටුවක්ම පෙරළයි: 0, 1 වේ සහ 1, 0 වේ.
MaskMask (ආවරණය)
A bit pattern used with AND, OR or XOR to check or change chosen bits.තෝරාගත් බිටු පරීක්ෂා කිරීමට හෝ වෙනස් කිරීමට AND, OR හෝ XOR සමඟ භාවිත කරන බිටු රටාවක්.
ALUALU
The part of the CPU that does arithmetic and logic.අංක ගණිතය සහ තර්කය කරන CPU කොටස.
Truth tableසත්‍යතා වගුව
A table that shows the output for every input combination.සෑම ආදාන සංයෝජනයක් සඳහාම ප්‍රතිදානය පෙන්වන වගුවක්.

Sample Q&Aආදර්ශ ප්‍රශ්න සහ පිළිතුරු

1State the four rules of binary addition.ද්වීමය එකතු කිරීමේ නීති හතර සඳහන් කරන්න.

Answerපිළිතුර: 0 + 0 = 0; 0 + 1 = 1; 1 + 1 = 0 carry 1; 1 + 1 + 1 = 1 carry 1.0 + 0 = 0; 0 + 1 = 1; 1 + 1 = 0 carry 1; 1 + 1 + 1 = 1 carry 1.

2Add 1011 + 1101 + 0111.1011 + 1101 + 0111 එකතු කරන්න.

Answerපිළිතුර: 11111 (11 + 13 + 7 = 31).11111 (11 + 13 + 7 = 31).

3Subtract 11010 − 01011.11010 − 01011 අඩු කරන්න.

Answerපිළිතුර: 01111 (26 − 11 = 15).01111 (26 − 11 = 15).

4How does a CPU subtract using only an adder?CPU එකක් එකතු කිරීමේ පරිපථයක් පමණක් භාවිතයෙන් අඩු කරන්නේ කෙසේද?

Answerපිළිතුර: It finds the 2’s complement of the number being subtracted and adds it. The carry out of the left end is ignored. Example: 45 − 20 = 00101101 + 11101100 = 00011001 = 25.අඩු කරන සංඛ්‍යාවේ 2 හි අනුපූරකය සොයා එය එකතු කරයි. වම් කෙළවරින් පිටතට යන carry එක නොසලකා හරියි. උදා: 45 − 20 = 00101101 + 11101100 = 00011001 = 25.

5What is overflow? Give an example.පිටාර ගැලීම යනු කුමක්ද? උදාහරණයක් දෙන්න.

Answerපිළිතුර: Overflow happens when the answer does not fit in the bits. In 8-bit 2’s complement, 100 + 50 = 150 is more than 127, so the result 10010110 reads as −106.පිළිතුර බිටුවලට නොගැළපෙන විට පිටාර ගැලීම සිදු වේ. බිටු 8 2 හි අනුපූරකයේ 100 + 50 = 150, 127 ට වඩා වැඩි නිසා ප්‍රතිඵලය 10010110, −106 ලෙස කියවේ.

6Find 11001010 XOR 10101100 and say what XOR shows.11001010 XOR 10101100 සොයා XOR පෙන්වන්නේ කුමක්දැයි කියන්න.

Answerපිළිතුර: 01100110. XOR shows 1 wherever the two bits are different.01100110. බිටු දෙක වෙනස් සෑම තැනකම XOR 1 පෙන්වයි.

MCQබහුවරණ ප්‍රශ්න

Choose the correct answer for each question.සෑම ප්‍රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.

Scoreලකුණු: 0 / 20

1What is 1011 + 0110?1011 + 0110 කීයද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

11 + 6 = 17 = 10001.11 + 6 = 17 = 10001.

21 + 1 + 1 in binary gives:ද්වීමයෙන් 1 + 1 + 1 ලබා දෙන්නේ:

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

3 = 11.3 = 11.

3What is 1011 + 1101 + 0111?1011 + 1101 + 0111 කීයද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

11 + 13 + 7 = 31.11 + 13 + 7 = 31.

4What is 11010 − 01011?11010 − 01011 කීයද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

26 − 11 = 15.26 − 11 = 15.

5What is 10000 − 00001?10000 − 00001 කීයද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E

16 − 1 = 15.16 − 1 = 15.

6In binary subtraction, 0 − 1 needs:ද්වීමය අඩු කිරීමේදී 0 − 1 සඳහා අවශ්‍ය වන්නේ:

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E

Borrow 1 (worth 2).1 ණයට ගන්න (අගය 2).

7To find A − B a CPU usually calculates:A − B සෙවීමට CPU එකක් සාමාන්‍යයෙන් ගණනය කරන්නේ:

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Subtraction becomes addition.අඩු කිරීම එකතු කිරීමක් වේ.

8In 8-bit 2’s complement, 00101101 + 11101100 (after dropping the 9th bit) is:බිටු 8 2 හි අනුපූරකයේ 00101101 + 11101100 (9 වැනි බිටුව ඉවත් කළ පසු):

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

45 + (−20) = 25 = 00011001.45 + (−20) = 25 = 00011001.

9Adding 100 + 50 in 8-bit 2’s complement gives a negative answer. This is:බිටු 8 2 හි අනුපූරකයේ 100 + 50 එකතු කිරීම සෘණ පිළිතුරක් දෙයි. මෙය:

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

150 > 127.150 > 127.

1011001010 AND 10101100 = ?11001010 AND 10101100 = ?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

1 only where both are 1.දෙකම 1 තැන්වල පමණක් 1.

1111001010 OR 10101100 = ?11001010 OR 10101100 = ?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

1 wherever at least one is 1.අවම වශයෙන් එකක් 1 තැන්වල 1.

1211001010 XOR 10101100 = ?11001010 XOR 10101100 = ?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E

1 where bits differ.බිටු වෙනස් තැන්වල 1.

13NOT 11001010 = ?NOT 11001010 = ?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Flip every bit.සෑම බිටුවක්ම පෙරළන්න.

14Which operation gives 1 only when both bits are 1?බිටු දෙකම 1 වූ විට පමණක් 1 දෙන මෙහෙයුම කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

AND truth table.AND සත්‍යතා වගුව.

15Which operation with mask 00100000 changes “A” into “a”?Mask 00100000 සමඟ “A” “a” බවට හරවන මෙහෙයුම කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

OR sets bit 5 to 1 (+32).OR මගින් 5 වැනි බිටුව 1 කරයි (+32).

16IP 192.168.1.130 AND mask 255.255.255.0 gives:IP 192.168.1.130 AND mask 255.255.255.0 ලබා දෙන්නේ:

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

130 AND 0 = 0.130 AND 0 = 0.

17Which term means: “The 1 moved to the next column when a column adds up to 2 or more”?“තීරුවක එකතුව 2 හෝ වැඩි වූ විට ඊළඟ තීරුවට ගෙන යන 1” යන්නෙන් අදහස් වන පදය කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Carry – The 1 moved to the next column when a column adds up to 2 or more.රැගෙන යාම (Carry) – තීරුවක එකතුව 2 හෝ වැඩි වූ විට ඊළඟ තීරුවට ගෙන යන 1.

18Which term means: “Taking 1 from the next column on the left when 0 − 1 is needed”?“0 − 1 අවශ්‍ය වූ විට වම් පස ඊළඟ තීරුවෙන් 1 ගැනීම” යන්නෙන් අදහස් වන පදය කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Borrow – Taking 1 from the next column on the left when 0 − 1 is needed.ණයට ගැනීම (Borrow) – 0 − 1 අවශ්‍ය වූ විට වම් පස ඊළඟ තීරුවෙන් 1 ගැනීම.

19Which term means: “When the true result is too big or too small for the number of bits”?“සත්‍ය ප්‍රතිඵලය බිටු ගණනට වඩා විශාල හෝ කුඩා වීම” යන්නෙන් අදහස් වන පදය කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Overflow – When the true result is too big or too small for the number of bits.පිටාර ගැලීම (Overflow) – සත්‍ය ප්‍රතිඵලය බිටු ගණනට වඩා විශාල හෝ කුඩා වීම.

20Which term means: “The bit written in a column after adding”?“එකතු කිරීමෙන් පසු තීරුවක ලියන බිටුව” යන්නෙන් අදහස් වන පදය කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E

Sum bit – The bit written in a column after adding.එකතු බිටුව – එකතු කිරීමෙන් පසු තීරුවක ලියන බිටුව.

MCQ answer keyMCQ පිළිතුරු

  1. B – 11 + 6 = 17 = 10001.11 + 6 = 17 = 10001.
  2. C – 3 = 11.3 = 11.
  3. D – 11 + 13 + 7 = 31.11 + 13 + 7 = 31.
  4. B – 26 − 11 = 15.26 − 11 = 15.
  5. E – 16 − 1 = 15.16 − 1 = 15.
  6. E – Borrow 1 (worth 2).1 ණයට ගන්න (අගය 2).
  7. A – Subtraction becomes addition.අඩු කිරීම එකතු කිරීමක් වේ.
  8. C – 45 + (−20) = 25 = 00011001.45 + (−20) = 25 = 00011001.
  9. A – 150 > 127.150 > 127.
  10. B – 1 only where both are 1.දෙකම 1 තැන්වල පමණක් 1.
  11. A – 1 wherever at least one is 1.අවම වශයෙන් එකක් 1 තැන්වල 1.
  12. E – 1 where bits differ.බිටු වෙනස් තැන්වල 1.
  13. D – Flip every bit.සෑම බිටුවක්ම පෙරළන්න.
  14. D – AND truth table.AND සත්‍යතා වගුව.
  15. C – OR sets bit 5 to 1 (+32).OR මගින් 5 වැනි බිටුව 1 කරයි (+32).
  16. A – 130 AND 0 = 0.130 AND 0 = 0.
  17. C – Carry – The 1 moved to the next column when a column adds up to 2 or more.රැගෙන යාම (Carry) – තීරුවක එකතුව 2 හෝ වැඩි වූ විට ඊළඟ තීරුවට ගෙන යන 1.
  18. D – Borrow – Taking 1 from the next column on the left when 0 − 1 is needed.ණයට ගැනීම (Borrow) – 0 − 1 අවශ්‍ය වූ විට වම් පස ඊළඟ තීරුවෙන් 1 ගැනීම.
  19. B – Overflow – When the true result is too big or too small for the number of bits.පිටාර ගැලීම (Overflow) – සත්‍ය ප්‍රතිඵලය බිටු ගණනට වඩා විශාල හෝ කුඩා වීම.
  20. E – Sum bit – The bit written in a column after adding.එකතු බිටුව – එකතු කිරීමෙන් පසු තීරුවක ලියන බිටුව.

Structured Questionsව්‍යුහගත ප්‍රශ්න

1(a) Add 1011 + 0110 showing the carries. (b) Check your answer in decimal.(a) carry පෙන්වමින් 1011 + 0110 එකතු කරන්න. (b) දශමයෙන් පිළිතුර පරීක්ෂා කරන්න. (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) carries in three columns; sum 10001; (b) 11 + 6 = 17.(a) තීරු තුනක carry; එකතුව 10001; (b) 11 + 6 = 17.

2Add the three binary numbers 1011, 1101, 0111 and give the answer in binary and decimal.ද්වීමය සංඛ්‍යා තුන 1011, 1101, 0111 එකතු කර පිළිතුර ද්වීමය සහ දශමයෙන් දෙන්න. (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Each column: count the 1s plus carry; sum 11111; decimal 31.සෑම තීරුවකම: 1 ගණන + carry; එකතුව 11111; දශම 31.

3(a) Subtract 11010 − 01011 using borrowing. (b) Do 45 − 20 in 8-bit 2’s complement.(a) ණයට ගැනීමෙන් 11010 − 01011 අඩු කරන්න. (b) බිටු 8 2 හි අනුපූරකයෙන් 45 − 20 කරන්න. (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) 01111; (b) 00101101 + 11101100 = 100011001, drop the 9th bit; 00011001 = 25.(a) 01111; (b) 00101101 + 11101100 = 100011001, 9 වැනි බිටුව ඉවත් කරන්න; 00011001 = 25.

4(a) What is overflow? (b) Show that 100 + 50 overflows in 8-bit 2’s complement.(a) පිටාර ගැලීම යනු කුමක්ද? (b) බිටු 8 2 හි අනුපූරකයේ 100 + 50 පිටාර ගලන බව පෙන්වන්න. (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) result outside the range the bits can hold; (b) 01100100 + 00110010 = 10010110; MSB 1 so reads −106; two positives gave a negative.(a) බිටුවලට රඳවා ගත හැකි පරාසයෙන් පිටත ප්‍රතිඵලය; (b) 01100100 + 00110010 = 10010110; MSB 1 නිසා −106 ලෙස කියවේ; ධන දෙකක් සෘණයක් දුන්නේය.

5A = 11001010, B = 10101100. Find (a) A AND B (b) A OR B (c) A XOR B (d) NOT A (e) one use of AND with a mask.A = 11001010, B = 10101100. සොයන්න (a) A AND B (b) A OR B (c) A XOR B (d) NOT A (e) mask එකක් සමඟ AND හි එක් භාවිතයක්. (5 marksලකුණු 5)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) 10001000; (b) 11101110; (c) 01100110; (d) 00110101; (e) checking a bit or finding a network address with a subnet mask.(a) 10001000; (b) 11101110; (c) 01100110; (d) 00110101; (e) බිටුවක් පරීක්ෂා කිරීම හෝ subnet mask එකකින් ජාල ලිපිනය සෙවීම.

🎮 Game🎮 ක්‍රීඩා

Pick a game. Each one uses words from this lesson.ක්‍රීඩාවක් තෝරන්න. හැම එකක්ම මේ පාඩමේ වචන පාවිච්චි කරනවා.

Summary & Downloadsසාරාංශය සහ බාගත කිරීම්

Key pointsප්‍රධාන කරුණු

  • Binary addition: 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1; work from the right.ද්වීමය එකතු කිරීම: 1 + 1 = 0 carry 1, 1 + 1 + 1 = 1 carry 1; දකුණේ සිට කරන්න.
  • For many numbers, count the 1s in each column plus the carry.සංඛ්‍යා බොහොමයක් සඳහා, සෑම තීරුවකම 1 ගණන සහ carry ගණන් කරන්න.
  • Subtraction: 0 − 1 borrows 1 (worth 2) from the left column.අඩු කිරීම: 0 − 1 වම් තීරුවෙන් 1 (අගය 2) ණයට ගනී.
  • A CPU subtracts by adding the 2’s complement and dropping the extra carry.CPU එක 2 හි අනුපූරකය එකතු කර අමතර carry එක ඉවත් කිරීමෙන් අඩු කරයි.
  • Overflow: the true answer is outside the range of the bits (8-bit: −128 to +127).පිටාර ගැලීම: සත්‍ය පිළිතුර බිටුවල පරාසයෙන් පිටත (බිටු 8: −128 සිට +127).
  • Bitwise: AND both 1, OR any 1, XOR different, NOT flips; masks check, set or toggle bits.බිටු-අනුව: AND දෙකම 1, OR ඕනෑම 1, XOR වෙනස්, NOT පෙරළයි; masks බිටු පරීක්ෂා, සකස් හෝ පෙරළයි.

Downloadsබාගත කිරීම්

Full Lesson 3 PDFසම්පූර්ණ පාඩම 3 PDF: English · සිංහල

Next: Lesson 3 A/L Exam Practiceඊළඟට: පාඩම 3 A/L විභාග පුහුණුව →

© 2026 schoolict.net (Ruwan Mangala Suraweera). All rights reserved.සියලු හිමිකම් ඇවිරිණි.