Sétif 1 University 1st semester (year 2025/26)
Faculty of Sciences Machine Structures 1 course
Common Core Mathematics and Computer Science Kara Abdelaziz professor
Problem set 3
(Binary Encoding)
Exercise 1:
1). Perform the following encoding/decoding operations, showing all steps involved in the
transformation:
1. Decimal: (+6)₁₀ 2. Decimal: (-12)₁₀:
Encode in Unsigned Integer 4-bits. Encode in Unsigned Integer 6-bits.
Encode in Sign-Magnitude 4-bits. Encode in Sign-Magnitude 6-bits.
Encode in One's Complement 4-bits. Encode in One's Complement 6-bits.
Encode in Two's Complement 4-bits. Encode in Two's Complement 6-bits.
3. Decimal: (+63)₁₀ 4. Decimal: (-1)₁₀
Encode in Unsigned Integer 8-bits. Encode in Unsigned Integer 10-bits.
Encode in Sign-Magnitude 8-bits. Encode in Sign-Magnitude 10-bits.
Encode in One's Complement 8-bits. Encode in One's Complement 10-bits.
Encode in Two's Complement 8-bits. Encode in Two's Complement 10-bits.
5. Binary: [0110]4-bits 6. Binary: [110101]6-bits
As Unsigned Integer to decimal. As Unsigned Integer to decimal.
As Sign-Magnitude to decimal. As Sign-Magnitude to decimal.
As One's Complement to decimal. As One's Complement to decimal.
As Two's Complement to decimal. As Two's Complement to decimal.
7. Binary: [10000000]8-bits 8. Binary: [1111111111]10-bits
As Unsigned Integer to decimal. As Unsigned Integer to decimal.
As Sign-Magnitude to decimal. As Sign-Magnitude to decimal.
As One's Complement to decimal. As One's Complement to decimal.
As Two's Complement to decimal. As Two's Complement to decimal.
2). For each Fixed-Width: N=4-bits, N=6-bits, N=8-bits, N=10-bits. What is the number of
the representable values, and what are the ranges of representable values for each of the
four encoding schemes (UI, SM, 1C, 2C)?
Exercise 2:
1). For each of the two decimal numbers +45 and +128, determine the minimum number of
bits (N) required to represent both numbers correctly in binary?
2). Determine the minimum number of bits (N) required to represent both numbers +45 and
-128 correctly in all four encoding schemes (UI, SM, 1C, 2C)?
1/2
Exercise 3:
1). Perform the following additions and subtractions of 8-bits Two's Complement numbers,
showing all the steps involved in the work. Then analyze the validity of the results.
1. Two's Complement addition: 2. Two's Complement addition:
(75)₁₀ (91)₁₀
+ (37)₁₀ + (53)₁₀
3. Two's Complement subtraction: 4. Two's Complement subtraction:
(112)₁₀ (-46)₁₀
- (65)₁₀ - (101)₁₀
2). Perform the following binary additions on 8-bits, then interpret the binary numbers as
encoded on 2C and UI, showing all the steps used in the conversion. And checking the
validity.
1. 8-bits addition: 2. 8-bits addition:
[00010100]8-bits [00010101]8-bits
+ [00100111]8-bits + [11100111]8-bits
3. 8-bits addition: 4. 8-bits addition:
[10000001]8-bits [11111111]8-bits
+ [00010110]8-bits + [10000000]8-bits
Exercise 4:
Perform the following Floating-Point decoding and encoding numbers to decimals. Show
your steps clearly.
1. Binary Single Precision to Decimal: 2. Decimal to Binary Single Precision:
[41300000]FP32 (+15.25)₁₀
[BE500000]FP32 (-0.0625)₁₀
3. Binary Double Precision to Decimal: 4. Decimal to Binary Double Precision:
[4035000000000000]FP64 (-4.75)₁₀
5. Binary Single Precision to Decimal: 6. Binary Single Precision to Decimal:
[00700000]FP32 (2.938736 x10-39)₁₀
Exercise 5:
1). Encode the sentence "Salamou Alaykoum" into its 8-bit ASCII hexadecimal
representation.
2). You are given the following sequence of 8-bit ASCII hexadecimal values. Decode this
sequence to reveal the original sentence:
[59 65 61 72 20 32 30 32 35]ascii
2/2