Binary Flashcards
(areas covered: using binary, unsigned integers, two's complement and sign and magnitude signed integers, binary addition, logical and arithmetic shifts, overflow, hexadecimal)
What do computers use binary to do?
- To represent data, such as numbers, text, sound and graphics
- To program instructions
What is 4 bits known as?
A nibble
What is 8 bits known as?
A byte
(Exam-style question)
Explain one reason why all instructions and data used by a computer are represented in binary. (3)
- A processor consists of billions of transistors, each having just two states, on/off
- The on/off states of a transistor represent the binary digits 1/0
(Exam-style question)
Describe a ‘bit’. (2)
- A bit is short for binary digit, the smallest unit of data in a computer
- A bit has a single binary value, either 0 or 1
(Exam-style question)
Give one reason why a computer doesn’t need to know what a binary pattern represents. (1)
The microprocessor hardware only operates on bits, so it has no concept of type or representation
(Exam-style question)
Write an arithmetic expression to show that 256 different colours can be represented in 8 bits. (1)
2⁸ = 256 colours
What can denary numbers also be called?
Decimal numbers
(Exam-style question)
Explain one reason why the denary number 256 cannot be represented in an 8-bit binary pattern. (2)
- The number would be represented in binary as 100000000
- You would need 9 bits to store it
Convert the following denary numbers into 8-bit binary numbers:
a) 203
b) 241
c) 79
d) 100
a) 11001011
b) 11110001
c) 01001111
d) 01100100
Convert the 8-bit binary pattern 11011001 into a denary number.
217
List two ways of representing signed integer numbers.
- Two’s complement
- Sign and magnitude
What happens if the most significant bit of a two’s complement or sign and magnitude pattern is 1?
The number will have a negative value
(Example)
Convert -10 to binary two’s complement.
- Write out the positive number (+10) in binary: 00001010
- Flip all the bits: 11110101
- Add 1 (00000001) to the result. This gives: 11110110
- Therefore, -10 in two’s complement is 11110110
(Exam-style question)
Convert the denary number -54 to 8-bit binary two’s complement representation. (3)
11001010
(Exam-style question)
Give the denary value of the 8-bit two’s complement number 11101111. (3)
-17
(Exam-style question)
Convert the denary number -94 to a binary pattern using sign and magnitude representation. (2)
11011110
(Exam-style question)
Give the result of adding 00101011 and 00010111. (2)
01000010
(Exam-style question)
Add the following 8-bit binary numbers:
01010111 + 01011111
Give your answer in 8-bit binary form. (2)
10110110
(Exam-style question)
Give the result of applying a logical shift left, 2 places, to the 8-bit binary pattern 00010100. (1)
01010000
(Exam-style question)
Give the result of applying a logical shift right, 3 places, to the 8-bit binary pattern 10111000. (1)
00010111
(Exam-style question)
Give the result of applying an arithmetic shift right, 1 place, to the 8-bit binary pattern 10001000. (1)
11000100
(Exam-style question)
Give the result of applying an arithmetic shift left, 1 place, to the 8-bit binary pattern 11101100. (1)
11011000
(Exam-style question)
Describe one difference between a logical and an arithmetic shift. (2)
- An arithmetic shift preserves the most significant bit
- A logical shift always fills the vacated bits with 0s
(Exam-style question)
The binary bit pattern 10101101 is equal to the denary number 173.
Explain the effect of performing a logical shift right of two places on the binary number 10101101, and state the denary number equivalent after the shift. (3)
- The binary number becomes 00101011 after the two-place logical right shift
- The new binary number’s denary equivalent is 43
- In a two-place logical right shift, the binary number is divided by 4; the result of dividing 173 by 4 is 43.25.
- The right shift produces an imprecise result because it discards the two bits on the right of the binary number, effectively rounding it down to the nearest whole number
What happens to a binary number that has been shifted right one place?
It has been divided by 2
What type of binary numbers do arithmetic shifts operate on?
Two’s complement binary
What type of binary numbers do logical shifts operate on?
Sign and magnitude binary
(Exam-style question)
Define the term ‘overflow’. (2)
An error that occurs when a calculation produces a result that is greater than what the computer is able to store, or is greater than the number of bits available to store it
(Exam-style question)
State two consequences of an overflow error. (2)
- The program might crash
- Continued use of an incorrect result in calculations will cause further errors
(Exam-style question)
Explain one reason why the result of adding two 16-bit binary patterns together must be 16 bits in length. (2)
The registers inside the machine that hold the original patterns have a fixed length, so they cannot hold more than 16 bits
(Exam-style question)
Describe one way an overflow error can be caused by shifting the 8-bit binary pattern 11000011 left by one position. (2)
- Shifting left the original pattern 11000011 gives 10000110
- The original 1 in the most significant bit is shifted out, therefore it uses a position that does not exist in the register
(Exam-style question)
Convert the 8-bit binary number 10110111 to hexadecimal. (1)
B7
(Exam-style question)
Convert the hexadecimal number E9 to 8-bit binary. (1)
11101001
What are some of the uses of hexadecimal notation?
- Used to help people deal with long binary digits as they are much shorter in hexadecimal
- Error code numbers are usually given in hexadecimal when a computer malfunctions
- Used to represent numerical values in assembly language
What is the number of bits true colour uses to code every available colour variation?
24 bits
Each colour is represented by three 8-bit binary numbers that can be simplified to three 2-digit hexadecimal ones.
What is the benefit of this?
It is much easier to remember and enter the six digits of the hexadecimal number
(Exam-style question)
Explain why hexadecimal numbers are sometimes used to represent values stored in computers, even though computers do not use hexadecimal numbers. (2)
- Large binary numbers can be complicated to read and work with
- Binary numbers can be simplified by writing them in hexadecimal as fewer numbers are needed, making them easier to read and memorise
What base are hexadecimal numbers in?
Base 16