REVISION CARDS 'WE WISH YOU ALL THE BEST FOR YOUR EXAMS AND HOPE YOU FIND THESE REVISION CARDS USEFUL TO TEST YOURSELF'
BINARY BASICS
WHY DO COMPUTERS USE BINARY TO REPRESENT ALL FORMS OF DATA
Computers use binary because it is easy to represent two states (on/off), and all data can be represented by combining these states. This allows for efficient processing and storage, as well as compatibility across different computer systems. Data is processed using logic gates and data is transferred within the computer as a series of electrical signals.
CONVERT BINARY 01010101 TO DECIMAL
ANSWER | 0+64+0+16+0+4+0+1=85
CONVERT DECIMAL 196 TO BINARY
Calculation: Divide 196 by 2, keep track of the remainders:
196/2=98/2=98,R0
98/2=49/2=49,R0
49/2=24,/2=24,R1
24/2=12/2=12,R0
12/2=6/2=6,R0
6/2=3/2=3,R0
3/2=1/2=1,R1
1/2=0/2=0,R1
Answer: Reading the remainders in reverse order gives 11000100
WHAT IS THE MAXIMUM NUMBER WE CAN REPRESENT WITH 16-BIT BINARY
Calculation | A 16-bit binary number can represent 2^16 values Answer | The maximum number is 2^16 − 1 = 65,535
IN BINARY WHAT ARE THE LEAST SIGNIFICANT BIT(S)?
Explanation | The least significant bit (LSB) is the bit with the lowest value position in a binary number, which is the rightmost bit. The bit on the right can only have a maximum value of one, all other bits can have a value higher than this therefore the bit on the right is the least significant. Example | In the binary number 01010101, the LSB is the 1 on the right hand side of the number
OVERFLOW
WHAT IS OVERFLOW IN THE CONTEXT OF BINARY ADDITION?
Principle: Overflow occurs when the result of a binary addition exceeds the maximum number that can be stored in the given number of bits. Example: Adding 1 to 11111111 in an 8-bit system. Answer: The result is 100000000, which is 9 bits long and cannot be represented in an 8-bit register, causing overflow.
WHY DOES OVERFLOW OCCUR IN AN 8-BIT REGISTER AT VALUES GREATER THAN 255?
Principle: An 8-bit register can only represent numbers from 0 to 255. Example: 11111111 in Binary is 255 in decimal Answer: Anything greater than the representation of 255 in binary would require 9-bit binary. An attempt to represent more than 255 with just 8 bits would lead to an overflow.
WHY DO COMPUTERS HAVE PREDEFINED LIMITS FOR THE VALUES THEY CAN REPRESENT OR STORE?
Principle: Computers use a fixed number of bits to represent data, and each bit can only be a 0 or a 1. The number of bits determines the range of values that can be represented. Example: A 16-bit computer can represent values from 0 to 65535. Short Answer: A 16-bit computer has a predefined limit of 65535 for unsigned integers because it uses 16 bits to represent each number, and 65536(2^16−1) is the largest value that can be represented with 16 bits. If a calculation exceeds this value, it causes an overflow error, as the computer cannot store or represent a number larger than its maximum limit. Most modern computers use 64-bit.
BINARY | NEGATIVE NUMBER REPRESENTATION
WHAT IS TWO'S COMPLEMENT?
Principle: Two's complement is a method for representing positive and negative integers in binary form. Example: Represent +5 and −5 in two's complement. Answer: +5 is 00000101. −5 is 11111011.
HOW DO YOU CONVERT A NEGATIVE INTEGER TO TWO'S COMPLEMENT?
Principle: Invert all bits of the absolute value in binary and add 1. Example: Find −18 in two's complement. Answer: Invert (18) 00010010 to get 11101101, then add 1 to the result to get 11101110.
HOW DO YOU REPRESENT −64 IN AN 8-BIT TWO'S COMPLEMENT FORM?
Principle: To find the two's complement of a negative number, convert the absolute value to binary, invert the bits, and add 1.
Example: Find the two's complement of −64.
Answer: The absolute value of −64, which is 01000000 in binary. Inverting the bits gives 10111111, and adding 1 gives 11000000. Therefore, −64 in two's complement is 11000000.
BINARY | LOGIC SHIFT
WHAT IS LOGICAL BINARY SHIFT?
Principle: A logical left shift moves each bit to the left by one position, inserting a 0 at the right end. Example: Perform a logical left shift on 10110011 Answer: The result is 01100110. The leftmost bit is discarded, and a 0 is added on the right.
HOW DOES A LOGICAL LEFT SHIFT AFFECT THE VALUE OF A BINARY INTEGER?
Principle: Each logical left shift multiplies the binary number by 2. Example: What is the effect of one left shift on 00101100? Answer: The value is doubled. 00101100 becomes 01011000.
HOW DOES A LOGICAL RIGHT SHIFT AFFECT THE VALUE OF A BINARY INTEGER?
Principle: Each logical right shift divides the binary number by 2, ignoring any remainder. Example: What is the effect of one right shift on 00101100? Answer: The value is halved. 00101100 becomes 00010110.
HOW CAN YOU MULTIPLY A POSITIVE BINARY INTEGER BY 4 USING LOGICAL SHIFTS?
Principle: Two logical left shifts will multiply the number by 4. Example: Multiply 00101010 by 4 using shifts. Answer: After two left shifts, 00101010 becomes 10101000.
HEXADECIMAL
WHAT IS HEXADECIMAL?
Principle: Hexadecimal is a base-16 number system. It extends the decimal system (base-10) by adding six more symbols. Hex uses one digit to represent the numbers 0 to 16. Example: What are the hexadecimal equivalents for decimal 10, 11, and 12? Answer: In hexadecimal, 10 is A, 11 is B, and 12 is C.
WHY DO COMPUTERS USE HEXADECIMAL
Computers use hexadecimal as a shorthand for binary, grouping 4 bits into a single digit. This makes it easier for humans to read and write binary code and is useful as it uses less space on the screen than binary. It's commonly used in error codes, colour representation, MAC address.
HOW DO YOU CONVERT BINARY TO HEX?
Principle: Group binary digits into sets of four from right to left, then convert each group to its hex equivalent. Example: Convert 1101011011 to hex. Answer: Split the Binary value into 4-bit sections then take the individual value of each section - 0011 (3), 0101 (5), 1011 (B). The hex is 35B.
HOW DO YOU CONVERT HEX TO BINARY?
Principle: Convert each hex digit to its corresponding four-digit binary string. Example: Convert 1A3 to binary. Answer: 1 is 0001, A is 1010, 3 is 0011. The binary is 000110100011.
HOW DO YOU CONVERT DECIMAL TO HEX?
Principle: Divide the decimal number by 16, use the remainder as a hex digit, and continue with the quotient until it's less than 16. Example: Convert 450 to hex. Answer: 450 divided by 16 is 28 with a remainder of 2 (2), 28 divided by 16 is 1 with a remainder of 12 (C). The hex is 1C2.
HOW DO YOU CONVERT HEX TO DECIMAL?
Principle: Multiply each hex digit by 16 raised to its position from the right (starting at 0) and add them up. Example: Convert 1C2 to decimal. Answer: 2 (2), C (12) times 16, 1 times 16 times 16. Add 2 + (12 times 16) + (1 times 256). The decimal is 450.
CONVERT DECIMAL 216 TO HEXADECIMAL
Principle: To convert from decimal to hexadecimal, divide the number by 16 and use the remainder for the hex digit. Continue with the quotient until it is less than 16. Example: Convert 216 to hexadecimal. Answer: 216 divided by 16 is 13 with no remainder. 13 in decimal is D in hexadecimal. Therefore, 216 in hexadecimal is D8.
CONVERT 10111111 TO HEXADECIMAL.
Principle: Group the binary number into sets of four digits from right to left, then convert each group to its hexadecimal equivalent. Example: CONVERT 10111111 TO HEXADECIMAL. Answer: Split into two groups: 1011 (B) and 1111 (F). Therefore, 10111111 in binary is BF in hexadecimal.