Unit 1 Flashcards
• Binary - what is it and why it is used • conversions between binary, denary and hexadecimal • uses of hex • binary addition • binary shifts • 2s compliment (8 cards)
What is binary and why is it used?
Binary is a number system that uses only two digits, 0 and 1. It is used in computers because digital circuits have two states, on (1) and off (0).
Example sentence: Binary is the foundation of all digital data storage.
How do you convert a denary number (base 10) to binary (base 2)?
Divide the number by 2, write down the remainder, and repeat the process until the quotient is 0. The binary number is the remainders read in reverse.
Example sentence: Converting 13 to binary: 13 divided by 2 is 6 with a remainder of 1, then 6 divided by 2 is 3 with a remainder of 0, and finally 3 divided by 2 is 1 with a remainder of 1. Reading the remainders in reverse gives 1101 (binary for 13).
How do you convert binary to denary?
Multiply each binary digit by 2 raised to the power of its position from right to left, starting at 0, then sum the results.
Example sentence: Converting 1011 to denary: (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) = 8 + 0 + 2 + 1 = 11.
What is hexadecimal and why is it used?
Hexadecimal is a base-16 number system using digits 0-9 and letters A-F. It is used because it is more compact than binary, making it easier for humans to read and understand.
Example sentence: Hexadecimal color codes like #FF0000 represent red in HTML.
How do you convert binary to hexadecimal?
Group the binary digits into sets of 4 (starting from the right), then convert each group to its hexadecimal equivalent.
Example sentence: Converting 11011011 to hexadecimal: 1101 1011 -> D B -> DB.
What is binary addition?
Binary addition works like normal addition, but when the sum of two digits is 2, carry over 1 to the next column. Example: 1 + 1 = 10 (2 in binary).
Example sentence: Adding 1011 + 1101: 1 + 1 = 10, carry over 1 to the next column.
What is a binary shift?
A binary shift moves the digits left or right. A left shift multiplies the number by 2, and a right shift divides it by 2, with any lost bits rounding the result down.
PROBLEM-overflow and Data loss: if you do a right shift when the number is odd. The least significant bit (1 which is the 0.5) will not be stored/will be lost resulting the number being rounded down/ anything after the decimal point being lost. You have the same problem with the left shift,if the leftmost bit moves beyond the available bit width (e.g., 8 bits, 16 bits), the value can exceed the limits of the system, resulting in overflow
Example sentence: Shifting 1010 left by 1 results in 10100 (20 in denary).
What is 2’s complement?
2’s complement is a way to represent negative numbers in binary. To find the 2’s complement, invert all the bits of the number and add 1.
Example sentence: Finding the 2’s complement of 1010: Invert the bits to get 0101, then add 1 to get 0110 (-6 in denary).