Section 4-Data Representation Flashcards
What are logic gates?
- Logic gates are special circuits built into computer chips. They receive binary data, apply a Boolean operation, then output a binary result
- Logic diagrams are often drawn to show logic gates and circuits. Each type of logic gate is shown by a different symbol
- Each type of logic gate also has a corresponding truth table. Truth tables show all possible input combinations of 1s and 0s, and the corresponding outputs
What are the different types of logic gates?
Also learn the symbols for each logic gate
There are three logic gates:
- NOT Gate-Not gates take a single input and give a single output. The output is always the opposite value to the input. e.g. if the input is 1, the output will be 0 and vice versa
- AND Gate-And Gates take two inputs and give one output. If both inputs are 1, the output is 1, otherwise the output will be 0
- OR Gate-OR Gate takes two inputs and gives one output. If one or more inputs are 1, then the output is 1, otherwise the output is 0
Why are logic gates combined?
1) Multiple logic gates can be added to the same logic circuit to carry out different operations.
2) You can work out the truth tables by working out each gate in order. For every input combination, follow them through each gate step-by-step, then write down the output
3) By using brackets and the terms AND, OR and NOT, circuits can be written as logical statements, like NOT(A AND B). Operations in brackets should be completed first, just like in normal Maths
What is binary code?
- Computers use 1s and 0s to represent the flow of electricity. 1 is used to show it is flowing and 0 is used to show it is not flowing
- All the data we want a computer to process must be converted into binary code
- Each 1 and 0 in a binary code is a bit
What is a bit(b)?
A single binary digit (1 or 0)
What is a nibble?
4 bits
What is a byte?
8 bits
What is a kilobyte(kB)?
1000 bytes
What is a megabyte(MB)?
1000 Kilobytes
What is a gigabyte(GB)?
1000 megabytes
What is a terabyte(TB)?
1000 gigabytes`
How is counting in binary similar to counting in decimal?
1) In our standard number system we have ten different digits (0 1 2 3 4 5 6 7 8 9). This is called decimal, denary and base 10
2) Binary only uses two different digits (0 and 1)- we call this base 2
3) Counting in binary is similar to to counting in decimal, but the place values from right to left increase by powers of 2 (e.g. 128 64 32 16 8 4 2 1)
What are the binary equivalents to numbers 1-15?
0=0 1=1 2=10 3=11 4=100 5=101 6=110 7=111 8=1000 9=1001 10=1010 11=1011 12=1100 13=1101 14=1110 15=1111
What are binary shifts?
-A binary shift (also known as a logical shift) moves every bit in a binary number left or right a certain number of places
-Binary shifts can be used to multiply or divide a number by 2
-Gaps at the beginning or end of the number are filled with 0s
-(Towards)Left shifts multiply a binary number. For every place shifted left, the number is doubled
-(Towards)Right shifts divide a binary number. For every place shifted right, the number is halved
-e.g.:
If a number is shifted three places right, it would have halved three times
If a number is shifted three places left, it would have doubled three times
What is hexadecimal?
- Hexadecimal (or base-16) uses sixteen different digits
- a single hex character can represent any decimal number from 0-15. To represent 0-15 in binary would require 4 bits (a nibble), so each hex character equates to a nibble in binary
Why do programmers prefer hex when coding?
- It is simpler to remember large numbers in hex- they are far shorter than binary numbers
- Due to hex numbers being shorter, there is less chance of errors
- It is easier to convert between binary and hex than binary and decimal
What is the hexadecimal for numbers 0-15 in decimal?
0-0 1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9 10-A 11-B 12-C 13-D 14-E 15-F
How do you convert hex to decimal?
In hex, moving right to left, place values increase in powers of 16 (e.g. 4096 256 16 1)
How do you convert binary to hex?
1) Each hex character is equal to a nibble in binary, so it is possible to convert binary to hex by splitting the binary code into 4-bit chunks
2) Binary to hex conversions can be much easier than converting from binary to decimal, as you only have to deal with the nibbles one at a time