Extra Menu

© 2026 Notes Gallery v3.3.1

All rights reserved. Designed for AKTU students.

Saved Bookmarks

Home / notes / Fundamentals of Computer Unit 3 Notes – Number Systems, Codes and Binary Arithmetic

Fundamentals of Computer Unit 3 Notes – Number Systems, Codes and Binary Arithmetic

BBC101 Fundamentals of Computer Unit 3 notes covering number conversions, BCD, ASCII, binary arithmetic, complements and overflow, with 26 solved examples.

Course Code: BBC101

Course: AKTU BCA 1st Year, Semester I

Unit: Number Systems, Codes and Binary Arithmetic

Unit III Overview

Build confidence with positional numbers, exact conversions and binary calculations. Distinguish numeric values from BCD and character codes, then apply fixed-width complements and check signed overflow.

Topics Covered

Syllabus area Pages
Number bases and place value 2-3
Conversions: integers and fractions 3-7
BCD and eight-bit decimal-related codes 7-9
ASCII and representation comparisons 9-10
Binary arithmetic operations 10-12
Complements, signed range and overflow 12-14
Solved examples and applications 14-18
Exam questions with answers 18-21
Quick revision and glossary 22-23

Learning Outcomes

  • 1. Explain bases, place values and unsigned range.

  • 2. Convert integers and fractions between bases.

  • 3. Distinguish BCD, EBCDIC and ASCII codes.

  • 4. Perform the four binary arithmetic operations.

  • 5. Apply complements and check signed results.

Included in These Notes

31 explained sections; 18 labelled diagrams and tables; 10 worked visual panels; 26 solved calculations and cases; 24 short answers; 6 structured long answers; comparison tables and quick revision.

Study Approach

Identify. State the base, code, bit width and interpretation.

Work. Show place weights, groups or aligned arithmetic steps.

Verify. Reverse the conversion and check the range or remainder.

Core idea: a bit pattern needs an interpretation. Conversions preserve value; codes preserve specified symbols; fixed-width arithmetic also requires range and overflow checks.

1. Number systems and representations

A number is a mathematical value; a numeral is a written representation of that value. The same value can be written differently in decimal, binary, octal or hexadecimal. Changing the base changes the notation, not the underlying quantity.

Base or radix. A positional base r uses digit values from 0 to r – 1. Binary uses base 2, decimal base 10, octal base 8 and hexadecimal base 16. Hexadecimal uses A to F for values 10 to 15. A subscript identifies the intended base when ambiguity is possible.

Validity. Every digit must be permitted by the base. Thus 102 is not a valid binary numeral and 89 is not a valid octal numeral. The string 10 can mean decimal ten, binary two, octal eight or hexadecimal sixteen; its meaning requires the base.

Representation versus code. A binary integer, digit-by-digit BCD and an ASCII character string can all use bits but interpret them differently. A bit pattern alone does not specify its meaning. State the base, code, bit width and signed interpretation where relevant.

System Base Allowed digits
Binary 2 0, 1
Octal 8 0 to 7
Decimal 10 0 to 9
Hexadecimal 16 0 to 9, A to F

2. Place value and the radix point

In a positional system, each digit contributes its digit value multiplied by a power of the base. Starting at the rightmost integer digit, the powers are 0, 1, 2 and so on moving left. The units place therefore has weight r^0 = 1.

Example. (352)_10 = 3 x 10^2 + 5 x 10^1 + 2 x 10^0. Similarly, (1011)_2 = 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1 = (11)_10. Zero contributes no quantity but preserves the positions of other digits.

Figure 3.1
Digit contributions depend on binary place weights.

Fractional places. To the right of the radix point, weights are r^(-1), r^(-2) and so on. In binary, these are 1/2, 1/4, 1/8 and 1/16. The point is called a radix point generally and a binary point in base 2.

Alignment. Leading zeros do not change an unsigned integer value. Trailing zeros after a fractional point do not change a value either. However, adding zeros on the wrong side changes place values, and changing the width of a signed representation requires its own extension rule.

3. Binary digits, bit width and unsigned range

A binary digit has two possible values. With n bits there are 2^n distinct patterns. If interpreted as an unsigned integer, the patterns represent values from 0 to 2^n – 1. The number of patterns and the maximum value are therefore different quantities.

Examples. Four unsigned bits give 16 patterns and values 0 to 15. Eight unsigned bits give 256 patterns and values 0 to 255. The leftmost bit in a written word is the most significant bit, MSB; the rightmost is the least significant bit, LSB.

Useful weights. An eight-bit unsigned word has weights 128, 64, 32, 16, 8, 4, 2 and 1 from left to right. Add the weights whose bits are 1. A group of four bits is commonly called a nibble, and a byte contains eight bits in this unit.

Minimum width. Choose the smallest n for which the required nonnegative value is at most 2^n – 1. A value of 16 needs five unsigned bits, because four bits stop at 15. This reasoning does not directly give the signed range.

4. Decimal notation and repeated division

Decimal notation uses ten digits with weights based on powers of ten. Conversion to another base must preserve the value rather than copy the visible decimal digits. For example, decimal 10 is binary 1010, while the binary numeral 10 represents decimal 2.

Integer conversion principle. Divide a nonnegative integer by the target base, record the remainder and continue with the quotient until it becomes zero. The remainders identify target-base digits. Read them from the last division back to the first.

Why reverse the remainders? The first remainder is the units digit because division separates the value into base x quotient plus a remainder smaller than the base. Later divisions identify successively higher places. Reading top to bottom reverses the required order.

Zero and signs. The integer zero is represented as 0. For an ordinary signed mathematical conversion, convert the magnitude and retain the written sign. Fixed-width negative bit patterns require a specified representation and are covered later.

5. Octal and hexadecimal as compact binary notation

Octal uses eight digit values, so each octal digit corresponds to exactly three binary bits. Hexadecimal uses sixteen digit values, so each hexadecimal digit corresponds to exactly four bits. These relationships follow from 8 = 2^3 and 16 = 2^4.

Hexadecimal letters. A, B, C, D, E and F represent 10, 11, 12, 13, 14 and 15. Their values are not 1 to 6. Uppercase and lowercase letters are commonly used for the same numeric digit values where the notation permits them.

Figure 3.2
Sixteen hexadecimal digits correspond to four-bit groups.

Compact display. A long binary pattern is easier to inspect in groups. For example, 1101 0110 corresponds to hexadecimal D6. This is a change of notation, not compression that discards information.

Limit. Direct equal-size binary grouping works because these bases are powers of two. It does not justify grouping a binary integer into four bits and treating each group as a decimal digit. BCD is a separate digit encoding.

6. Binary to decimal: weighted expansion

To convert a binary numeral to decimal, identify the place weights, multiply each weight by its bit and add the contributions. Keep the binary point fixed when assigning positive and negative powers.

Integer example. (101101)_2 = 32 + 0 + 8 + 4 + 0 + 1 = (45)_10. Writing all positions first prevents an omitted zero from shifting the remaining digits.

Fraction example. (101.101)_2 = 4 + 1 + 1/2 + 1/8 = (5.625)_10. The first fractional weight is 1/2, not 1/10 or 1/4.

Check. The integer part of an n-bit unsigned value must not exceed 2^n – 1. A binary fraction containing a finite number of bits is exactly a rational value whose denominator can be expressed as a power of two.

Visual 3.1
Weighted contributions give decimal 45 from binary 101101. Exact worked panel.

7. Decimal integer to binary: quotient and remainder

Divide the integer repeatedly by 2. Each remainder is 0 or 1 and becomes a binary digit. Stop after the quotient becomes zero and read the remainders from bottom to top.

Example. For 45, the quotient-remainder pairs are 22 remainder 1; 11 remainder 0; 5 remainder 1; 2 remainder 1; 1 remainder 0; 0 remainder 1. Reversing the remainders gives 101101.

Figure 3.3
Repeated division generates low-order remainders first.

Alternative check. Select powers of two from largest to smallest. Since 45 = 32 + 8 + 4 + 1, the weights 32, 8, 4 and 1 receive 1 while 16 and 2 receive 0. The same six-bit result is obtained.

Width. If an eight-bit unsigned field is requested, pad the result on the left: 00101101. Padding is different from changing the value. Do not add zeros at the right, because that changes the integer place weights.

8. Fractions: repeated multiplication by the base

To convert a nonnegative decimal fraction smaller than 1 to binary, multiply it by 2, record the integer part and continue with the remaining fractional part. Read the recorded integer bits in the order generated, not in reverse.

Example. 0.625 x 2 = 1.25 gives bit 1 and remainder 0.25. Then 0.25 x 2 = 0.5 gives bit 0; 0.5 x 2 = 1.0 gives bit 1 and a zero remainder. Thus 0.625 = (0.101)_2.

Figure 3.4
Negative powers describe fractional place weights.

Mixed values. Convert the integer and fractional parts separately, then join them at the point. Therefore 45.625 = (101101.101)_2. The integer method reads remainders backward; the fractional method reads generated digits forward.

Nonterminating values. Some decimal fractions, including 0.1, do not have a finite binary expansion. Stop only under a stated precision rule and indicate approximation. Truncation and rounding are different choices and should not be silently interchanged.

Visual 3.2
Fractional multiplication generates bits in forward order. Exact worked panel.

9. Octal and hexadecimal to decimal

Use the same weighted-sum method with the stated base. Octal integer weights are 1, 8, 64 and 512. Hexadecimal integer weights are 1, 16, 256 and 4096. Convert letter digits into their numeric values before multiplying.

Octal example. (745)_8 = 7 x 64 + 4 x 8 + 5 = (485)_10. The digit 7 is valid in octal, but a digit 8 would make the numeral invalid.

Hexadecimal example. (2F3)_16 = 2 x 256 + 15 x 16 + 3 = (755)_10. For a fraction, (3A.8)_16 = 3 x 16 + 10 + 8/16 = 58.5.

Check positions. The place immediately to the right of a base-r point has weight 1/r. Decimal-looking digits do not retain decimal place values when the base changes.

10. Decimal to octal and hexadecimal

Repeated division by 8 converts a nonnegative integer to octal. Repeated division by 16 converts it to hexadecimal. Read the remainders in reverse division order, replacing hexadecimal remainders 10 to 15 with A to F.

Example. Decimal 45 divided by 8 gives quotient 5 remainder 5, then quotient 0 remainder 5: (55)_8. Dividing 45 by 16 gives quotient 2 remainder 13, then 0 remainder 2: (2D)_16.

Fractional extension. Repeatedly multiply a decimal fraction by the target base and record each integer digit in forward order. For 0.625, multiplication by 8 gives 5.0, so the octal fraction is .5. Multiplication by 16 gives 10.0, so the hexadecimal fraction is .A.

Combined result. Decimal 45.625 equals octal 55.5 and hexadecimal 2D.A. Convert a result back by weighted expansion to verify that the same value is preserved.

Visual 3.3
Decimal 45 converts to octal 55 and hexadecimal 2D. Exact worked panel.

11. Binary and octal: groups of three

For binary to octal, start at the radix point. Group integer bits in threes moving left; group fractional bits in threes moving right. Add leading zeros at the far left or trailing fractional zeros at the far right when needed.

Example. 11010110 becomes 011 010 110, giving octal 326. The added zero is on the far left and does not change the unsigned value. For the fractional part .101, one group already gives octal .5.

Figure 3.5
Pad the integer at the far left before forming octal groups.

Reverse direction. Replace each octal digit with exactly three bits. Octal 572 gives 101 111 010. Preserve internal groups, including their zeros; only unnecessary leading integer zeros may be removed from the completed numeral.

Check. Do not group the whole written string through the radix point. Padding an integer on the right would multiply its value rather than simply complete a harmless leading group.

12. Binary and hexadecimal: groups of four

Group integer bits in fours from the point toward the left, and fractional bits in fours toward the right. Convert each group to its hexadecimal digit. The conversion is exact when padding is applied only at the permitted outer ends.

Example. 1010 1111 0010 gives AF2. The fraction .101 is padded as .1010, giving .A. Thus the binary value 101101.101 becomes 0010 1101 . 1010, or hexadecimal 2D.A.

Figure 3.6
Four-bit groups map exactly to hexadecimal digits.

Reverse direction. Each hexadecimal digit expands into exactly four bits. Hexadecimal 3A7 gives 0011 1010 0111. A digit such as 0 still needs its four-bit group when it appears inside the value.

Interpretation. A hexadecimal byte is often shown by two digits. That notation alone does not say whether the byte represents a signed integer, an ASCII character, two BCD digits or another kind of data.

Visual 3.4
Decimal, binary, octal and hexadecimal preserve the same value. Exact worked panel.

13. Octal and hexadecimal through binary

To convert directly between octal and hexadecimal, use binary as a bridge. Expand the source digits using its group size, preserve the point, then regroup according to the target base.

Example. Octal 55.5 expands to 101 101 . 101. For hexadecimal, regroup as 0010 1101 . 1010 to obtain 2D.A. The value remains decimal 45.625 throughout.

Another route. Conversion through decimal also works: evaluate the source as a weighted sum, then use the target-base conversion. Choose the route that minimises arithmetic and makes verification easy.

Common mistake. Replacing one octal digit with one hexadecimal digit is not a valid general rule. The source and target digits represent groups of different sizes. Keep the whole bit sequence before regrouping.

14. Choosing and checking a conversion method

To decimal: use weighted expansion. From a decimal integer: repeatedly divide by the target base. From a decimal fraction: repeatedly multiply the fractional remainder by the target base. Between binary and powers of two: use groups.

First verify the source digits and base. Separate integer and fractional work. Keep enough intermediate detail to show the direction of reading and any padding. An unsupported final answer can hide a reversed remainder order.

Reverse check. Evaluate the result in decimal or reverse the grouping. For a division example, use divisor x quotient + remainder to verify the dividend. For a fixed-width arithmetic result, also check the representable range.

Precision statement. A finite written fraction may be exact or approximate. If a conversion is stopped after a fixed number of places, indicate the chosen rule and use an approximate equality where appropriate. Correct notation is part of a correct answer.

15. Computer codes and binary-coded decimal

A code assigns bit patterns to symbols or data values under stated rules. Binary integer representation assigns weights across the complete word. Binary-coded decimal, BCD, instead encodes each decimal digit separately. The same bits can have different meanings under different interpretations.

Example. Decimal 59 is 111011 as a pure binary integer. In four-bit 8421 BCD, digit 5 is 0101 and digit 9 is 1001, so the encoded digits are 0101 1001. Interpreting that complete byte as an unsigned binary integer would give 89, not 59.

Figure 3.7
BCD digits and a whole unsigned binary integer have different interpretations.

Why use decimal digit codes? They can preserve decimal digit structure for appropriate storage, display or arithmetic arrangements. This may use more bits than a pure binary integer representation of the same nonnegative value.

Do not mix operations. Ordinary binary arithmetic on a BCD bit string does not automatically produce valid BCD digits. A result nibble greater than 1001 requires the appropriate decimal-code handling rather than being accepted as a decimal digit.

16. Four-bit 8421 BCD

In 8421 BCD, the four bits associated with one decimal digit have weights 8, 4, 2 and 1. The valid digit patterns run from 0000 for 0 through 1001 for 9. Patterns 1010 to 1111 are not valid decimal digit encodings in this code.

Encode digit by digit. Decimal 307 becomes 0011 0000 0111. Keep the zero digit as a complete group, because it occupies a decimal place. Do not convert the whole value 307 to binary and label that result BCD.

Decode digit by digit. Split the bit string into four-bit digit groups, validate each group and interpret the decimal sequence. The groups 1000 0010 represent 82 in 8421 BCD. A group 1101 makes a plain 8421 digit sequence invalid.

Optional arithmetic connection. Decimal-coded addition uses correction when a digit result exceeds 9 or generates the relevant carry. For instance 8 + 7 gives binary 1111; adding 0110 yields 1 0101, representing decimal carry 1 and digit 5. This is a code-specific extension, not a change to binary addition rules.

Decimal digit 8421 BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

17. Packed and unpacked decimal-digit storage

For an explicitly unsigned digit-only example, two four-bit BCD digits can be packed into one byte. Decimal 79 then has digit nibbles 0111 and 1001, giving 0111 1001. Real decimal formats may include signs, padding or other conventions that must also be specified.

Unpacked digit example. If each decimal digit occupies a full byte with a zero high nibble, 79 becomes 00000111 00001001. The low nibble carries the digit value, while the high nibble follows the selected convention. This uses two bytes rather than one.

Figure 3.8
The selected storage convention determines each byte.

Eight-bit BCD wording. Introductory descriptions sometimes use this phrase for a digit stored in an eight-bit field or for related zoned representations. The high nibble cannot be assumed without the format definition. Always state the convention used by the answer.

Capacity. For the stated digit-only unsigned packing, d decimal digits need d nibbles and at least the next whole number of d/2 bytes. Formats reserving a sign nibble need a different calculation. The rule follows the format, not the label BCD alone.

Visual 3.5
The intended format determines the bytes used for 79. Exact worked panel.

18. Zoned decimal and EBCDIC: distinct eight-bit ideas

Zoned decimal commonly stores each decimal digit in a byte whose low nibble identifies the digit and whose high zone nibble follows the character or numeric format. In an unsigned EBCDIC digit example, decimal characters 0 to 9 use hexadecimal F0 to F9. Sign conventions can alter a designated zone in signed formats.

EBCDIC means Extended Binary Coded Decimal Interchange Code. It is an eight-bit character-code family, not simply the rule that every decimal digit gets a leading 0000. It includes letters and other characters as well as digits. Different code pages can differ in their assignments.

Figure 3.9
An EBCDIC digit byte combines the specified zone and digit fields.

Specified example. In IBM code page 037, character A is hexadecimal C1, character a is 81, digit character 0 is F0 and space is 40. Decimal text 79 uses digit bytes F7 F9 in this example. This differs from zero-zoned unpacked digit bytes 07 09 and from unsigned packed BCD 79.

Answer discipline. When a question uses the broad label 8-bit BCD, distinguish byte-per-digit storage from the separately named EBCDIC character code and state the expected format. The bit width alone does not identify the coding table.

19. ASCII: character values and byte storage

ASCII, American Standard Code for Information Interchange, defines a seven-bit code with 128 values. It includes printable characters and control functions. The code value of a digit character is different from the numeric value that the character represents.

Examples. A has decimal code 65, hexadecimal 41 and seven-bit pattern 1000001. Lowercase a is 97 or hexadecimal 61. Digit character 0 is 48 or hexadecimal 30. Space is 32 or hexadecimal 20; line feed is 10 or hexadecimal 0A.

Figure 3.10
Examples of standard ASCII values with a zero leading storage bit.

Eight-bit storage. A standard ASCII value can be placed in a byte with a leading zero, so A becomes 01000001. This storage choice does not make standard ASCII a 256-character code. Various extended eight-bit encodings exist and require their own definitions.

Encoding versus meaning. Text 25 contains two character codes, 32 and 35 in hexadecimal ASCII. The numeric integer 25 can instead be represented by binary 00011001 in an eight-bit unsigned field. An application must know which interpretation is intended.

Visual 3.6
ASCII digit characters differ from numeric integer values. Exact worked panel.

20. Compare numeric values, digit codes and text

Compare representations only after stating their purpose. A pure binary integer assigns a numeric value to the complete word. BCD assigns decimal digits to selected groups. A character code assigns symbols such as letters and digit characters.

Example value 79. An eight-bit unsigned integer is 01001111, hexadecimal 4F. Digit-only packed 8421 BCD is 01111001, hexadecimal 79. ASCII text uses two bytes 37 39 in hexadecimal. EBCDIC digit text in code page 037 uses F7 F9.

Validation. A pattern invalid as an 8421 digit can still be valid for another role. For example, 1111 is not a BCD digit but is a valid four-bit unsigned integer 15. Incorrect interpretation is not the same as a damaged bit pattern.

Memory trick. Ask whether the bits describe one complete value, several decimal digits or several characters. Then apply the matching table and any sign or zone rules. Never infer the format solely from the presence of eight bits.

Representation of 79 Hexadecimal storage in this example
8-bit unsigned integer 4F
Unsigned digit-only packed BCD 79
Zero-zoned unpacked digits 07 09
ASCII text 37 39
EBCDIC text, code page 037 F7 F9

21. Binary addition and carry

Binary addition uses 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1 and 1 + 1 = 10. In the last rule, write a sum bit 0 and carry 1 to the next higher position. A carried 1 must be included with the next two operand bits.

With an incoming carry. The column total can be 0, 1, 2 or 3. Its low bit becomes the sum bit and any remaining higher bit becomes the carry. Thus 1 + 1 + 1 = 11: sum 1, carry 1.

Figure 3.11
Column totals determine both sum bit and outgoing carry.

Example. Binary 1011 + 1101 = 11000. Reading right to left, the first column gives sum 0 carry 1; the next gives sum 0 carry 1; the next again gives sum 0 carry 1; the fourth gives sum 1 carry 1, leaving final leading 1.

Width. Unlimited mathematical notation can retain the final carry as another digit. A fixed-width word may retain only the low n bits and report a carry separately. Signed overflow and carry are different questions.

Visual 3.7
Aligned binary addition with a retained final carry. Exact worked panel.

22. Binary subtraction and borrowing

Basic binary subtraction uses 0 – 0 = 0, 1 – 0 = 1 and 1 – 1 = 0. For 0 – 1, borrow from a higher available position; the current place receives binary 10, so 10 – 1 = 1.

Example. (11010)_2 – (01011)_2 = (01111)_2. Decimal checking gives 26 – 11 = 15. Keep the columns aligned and update each higher place affected by a borrow.

Figure 3.12
A borrowed higher-place unit is regrouped before subtraction.

Borrow chain. Subtracting 1 from 10000 requires a borrow through intervening zeros. The resulting low four places become 1111, giving 01111 in the five-bit field. A borrowed unit from the next place is worth two units of the current place.

Scope. Direct subtraction of a larger nonnegative value from a smaller one needs a written negative result or an explicitly defined signed encoding. A finite bit pattern by itself does not announce which interpretation was chosen.

Visual 3.8
Aligned binary subtraction and a decimal verification. Exact worked panel.

23. Binary multiplication and shifted partial products

The single-bit multiplication rules are 0 x 0 = 0, 0 x 1 = 0, 1 x 0 = 0 and 1 x 1 = 1. Each 1 in the multiplier contributes a shifted copy of the multiplicand; each 0 contributes a zero partial product.

Example. For 1011 x 101, the bit at multiplier position 0 contributes 001011. The bit at position 1 is 0, contributing 000000. The bit at position 2 contributes 101100. Adding the rows gives 110111, or decimal 55.

Figure 3.13
Multiplier positions determine shifted partial products.

Alignment. A shift left by k places multiplies an unsigned mathematical value by 2^k when all needed bits are retained. In a fixed-width register, discarded high bits can lose information; shifting is not a guarantee that every result remains representable.

Signed caution. The simple partial-product procedure here is for nonnegative magnitudes. Signed hardware multiplication must account for its representation and sufficient result width. Do not multiply two negative bit patterns as arbitrary unsigned values and assume the interpretation remains correct.

Visual 3.9
Shifted partial products form the binary product. Exact worked panel.

24. Binary division and remainder

Binary long division repeatedly compares the current partial dividend with the divisor, subtracts when possible and brings down the next bit. Each quotient digit is 0 or 1. A divisor of zero is not permitted.

Example. For 110110 divided by 101, the first usable partial dividend 110 is at least 101, giving quotient bit 1 and remainder 1. Bring down 1 to obtain 11: quotient bit 0. Bring down 1 to obtain 111: subtract 101, giving quotient bit 1 and remainder 10. Bring down 0 to obtain 100: quotient bit 0.

Figure 3.14
Each long-division decision supplies a quotient bit.

The quotient is therefore 1010 and the remainder 100. Decimal verification gives 54 = 5 x 10 + 4. The nonnegative integer remainder must be smaller than the positive divisor.

Exact and fractional results. A zero remainder completes an exact integer division. To continue a nonzero remainder into a binary fraction, append fractional zeros and continue under a stated precision rule. Do not silently drop a nonzero remainder.

Visual 3.10
Quotient and remainder satisfy the division identity. Exact worked panel.

25. Arithmetic with binary fractions

For addition and subtraction, align binary points before processing columns. Fractional columns use the same carry or borrow rules as integer columns. Pad harmless trailing fractional zeros where needed.

Example. 10.101 + 1.011 is aligned as 10.101 + 01.011 and gives 100.000. Decimal checking gives 2.625 + 1.375 = 4. The carry can cross the binary point into the integer part.

Multiplication. For finite unsigned fractions, multiply the digit strings as integers and then place the result point using the total number of fractional places in the operands. For example, 1.1 x 1.1 gives 10.01, matching 1.5 x 1.5 = 2.25.

Precision. A result that requires more fractional bits than a chosen field permits needs an explicit rounding or truncation rule. This is distinct from the integer overflow condition of a fixed-width signed word.

26. Fixed width, signed interpretation and extension

A complement operation must specify the bit width. The one’s complement of 0101 in four bits is 1010; the one’s complement of 00000101 in eight bits is 11111010. They are different bit patterns because the fields differ.

Unsigned versus signed. The eight-bit pattern 11111000 means 248 as unsigned and -8 as two’s complement. The most significant bit has a different interpretation in a signed format. The bits do not change merely because an observer changes the interpretation.

Figure 3.15
The same bits and different extension rules can have different meanings.

Extension. Zero-extension preserves an unsigned value by adding leading zeros. Sign-extension preserves a two’s-complement value by repeating the sign bit. Thus four-bit 1110, representing -2, extends to eight-bit 11111110, not 00001110.

Choose enough width. A signed four-bit two’s-complement field represents only -8 to +7. Decimal +9 cannot be used as a valid signed operand in that width. Use a larger field before performing a signed example that includes +9.

27. One’s complement

To form the one’s complement of an n-bit pattern, invert every bit while keeping exactly n positions. Change 0 to 1 and 1 to 0. For example, the eight-bit complement of 00101101 is 11010010.

Negative-number interpretation. In a one’s-complement signed format, a negative magnitude is represented by complementing the corresponding positive pattern. Eight-bit +5 is 00000101 and -5 is 11111010. The range is -127 to +127.

Figure 3.16
One’s complement preserves the stated width and inverts every bit.

Two zeros. All-zero bits represent +0 and all-one bits represent -0. Both describe zero but have distinct bit patterns. This feature differs from two’s complement, which has one zero representation.

Reverse operation. Complementing again returns the original pattern. To find the magnitude of a negative one’s-complement word, invert it and evaluate the result. State the format before treating a leading 1 as evidence of a negative value.

28. Two’s complement

To form an n-bit two’s complement, invert all n bits, add 1 and retain the low n bits. For 00101101, inversion gives 11010010 and addition gives 11010011. As a signed eight-bit representation, that pattern encodes -45.

Weighted interpretation. In an n-bit signed two’s-complement word, the leading position has weight -2^(n-1), while the remaining positions have their ordinary positive binary weights. The eight-bit word 11111000 therefore gives -128 + 64 + 32 + 16 + 8 = -8.

Figure 3.17
Two’s complement adds one after fixed-width inversion.

Range. The representable values are -2^(n-1) through 2^(n-1) – 1. Eight bits give -128 to +127. There is one zero, and the most negative value has no positive counterpart within the same width.

Width matters. The arithmetic is modulo 2^n at the bit-pattern level. Complementing zero and retaining n bits gives zero. Negating the most negative signed value cannot produce a representable positive value in the same signed field.

29. Subtraction using one’s complement

For a fixed-width one’s-complement subtraction A – B, add A to the one’s complement of B. If a carry leaves the field, add that carry back into the low end. This is the end-around-carry rule.

Positive example. Using five bits, 9 – 5 becomes 01001 + 11010 = 1 00011. Add the end-around carry to 00011 to obtain 00100, or +4. The chosen width accommodates both positive operands.

Negative example. For 3 – 5 in five bits, 00011 + 11010 = 11101 with no carry. Invert 11101 to obtain magnitude 00010, so the result is -2 in one’s-complement interpretation.

Zero. Equal operands can produce the negative-zero pattern under this procedure. Normalise or interpret it according to the representation rules. Do not discard a one’s-complement end-around carry as though the method were two’s-complement subtraction.

30. Subtraction using two’s complement

Use the same width for both operands. Form the two’s complement of the subtrahend B, then add it to A. Retain the n-bit result and handle any carry beyond the field according to the stated unsigned or signed interpretation.

Positive example. In eight bits, 13 – 5 is 00001101 + 11111011 = 1 00001000. Discarding the carry beyond eight bits leaves 00001000, which is +8. There is no signed overflow in this example.

Negative example. For 5 – 13, add 00000101 to the two’s complement of 00001101, which is 11110011. The result is 11111000, representing -8. Invert and add 1 to recover the positive magnitude 00001000.

Interpretation. An unsigned borrow indication, an outgoing carry and signed overflow are different concepts. A leading 1 is interpreted as negative only when the result is explicitly in a signed format and the operation is valid within its range.

31. Carry, overflow and reliable final checks

Unsigned carry. Adding two n-bit unsigned values can require n + 1 bits. In eight bits, 255 + 1 gives a carry and low result 00000000; the mathematical value 256 lies outside the unsigned eight-bit range.

Signed overflow. In two’s-complement addition, adding operands of the same sign and obtaining the opposite sign indicates overflow. Eight-bit 127 + 1 produces 10000000 without an outgoing carry, but +128 is outside -128 to +127. The interpreted negative pattern is not the correct mathematical sum.

Figure 3.18
Unsigned carry and signed overflow require different interpretations.

Do not equate flags. A carry can occur without signed overflow under a signed interpretation, and signed overflow can occur without a carry. Check the operand interpretation and range independently rather than relying on one visible leading bit.

Final workflow. Validate digits, state base or code, choose width, align columns or points, apply the correct conversion/arithmetic rule, and verify the value. For division check divisor x quotient + remainder; for codes check each group and its table; for signed results check representability.

SOLVED EXAMPLES AND APPLICATIONS

The following are original teaching examples. Identify the relevant role, working principle and assumptions before interpreting the result.

Solved example 3.1: Validity and width

Decide whether 102 is binary and 89 is octal. Find the range of an unsigned eight-bit field.

  • 1. Validate digits. Binary permits only 0 and 1, so 102 is invalid in base 2. Octal permits 0 to 7, so 89 is invalid in base 8.

  • 2. Count patterns. Eight bits provide 2^8 = 256 patterns. Unsigned values range from 0 to 255.

Answer. Both proposed numerals are invalid in the stated bases; the unsigned eight-bit range is 0 to 255.

Solved example 3.2: Binary to decimal

Convert (101101) in base 2 to decimal.

  • 1. Assign weights. The six weights are 32, 16, 8, 4, 2 and 1.

  • 2. Add contributions. 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 45.

Answer. (101101) in base 2 = (45) in base 10.

Solved example 3.3: Decimal integer to binary

Convert decimal 158 to binary.

  • 1. Divide repeatedly. 158 / 2: quotient 79 remainder 0; 79 / 2: 39 remainder 1; 39 / 2: 19 remainder 1; 19 / 2: 9 remainder 1; 9 / 2: 4 remainder 1; 4 / 2: 2 remainder 0; 2 / 2: 1 remainder 0; 1 / 2: 0 remainder 1.

  • 2. Read upward and check. The reversed remainder sequence is 10011110. Its weights give 128 + 16 + 8 + 4 + 2 = 158.

Answer. Decimal 158 = binary 10011110.

Solved example 3.4: Binary fraction to decimal

Convert binary 110.101 to decimal.

  • 1. Integer part. 110 gives 4 + 2 = 6.

  • 2. Fractional part. The fractional contributions are 1/2 + 0/4 + 1/8 = 0.625.

  • 3. Combine. 6 + 0.625 = 6.625.

Answer. Binary 110.101 = decimal 6.625, exactly.

Solved example 3.5: Decimal mixed value to binary

Convert decimal 45.625 to binary.

  • 1. Integer part. 45 = 32 + 8 + 4 + 1, so the integer bits are 101101.

  • 2. Fractional part. 0.625 x 2 gives bit 1 and remainder 0.25; 0.25 x 2 gives bit 0 and remainder 0.5; 0.5 x 2 gives bit 1 and remainder 0.

  • 3. Combine. Join the parts as 101101.101.

Answer. Decimal 45.625 = binary 101101.101, exactly.

Solved example 3.6: Octal to decimal

Convert octal 745 to decimal.

  • 1. Expand. 7 x 8^2 + 4 x 8^1 + 5 x 8^0.

  • 2. Calculate. 448 + 32 + 5 = 485.

Answer. Octal 745 = decimal 485.

Solved example 3.7: Hexadecimal to decimal

Convert hexadecimal 2F3 to decimal.

  • 1. Interpret the letter. F has numeric value 15.

  • 2. Expand and add. 2 x 16^2 + 15 x 16 + 3 = 512 + 240 + 3 = 755.

Answer. Hexadecimal 2F3 = decimal 755.

Solved example 3.8: Decimal to octal

Convert decimal 485 to octal.

  • 1. Divide by 8. 485 gives quotient 60 remainder 5; 60 gives quotient 7 remainder 4; 7 gives quotient 0 remainder 7.

  • 2. Read and verify. Read remainders upward as 745. Check 7 x 64 + 4 x 8 + 5 = 485.

Answer. Decimal 485 = octal 745.

Solved example 3.9: Decimal to hexadecimal

Convert decimal 755 to hexadecimal.

  • 1. Divide by 16. 755 gives quotient 47 remainder 3; 47 gives quotient 2 remainder 15; 2 gives quotient 0 remainder 2.

  • 2. Read and encode. Read upward as 2, 15, 3 and replace 15 by F.

Answer. Decimal 755 = hexadecimal 2F3.

Solved example 3.10: Binary to octal

Convert binary 11010110 to octal.

  • 1. Group from the right. Pad the far left to obtain 011 010 110.

  • 2. Convert groups. 011 -> 3; 010 -> 2; 110 -> 6. Decimal checking gives 214 in both bases.

Answer. Binary 11010110 = octal 326.

Solved example 3.11: Octal to binary

Convert octal 572 to binary.

  • 1. Use three bits per digit. 5 -> 101; 7 -> 111; 2 -> 010.

  • 2. Join without losing internal zeros. The result is 101111010. Its decimal value is 378.

Answer. Octal 572 = binary 101111010.

Solved example 3.12: Binary to hexadecimal

Convert binary 101011110010 to hexadecimal.

  • 1. Group four bits. 1010 1111 0010.

  • 2. Convert each group. 1010 -> A; 1111 -> F; 0010 -> 2.

Answer. The hexadecimal result is AF2. Decimal checking gives 2802.

Solved example 3.13: Hexadecimal to binary

Convert hexadecimal 3A7 to binary.

  • 1. Expand each digit. 3 -> 0011; A -> 1010; 7 -> 0111.

  • 2. Preserve groups. 0011 1010 0111 is the twelve-bit form. Removing only unnecessary leading integer zeros gives 1110100111.

Answer. Hexadecimal 3A7 = binary 001110100111 in a twelve-bit field.

Solved example 3.14: Cross-base fractional conversion

Convert octal 55.5 to hexadecimal.

  • 1. Expand to binary. 5 -> 101 on each side as required: 101 101 . 101.

  • 2. Regroup in fours. 0010 1101 . 1010 gives hexadecimal 2D.A.

  • 3. Check value. Octal 55.5 = 40 + 5 + 5/8 = 45.625. Hexadecimal 2D.A = 32 + 13 + 10/16 = 45.625.

Answer. Octal 55.5 = hexadecimal 2D.A, exactly.

Solved example 3.15: Four-bit BCD

Encode decimal 307 using four-bit 8421 BCD.

  • 1. Split decimal digits. The decimal digits are 3, 0 and 7, not one complete binary integer.

  • 2. Encode separately. 3 -> 0011; 0 -> 0000; 7 -> 0111.

Answer. The BCD result is 0011 0000 0111. Preserve the entire zero digit.

Solved example 3.16: Compare representations of 79

Give hexadecimal storage for unsigned eight-bit integer 79, unsigned digit-only packed BCD, zero-zoned digit bytes, ASCII text and EBCDIC 037 text.

  • 1. Numeric and digit-coded forms. Unsigned binary integer 79 is hex 4F. Packed digit nibbles are 7 and 9, giving hex 79. Zero-zoned digit bytes are 07 09.

  • 2. Character forms. ASCII digit characters use 37 39. EBCDIC 037 digit characters use F7 F9.

Answer. The respective hex forms are 4F; 79; 07 09; 37 39; and F7 F9. Format and purpose determine interpretation.

Solved example 3.17: ASCII characters

Write the ASCII bytes for the two-character text A0.

  • 1. Character A. A has decimal code 65 = hexadecimal 41 = byte 01000001.

  • 2. Digit character 0. The character 0 has code 48 = hexadecimal 30 = byte 00110000. It is not the all-zero numeric byte.

Answer. A0 is stored as hexadecimal 41 30 in this ASCII-byte example.

Solved example 3.18: Binary addition

Add binary 1011 and 1101.

  • 1. Column rule. Work right to left. For a column total 2, write 0 and carry 1; for total 3, write 1 and carry 1.

  • 2. Apply the carries. The successive low sum bits are 0, 0, 0 and 1, with final carry 1.

  • 3. Verify. The result 11000 equals 24; decimal operands 11 and 13 also sum to 24.

Answer. Binary 1011 + 1101 = 11000.

Solved example 3.19: Binary subtraction

Subtract binary 01011 from 11010.

  • 1. Align and borrow. Use the five aligned positions. A borrowed unit from the next higher place supplies binary 10 in the current place; update each affected position.

  • 2. Evaluate and check. The difference is 01111. Decimal check: 26 – 11 = 15.

Answer. Binary 11010 – 01011 = 01111.

Solved example 3.20: Binary multiplication

Multiply binary 1011 by 101.

  • 1. Partial products. The multiplier bits from right are 1, 0, 1. Six-bit aligned rows are 001011, 000000 and 101100.

  • 2. Add rows. 001011 + 000000 + 101100 = 110111.

  • 3. Check. 11 x 5 = 55, and binary 110111 equals decimal 55.

Answer. The binary product is 110111.

Solved example 3.21: Binary division

Divide binary 110110 by 101 and give integer quotient and remainder.

  • 1. Long-division decisions. Partial dividends 110, 11, 111 and 100 give quotient bits 1, 0, 1 and 0 respectively. Final remainder is 100.

  • 2. Verify the identity. Divisor 5 x quotient 10 + remainder 4 = 54, matching the dividend. The remainder 4 is smaller than divisor 5.

Answer. Quotient = binary 1010; remainder = binary 100.

Solved example 3.22: Complements at a stated width

Find the one’s and two’s complements of eight-bit 00101101.

  • 1. Invert. Every bit flips: 00101101 -> 11010010.

  • 2. Add one for two’s complement. 11010010 + 1 = 11010011, retaining eight bits.

Answer. One’s complement is 11010010; two’s complement is 11010011.

Solved example 3.23: One’s-complement subtraction

Use five-bit one’s-complement subtraction for 9 – 5 and 3 – 5.

  • 1. Prepare B. Five-bit +5 is 00101, so its one’s complement is 11010.

  • 2. Positive result. 01001 + 11010 = 1 00011. Add the end-around carry: 00011 + 1 = 00100 = +4.

  • 3. Negative result. 00011 + 11010 = 11101 with no carry. Invert it to get magnitude 00010, so the result represents -2.

Answer. The results are 00100 for +4 and 11101 for -2 in the stated one’s-complement format.

Solved example 3.24: Two’s-complement subtraction

Use eight-bit two’s-complement arithmetic for 13 – 5 and 5 – 13.

  • 1. Compute 13 – 5. The two’s complement of 00000101 is 11111011. Adding 00001101 gives 1 00001000; retain 00001000 = +8.

  • 2. Compute 5 – 13. The two’s complement of 00001101 is 11110011. Add 00000101 to obtain 11111000.

  • 3. Decode negative result. Invert 11111000 and add 1: 00000111 + 1 = 00001000. The signed result is -8.

Answer. Eight-bit results are 00001000 for +8 and 11111000 for -8, with no signed overflow in these examples.

Solved example 3.25: Carry and signed overflow

Compare eight-bit 127 + 1 under signed interpretation with 255 + 1 under unsigned interpretation.

  • 1. Signed example. 127 + 1 gives low bits 10000000 and no ninth carry. The signed result +128 is outside -128 to +127, so signed overflow occurs.

  • 2. Unsigned example. 255 + 1 gives 1 00000000. The carry shows the mathematical value needs more than eight unsigned bits; the low field alone is 0.

Answer. Carry and signed overflow are different conditions. State the operand interpretation and test its range.

Solved example 3.26: Binary fractional arithmetic

Add 10.101 and 1.011, then multiply 1.1 by 1.1.

  • 1. Addition. Align points: 10.101 + 01.011 = 100.000. Decimal check: 2.625 + 1.375 = 4.

  • 2. Multiplication. Ignoring points temporarily, 11 x 11 = 1001. Restore two fractional places in total to obtain 10.01.

  • 3. Verify product. 1.5 x 1.5 = 2.25, matching binary 10.01.

Answer. The sum is 100.000 and the product is 10.01, exactly.

EXAM QUESTIONS WITH ANSWERS

Practice questions covering the definitions, comparisons and applications in Unit III.

Short-answer practice

Q1. Define radix.

Answer. Radix is the base of a positional number system. Base r permits digit values 0 to r – 1 and gives places weights that are powers of r.

Q2. What is place value?

Answer. A digit contributes its value multiplied by the weight of its position. Integer weights begin at r^0 on the right; fractional weights begin at r^-1 after the point.

Q3. Why is 89 invalid in octal?

Answer. Octal permits only 0 to 7. Digits 8 and 9 are outside its digit set, so 89 has no valid octal interpretation as written.

Q4. How many patterns do n bits provide?

Answer. They provide 2^n distinct patterns. An unsigned interpretation assigns values 0 to 2^n – 1, so the maximum is one less than the pattern count.

Q5. What do MSB and LSB mean?

Answer. MSB is the most significant bit, normally the leftmost written position. LSB is the least significant bit, normally the rightmost integer position in the stated field.

Q6. How is a decimal integer converted to binary?

Answer. Divide repeatedly by 2, record remainders and read them from last to first after the quotient reaches zero.

Q7. How is a decimal fraction converted to binary?

Answer. Multiply the fractional remainder by 2 repeatedly and read the generated integer bits in forward order. Stop under a stated exact or precision condition.

Q8. Why use three-bit groups for octal?

Answer. One octal digit has eight possible values and 2^3 = 8. Each digit therefore corresponds exactly to three binary bits.

Q9. Why use four-bit groups for hexadecimal?

Answer. One hexadecimal digit has sixteen possible values and 2^4 = 16. Each digit corresponds exactly to four bits.

Q10. Where may harmless padding be added?

Answer. For unsigned positional grouping, add zeros at the far left of the integer or far right of the fraction. Keep the point fixed. Signed extension requires its representation rule.

Q11. Define 8421 BCD.

Answer. 8421 BCD assigns a four-bit weighted pattern to each decimal digit separately. Valid digit patterns are 0000 to 1001; 1010 to 1111 are not decimal digits in this code.

Q12. How does BCD differ from pure binary?

Answer. Pure binary represents the complete integer using binary place weights. BCD represents each decimal digit separately, so the bit sequence for the same value can differ.

Q13. What must be stated for an eight-bit decimal-digit code?

Answer. State the high-zone and low-digit convention, any sign rules and the relevant code table. Eight bits alone does not distinguish zero-zoned digits, EBCDIC characters or another format.

Q14. Expand EBCDIC.

Answer. Extended Binary Coded Decimal Interchange Code. It is an eight-bit character-code family; exact character assignments depend on the specified code page.

Q15. How many standard ASCII values exist?

Answer. Standard ASCII uses seven bits and defines 128 values. Storing those values in eight-bit bytes does not expand the standard code to 256 characters.

Q16. Is ASCII character 0 the numeric zero byte?

Answer. No. ASCII character 0 has decimal code 48, hexadecimal 30. An eight-bit unsigned numeric zero is 00000000.

Q17. State binary 1 + 1 and 1 + 1 + 1.

Answer. 1 + 1 = 10, giving sum bit 0 and carry 1. With another incoming 1, the total is 11, giving sum bit 1 and carry 1.

Q18. What does a left shift mean for an unsigned mathematical value?

Answer. Retaining all needed bits, a shift left by k places multiplies by 2^k. A fixed-width field can lose high bits, so representability must be checked.

Q19. How is an integer division verified?

Answer. Check dividend = divisor x quotient + remainder. For a nonnegative dividend and positive divisor under ordinary integer division, the remainder is nonnegative and smaller than the divisor.

Q20. How is one’s complement formed?

Answer. Invert every bit in the specified field while preserving its width. In one’s-complement signed representation, positive and negative zero have different patterns.

Q21. How is two’s complement formed?

Answer. Invert the specified n-bit pattern, add 1 and retain the low n bits. Signed interpretation and representable range must be stated separately.

Q22. Give the eight-bit signed two’s-complement range.

Answer. The range is -128 to +127, using -2^(n-1) to 2^(n-1) – 1. The most negative value has no positive counterpart in the same signed width.

Q23. What is end-around carry?

Answer. In one’s-complement addition/subtraction, a carry leaving the high end is added back into the low end. It is not the ordinary discard rule used for an n-bit two’s-complement result.

Q24. Why are carry and signed overflow different?

Answer. Carry concerns a bit beyond the unsigned field. Signed overflow concerns whether the mathematical signed result fits its range. One can occur without the other.

Structured long-answer practice

Use a definition, clearly separated points, a relevant example and a labelled diagram or comparison where appropriate. Match the length to the marks and the question rather than memorising a fixed word count.

Long question 1. Explain positional number systems and conversion methods.

Answer

  • 1. Base and digits. A positional base r uses digits 0 to r – 1. Integer and fractional weights are powers of r on opposite sides of the point. A numeral must use permitted digits before any conversion is attempted.

  • 2. To decimal. Multiply each digit by its place weight and add. Binary 101101 gives 32 + 8 + 4 + 1 = 45. Letter digits in hexadecimal must first be interpreted as values 10 to 15.

  • 3. From decimal. Repeated division converts an integer, with remainders read in reverse order. Repeated multiplication converts a fractional remainder, with generated integer digits read forward. Convert a mixed value in separate parts.

  • 4. Grouped conversion. Use three-bit groups for octal and four-bit groups for hexadecimal. Start grouping at the point and pad only the outer integer-left or fraction-right ends. Binary provides a bridge between octal and hexadecimal.

  • 5. Check. Reverse the conversion or compare exact decimal values. A repeating fraction requires a stated stopping and rounding rule rather than an unsupported exact equality.

Long question 2. Explain four-bit BCD, eight-bit decimal-related formats and EBCDIC.

Answer

  • 1. Digit encoding. 8421 BCD encodes each decimal digit using four bits. Decimal 307 becomes 0011 0000 0111. Groups 1010 to 1111 are invalid digits in this code, even though they can be valid binary integer patterns.

  • 2. Packed and unpacked. In the stated unsigned digit-only example, 79 packs into one byte 01111001. Zero-zoned byte-per-digit storage gives 00000111 00001001. Signed or differently zoned formats can require additional rules.

  • 3. Eight-bit wording. An eight-bit field does not establish its coding convention. A high zone nibble and low digit nibble must be interpreted according to the selected representation, rather than always assuming a leading 0000.

  • 4. EBCDIC. EBCDIC is an eight-bit character-code family. In code page 037, decimal text 79 uses F7 F9, while A uses C1. This is different from pure binary integer 79, digit-only packed BCD 79 and ASCII text 37 39.

  • 5. Conclusion. Identify whether the bits represent a complete number, individual digits or characters. State the format and code page before encoding or decoding.

Long question 3. Explain ASCII and distinguish characters from numeric values.

Answer

  • 1. Definition. ASCII defines 128 seven-bit values including printable characters and control functions. An eight-bit storage byte can hold an ASCII value with its high bit zero.

  • 2. Examples. A is decimal 65 or hexadecimal 41; a is 97 or 61; character 0 is 48 or 30. Space is hexadecimal 20 and line feed is 0A. Case and control characters have different assigned values.

  • 3. Text versus number. Text 25 contains character bytes 32 35 in hexadecimal ASCII. Numeric unsigned 25 can be stored as 00011001. The same visible decimal notation does not imply the same stored representation.

  • 4. Eight-bit confusion. Byte storage does not make standard ASCII a universal 256-character code. An extended encoding needs a specific definition, just as EBCDIC character assignments need a code page.

  • 5. Application. Validate and interpret the code table and intended data type. Converting a digit character to a numeric value is an interpretation step, not simply reading the entire character byte as that small integer.

Long question 4. Explain binary addition, subtraction, multiplication and division.

Answer

  • 1. Addition. Add aligned columns from the right, including incoming carries. For total 2 write sum bit 0 and carry 1; for total 3 write sum bit 1 and carry 1. Binary 1011 + 1101 gives 11000.

  • 2. Subtraction. Borrow a unit from a higher place when required; it supplies binary 10 in the current place. Update all affected positions. Binary 11010 – 01011 gives 01111, matching 26 – 11 = 15.

  • 3. Multiplication. For nonnegative magnitudes, each multiplier 1 contributes a suitably shifted multiplicand and each 0 a zero row. Adding partial products for 1011 x 101 gives 110111.

  • 4. Division. Compare the partial dividend, subtract where possible and bring down the next bit. Binary 110110 divided by 101 gives quotient 1010 and remainder 100. Verify 54 = 5 x 10 + 4.

  • 5. Conditions. Align fractional points, retain sufficient result width and state precision where needed. The simple magnitude procedures do not automatically define signed interpretation or overflow behaviour.

Long question 5. Compare one’s and two’s complements and their subtraction rules.

Answer

  • 1. Fixed width. Both complement operations require a stated field size. One’s complement inverts every bit; two’s complement inverts then adds 1 while retaining the field width.

  • 2. Representations. Eight-bit one’s complement has range -127 to +127 and two zeros. Eight-bit two’s complement has range -128 to +127 and one zero. The most negative two’s-complement value cannot be negated to a positive value within the same width.

  • 3. One’s subtraction. Add A to the one’s complement of B. Add an outgoing carry back at the low end. With five bits, 9 – 5 gives 1 00011 before end-around correction and 00100 afterward.

  • 4. Two’s subtraction. Add A to the two’s complement of B and retain the n-bit result. In eight bits, 13 – 5 gives 00001000 and 5 – 13 gives 11111000, representing -8.

  • 5. Checks. End-around carry and discard are different rules. Check the signed range, operand interpretation and required width before accepting a result.

Long question 6. Explain fixed-width interpretation, extension and overflow.

Answer

  • 1. Interpretation. A bit pattern needs a format. Eight-bit 11111000 represents unsigned 248 or signed two’s-complement -8. Changing the description does not change the bits.

  • 2. Extension. Zero-extension preserves an unsigned value. Repeating the sign bit preserves a two’s-complement value. Four-bit 1110 meaning -2 extends to 11111110, while zero-extension produces +14.

  • 3. Range. An n-bit unsigned field covers 0 to 2^n – 1. Signed two’s complement covers -2^(n-1) to 2^(n-1) – 1. A result outside the relevant range is not made correct merely by interpreting its remaining bits.

  • 4. Carry and overflow. Eight-bit unsigned 255 + 1 produces a carry and low result zero. Signed 127 + 1 produces 10000000 without a ninth carry, but +128 is not representable. These demonstrate different tests.

  • 5. Final check. State base, code, width and sign convention. Show the mathematical value and compare with the range, using the retained pattern and any carry only under that stated interpretation.

QUICK REVISION – UNIT III

The complete unit at a glance

Syllabus area Essential understanding
Number systems Allowed digits and place weights in bases 2, 8, 10 and 16.
Conversions Weighted sums, repeated division, fractional multiplication and grouped bits.
BCD Each decimal digit has its own pattern; validate nibble and zone conventions.
Eight-bit representations Distinguish byte-per-digit storage, zoned decimal and a specified EBCDIC code page.
ASCII 128 seven-bit values; character digits differ from numeric integer values.
Binary arithmetic Addition/carry, subtraction/borrow, shifted products and quotient/remainder.
Complements State width and representation; distinguish end-around carry and discarded high carry.

Conversion route map

Task Method
Any listed base to decimal Sum digit value x base raised to the place power.
Decimal integer to target base Repeated division; read remainders upward.
Decimal fraction to target base Repeated multiplication; read generated digits downward.
Binary and octal Three-bit groups, independently on each side of the point.
Binary and hexadecimal Four-bit groups, independently on each side of the point.
Octal and hexadecimal Expand to binary, preserve the point, then regroup.

Ranges and checks

Rule Meaning
Unsigned n-bit range 0 to 2^n – 1; there are 2^n patterns.
One’s-complement signed range -(2^(n-1) – 1) to +(2^(n-1) – 1); two zeros.
Two’s-complement signed range -2^(n-1) to 2^(n-1) – 1; one zero.
Signed extension Repeat the sign bit; zero-extension is for unsigned value preservation.
Division check Dividend = divisor x quotient + remainder; 0 <= remainder < positive divisor.
Signed overflow For signed addition, equal operand signs with opposite result sign indicate overflow.
Code check Validate each digit or character under the explicitly selected format.

Memory cues

Integer division: read upward. Fraction multiplication: read downward. Octal/hex: groups of 3 / 4. BCD: decimal digit by digit. Complements: invert; add 1 after inversion for two’s complement. Final check: value, format, width and range.

Abbreviations and key terms

Term Meaning
Radix Base of a positional number system.
MSB / LSB Most significant / least significant bit.
Radix point Separates integer and fractional places.
Unsigned Nonnegative interpretation of the complete bit field.
Nibble A four-bit group.
Hexadecimal Base 16, using digit values 0 to 15.
BCD Binary-coded decimal: decimal digits encoded separately.
8421 Weights for one conventional four-bit BCD digit.
Packed decimal Digit nibbles combined under a specified format.
Zoned decimal Byte-per-digit format with defined zone and digit fields.
EBCDIC Extended Binary Coded Decimal Interchange Code.
ASCII American Standard Code for Information Interchange.
Code page Specified character-to-code assignment table.
Carry Higher-position contribution from a column sum.
Borrow Regrouping a higher-place unit for subtraction.
Remainder Residual value after the stated integer division.
One’s complement Bitwise inversion at a specified width.
Two’s complement Inversion plus 1, retaining the specified width.
Sign extension Repeat sign bit to preserve a signed value.
Overflow Mathematical result outside the selected format range.

Common mistakes to avoid

  • Accepting a digit that is not permitted by the base.

  • Reading integer remainders in forward division order.

  • Grouping through the radix point or padding on the wrong side.

  • Calling a pure binary integer the BCD encoding of its decimal digits.

  • Treating all eight-bit decimal-related formats as one code.

  • Calling standard ASCII a 256-character code.

  • Using an unstated width or mixing complement carry rules.

  • Equating an outgoing carry with signed overflow.

Final answer check: show the method, use correct base labels, preserve the specified width, validate the code and independently verify the mathematical result.

←
Previous Story

Fundamentals of Computer Unit 2 Notes – Memory, Storage and Computer Languages

Leave a Reply

Your email address will not be published. Required fields are marked *

Schedule Appointment

Fill out the form below, and we will be in touch shortly.
Contact Information
Vehicle Information
Preferred Date and Time Selection