Assignment 01
Assignment 01
Assignment 01
Assignment 01
Exercise 01
Convert
140,52517 to base 10 (use 4 digits precision)
23,4410 to base 5 (use 2 digits precision).
0x85 to decimal, assuming the data was stored as a 2’s complement one-byte integer.
65710 to base 20
0.110 to binary and Hex
Exercise 02
Consider we have a base 32 number, with each number position represented by the numerals 0 through
9 plus the letters A (10) to V(31). Convert VAN32 to:
a) Binary:
b) Hexadecimal
Exercise 03
What are the unsigned and signed decimal values of the following binary and hexadecimal numbers?
a) 10110110
b) C1B3
Exercise 04
Let x=0x35 and y=0x9A be integers stored on a machine with a word size of 8bits. Write the 32-bits
version of these numbers if they are considered as :
Signed
unsigned
Exercise 05
a) What is the minimum number of bits required to represent
141000 symbols?
Numbers between 0 to 16384?
b) What is the least number of bits needed to represent the following ranges using any number
representation scheme.
a) 0 to 256
b) -7 to 56
c) 64 to 127 and -64 to -127
Exercise 06
For each of the following representations, what is the fewest number of bits needed to cover the given
range
Range Unsigned One’s Comp Two’s Comp Sign&Mag
[ 0, 10 ]
[ -4, -1 ]
[ 1, 4 ]
The National Higher School of Artificial Intelligence 2023/2024
Exercise 07
Carry the following additions. Indicate whether there is a carry or overflow?
a) 0b11010010 + 0b10111101
b) 0xA1CF + 0xB2D3
Carry the following subtractions. Indicate whether there is borrow or overflow.
a) 0b11010010 – 0b10111101
b) 0x71CF - 0xB2D3
Exercise 08
Compute the decimal result of the following arithmetic expressions involving 6-bit Two’s Complement
numbers, as they would be calculated on a computer. Do any of these results in an overflow? Are all
these operations possible?
a) 0b011001 − 0b000111
b) 0b100011 + 0b111010
c) 0x3B + 0x06
d) 0xFF − 0xAA
e) 0b000100 − 0b001000
Exercise 09
Complete the following table. The decimal numbers are unsigned:
Decimal BCD Binary Gray Code
137
1011100
1101101010
10101011
110001101
100101010111
Exercise 10
.
Convert the following single-precision floating point numbers from binary to decimal or from decimal to
binary. You may leave your answer as an expression.
• 0x00000000
• 8.25
• 0xBE200000
• 39.5625
Exercise 11
IA-32 offers an 80-bit extended precision option with a 1 bit sign, 16-bit exponent, and 63-bit fraction
(64-bit significand including the implied 1 before the binary point). Assume that extended precision is
similar to single and double precision.
a) What is the bias in the exponent?
b) What is the range (in absolute value) of normalized numbers that can be represented by the
extended precision option?