Data

Cards (104)

  • Binary
    Used to represent data and program instructions
  • Computer processors contain billions of transistors that act as switches with two states: on and off
  • Bit
    The two states (on and off) represented by 1 and 0 in the binary system
  • All data is represented in a computer system as patterns of bits
  • Nibble
    A group of 4 bits
  • Byte
    A group of 8 bits
  • All types of data, including program instructions, are represented in a computer system as a sequence of binary patterns
  • To represent the symbols in text, there must be at least 52 separate items of information - 26 lower case and 26 upper case letters, plus punctuation
  • If only two digits are used for graphics then pictures are in black and white, with no other colours or shades
  • Combining bits
    The number of items increases by powers of 2 as more bits are used
  • Place values in binary
    Increase by powers of 2, with the digit on the left having a place value two times higher than the one to the right of it
  • A computer doesn't need to know what a binary pattern represents, as the microprocessor hardware only operates in bits with no concept of the type of representation
  • Denary numbers
    Also called decimal numbers, they are numbers with values from 0 to 255 that can be converted to 8-bit binary patterns
  • Converting denary to binary
    Follow the steps in the flowchart to convert a denary number to an 8-bit binary number
  • Two's complement
    A way to represent signed (positive and negative) numbers in binary
  • Converting a negative denary number to two's complement binary
    Write out the positive number in binary, flip all the bits, then add 1
  • Binary addition
    Follows the same basic rules as denary addition, starting on the right and working left, applying the rules 0+0=0, 0+1=1, 1+1=0 and carry 1
  • Logical shift left
    Move each binary digit n positions left, discard the leftmost n bits, fill empty spaces on the right with 0s
  • Logical shift right
    Shift each binary digit n positions right, discard the rightmost n bits, fill empty spaces on the left with 0s
  • Arithmetic shift right
    Same as logical shift right, but fill vacant spaces on the left with the value of the original most significant bit
  • Shifting patterns that represent numbers can give imprecise results
  • An arithmetic shift left is the same as a logical shift left, as the MSB is shifted left out of the pattern
  • Shifting bits left and right
    1. Shift left 1 place: 1000 0100 (-124) becomes 0000 1000 (8)
    2. Shift right 1 place: 0000 0100 (4) becomes 0000 0010 (2)
    3. Shift right 1 place: 0000 0111 (7) becomes 0000 0011 (3)
  • An arithmetic shift left is the same as a logical shift left, as the MSB is shifted left out of the pattern. Fill the vacant positions on the right with 0s.
  • Overflow
    Occurs when an operation produces a result that requires more bits to store it than are available in the computer
  • Addition overflow
    • Adding two 8-bit binary patterns can generate an overflow error
    • Binary patterns are stored in registers of a fixed length. There is no extra space to store the overflow bit
  • The result cannot be represented by an 8-bit number. A 9th bit is required - this is the overflow. Programmers must make allowances for this to prevent serious errors or disasters.
  • Any time an operation produces an inaccurate result, program errors may occur. Programs may crash or produce unreliable or incorrect results
  • High-level language programmers do not need to worry about overflow errors, as the language translator has mechanisms for handling and reporting them when they occur
  • Adding two 8-bit binary numbers: 0101 0110 and 1110 1000

    1. Write the numbers out one above the other
    2. Carry out the addition as normal
    3. The vertical bar separating the 8th and 9th bit shows that the overflow is not part of the answer
  • Registers
    Hold the bit patterns that are added. They are of a fixed width. If the original patterns are 8 bits, then the result is 8 bits. No new bits can be added to make a register bigger
  • The result of adding two 16-bit binary patterns together must be 16 bits in length
  • Adding two 8-bit binary numbers: 1101 0011 and 1101 1010
    1. Write the numbers out one above the other
    2. Carry out the addition as normal
  • Hexadecimal
    Used to help programmers manipulate large binary numbers because computers only understand binary. Every eight digits of a binary number can be represented by two hexadecimal digits
  • Converting binary 1011 0011 to hexadecimal
    1. Split the 8-bit byte into two 4-bit nibbles
    2. Convert the bits in each nibble into denary numbers using the place values
    3. Add these together to give the hexadecimal
  • Converting hexadecimal C3 to binary
    1. Split the hexadecimal into two digits
    2. Convert each hexadecimal digit to denary
    3. Convert the denary numbers into nibbles
    4. Combine the nibbles to give the binary number
  • Uses of hexadecimal
    • Help humans cope with long strings of binary digits
    • Used to represent error code numbers when a computer malfunctions
    • Used to represent numerical values in assembly language
  • True colour
    • Uses 24 bits to code every available colour variation: 2^24 = 16,777,216 colours
    • Each colour is represented by three 8-bit numbers that can be simplified to three 2-digit hexadecimal ones
  • Converting 8-bit binary 1011 0111 to hexadecimal
    1. Convert the 4-bit nibbles to denary
    2. Combine the denary numbers to get the hexadecimal
  • Converting hexadecimal E9 to 8-bit binary
    1. Convert each hexadecimal digit to denary
    2. Convert the denary numbers to 4-bit nibbles
    3. Combine the nibbles to get the 8-bit binary