Data representation

Cards (70)

  • Binary
    A numbering system that uses only 0s (off) and 1s (on)
  • All data needs to be converted to binary to be processed by a computer
  • Bit
    The smallest unit of data a computer can process, either 0 or 1
  • A computer uses binary data for all of its operations
  • "Bits" is short for binary digits
  • A bit is the smallest unit of data a computer can process
  • Computers use binary because all data needs to be converted to binary to be processed
  • Binary
    A numbering system that uses only 0s and 1s
  • Bit
    The smallest unit of data a computer can use (a single 0 or 1)
  • Bits can be grouped to form larger units of data, such as bytes, kilobytes, etc.
  • Computers use binary because they can process and store data using electronic transistors that can be either on or off
  • Any form of data, including text, images, and sound, needs to be converted to binary before it can be processed by a computer
  • Logic gates
    Electronic devices that perform logical operations on binary data
  • Registers
    Temporary storage areas in a computer's CPU that hold binary data during processing
  • Number systems used in Computer Science
    • Denary
    • Binary
    • Hexadecimal
  • Denary (decimal) number system

    A base-10 numbering system that uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9
  • Binary number system
    A base-2 numbering system that uses only two digits: 0 and 1
  • Hexadecimal number system
    A base-16 numbering system that uses 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F
  • Converting Denary to Binary
    1. Write down the powers of 2 in binary
    2. Starting from the leftmost column, write a 1 if the corresponding power of 2 is less than or equal to the number you're converting, otherwise write a 0
    3. Check your working by adding together all column headings with a 1 underneath
    4. Read the binary digits from left to right to get the binary equivalent
  • Converting Binary to Denary
    1. Write down the powers of 2 in decimal
    2. Starting from the leftmost column, write the binary digit in the column if it is a 1, write 0 if it is a 0
    3. Add up the values in each column where the binary digit is 1
  • Converting Binary to Hexadecimal
    1. Group the binary digits into groups of 4, starting from the rightmost digit
    2. Replace each group of 4 bits with its corresponding hexadecimal value
  • Converting Hexadecimal to Binary
    Write each hex digit in 4-bit binary
  • Converting Denary to Hexadecimal
    1. Divide the decimal number by 16 and write down the answer including the remainder
    2. If the remainder is above 9, replace this with the corresponding letter
    3. Repeat steps 1 and 2 until the number you're dividing is zero
    4. Write the hexadecimal values from step 3 to step 1 in reverse order
  • Converting Hexadecimal to Denary
    1. Write down the place value of each digit in the number, starting from the right and increasing by a power of 16
    2. Multiply each decimal value by its corresponding place value, and sum the products
  • Hexadecimal numbers are often used as a beneficial method of data representation in computer science
  • Benefits of using Hexadecimal over Binary
    • It takes fewer digits to represent a given value in hexadecimal than in binary
    • One hexadecimal digit can represent four bits of binary data
    • Numbers with more bits are more prone to errors when being copied
    • The more bits there are in a binary number, the harder it is to read
  • Uses of Hexadecimal in Computers
    • Memory addresses and other hardware related values
    • Representation of colour values
    • Error messages
    • Memory dump
    • Debugging
    • IP addresses
    • ASCII / Unicode
    • Assembly language
    • URLs
    • Representation of colour values in HTML/CSS and in computer graphics
  • Bits with more bits are more prone to errors when being copied
  • Hexadecimal
    A way to represent large amounts of binary data in a more manageable and readable format
  • Uses of hexadecimal in computers
    • Memory addresses and other hardware related values
    • Representation of colour values
    • Error messages
    • Memory dump
    • Debugging
    • IP addresses
    • ASCII / Unicode
    • Assembly language
    • URLs
  • Hexadecimal values can be used to represent each set of numbers in an IP address
  • To encode a space in a URL using hexadecimal, the space character is replaced by a percent sign ("%") followed by the hexadecimal value of the space character
  • Binary Addition
    1. Start by writing the two binary numbers you want to add underneath each other, with the least significant bit (LSB) on the right
    2. Begin by adding the LSBs together. If the sum is less than or equal to 1, write it down in the sum column. If the sum is 2 or greater, write the remainder of the sum (i.e., the sum minus 2) in the sum column and carry over the quotient (i.e., 1) to the next column
    3. Repeat this process for the next column to the left, adding the two bits and any carryover from the previous column
    4. Continue this process for each subsequent column until you have added all the bits
    5. If the sum of the last two bits produces a carryover, add an additional bit to the left of the sum to represent the carryover
    6. Check the sum to make sure it fits within 8 bits. If it doesn't, you will need to use more bits to represent the sum
  • Overflow error

    Occurs when the result of a binary addition exceeds the maximum value that can be represented
  • Binary Shifts
    1. A binary shift moves all the bits in a binary number a certain number of positions to the left or right
    2. When performing a logical binary shift to the left, the bits shifted from the end of the register are lost, and zeros are shifted in at the opposite end
    3. When performing a logical binary shift to the right, the bits shifted from the beginning of the register are lost, and zeros are shifted in at the opposite end
    4. When performing a logical binary shift, the positive binary integer is multiplied or divided according to the shift performed. A shift to the left is equivalent to multiplication by a power of 2, while a shift to the right is equivalent to division by a power of 2
    5. When performing a logical binary shift, the most significant bit(s) or least significant bit(s) are lost, depending on the direction of the shift
  • Two's Complement
    A method of representing signed integers in binary form, where the leftmost bit represents the sign (0 for positive and 1 for negative)
  • Converting a positive number to a two's complement 8-bit integer

    First represent the number in binary form with leading zeros until it is 8 bits long. If the number is positive, the leftmost bit should be 0
  • Converting a negative number to a two's complement 8-bit integer

    First invert all the bits in the binary representation of the positive equivalent of the number (i.e., flip all the 1's to 0's and all the 0's to 1's). Then, add 1 to the result to obtain the two's complement representation
  • Character Set

    A collection of characters and the corresponding binary codes that represent them
  • ASCII
    American Standard Code for Information Interchange, assigns a unique 7-bit binary code to each character