Conversions Between Number Systems

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

1.

Conversions Between Number Systems

Convert the following decimal number to binary:


Example:

Convert the following binary number to decimal:


Example:

Convert hexadecimal to binary and decimal:


Example:

Convert octal to decimal and binary:


Example:

2. Arithmetic Operations in Different Bases

Add two binary numbers:


Example:

Subtract one binary number from another using 2’s complement:


Example:

Multiply two binary numbers:


Example:

Perform arithmetic in octal or hexadecimal:


Example: or

3. Number System Properties and Ranges

What is the largest 8-bit binary number?


(Answer: )

How many unique values can be represented by a n-bit binary system?

What is the difference between signed and unsigned binary numbers?

4. Representation of Negative Numbers


Represent in 2’s complement using 8 bits.

Find the 1’s complement of a given binary number.


Example: (Answer: )

5. Logical and Bitwise Operations

Perform the AND, OR, and XOR operations:


Example:

Explain how a bit shift operation works.

6. Error Detection and Binary Codes

What is BCD (Binary Coded Decimal)? Convert 59 to BCD.

Explain how Gray code works. Convert to Gray code.

How does parity checking detect errors in binary data?

These questions are essential for understanding how computers interpret and manipulate data
at a low level.

Here are some commonly accessed number systems questions with answers:

1. Conversions Between Number Systems

Q1: Convert (decimal) to binary.


A1:

Divide 25 by 2 repeatedly:

25 \div 2 = 12 \, \text{remainder} \, 1
12 \div 2 = 6 \, \text{remainder} \, 0
6 \div 2 = 3 \, \text{remainder} \, 0
3 \div 2 = 1 \, \text{remainder} \, 1
1 \div 2 = 0 \, \text{remainder} \, 1

Q2: Convert (binary) to decimal.


A2:

1011_2 = (1 \times 2^3) + (0 \times 2^2) + (1 \times 2^1) + (1 \times 2^0) = 8 + 0 + 2 + 1 =


11_{10}

Q3: Convert (hexadecimal) to decimal.


A3:

1F_{16} = (1 \times 16^1) + (15 \times 16^0) = 16 + 15 = 31_{10}

2. Arithmetic Operations in Binary

Q4: Add and .


A4:

\begin{aligned}
& \quad 1011_2 \\
+ & \quad 1101_2 \\
\hline
& 11000_2 \\
\end{aligned}

Q5: Subtract from using 2’s complement.


A5:

1. Take 2’s complement of by inverting and adding 1:

1011_2 \rightarrow 0100_2 + 1 = 0101_2

\begin{aligned}
& \quad 1101_2 \\
+ & \quad 0101_2 \\
\hline
& 10010_2 \quad \text{(ignore overflow bit)} \\
\end{aligned}
2. Number System Properties and Ranges

Q6: What is the largest 8-bit binary number?


A6:
The largest 8-bit binary number is:

11111111_2 = (1 \times 2^7) + (1 \times 2^6) + \ldots + (1 \times 2^0) = 255_{10}

Q7: How many values can an -bit binary system represent?


A7:
An -bit binary system can represent unique values. For example, 8-bit binary can represent
values.

3. Representation of Negative Numbers

Q8: Represent in 2’s complement using 8 bits.


A8:

1. Write in binary: .

2. Invert all bits: .

3. Add 1: .
So, in 2’s complement (8-bit) is .

4. Logical and Bitwise Operations

Q9: Perform the AND operation: .


A9:
\begin{aligned}
1011_2 \\
\& 1101_2 \\
\hline
1001_2 \\
\end{aligned}

Q10: Perform the OR operation: .


A10:

\begin{aligned}
1011_2 \\
| 1101_2 \\
\hline
1111_2 \\
\end{aligned}

5. Error Detection and Binary Codes

Q11: Convert to BCD (Binary Coded Decimal).


A11:

(in BCD).

Q12: Convert to Gray code.


A12:

1. The first bit remains the same: .

2. For subsequent bits, XOR the previous binary bit with the current one:

\text{Gray code} = 1101_2

You might also like