1.1 number systems

Cards (27)

  • overflow
    ==register== has ==predefined== number/limit of bits it can store/represent
    overflow error: value returned/generated is greater than register can store
    result of calculation require (number of bits) to be represented
    • (e.g greater than 255 in 8-bit register i.e ==TOO MANY BITS==)
  • binary shift
    (positive integer) left shift: multiplied. right shift: divided. by 2^(number of shifts)
    • most/least significant bits lost -> incorrect value
  • 3 number system
    • DDD
    • Binary - base 2. two values: 0, 1. all data and characters represented in binaryary - base 2. two values: 0, 1. all data and characters represented in binary
    • Hex - base 16. 0 - 9, A - F
  • Hexadecimal
    Shorter representation of binary
  • Hexadecimal
    • Easier for humans to understand, programmers to read, write than binary -> less likely to make mistake
    • Takes up less space
    • Easier to debug and locate errors
    • Shorter representation -> less screen space
  • CS areas where hexadecimal is used
    • Represent/define MAC address
    • Represent/define HTML color codes
    • Low-level programming (Assembly languages, machine code, memory dumps, error codes/messages, memory address locations)
    • IP (Internet Protocol) addresses
    • Debugging via memory dumps
  • Character sets
    • Map unique binary code to each character
    • Each character has unique binary value
  • Character set types
    • ASCII: 7 bit
    • Extended ASCII: 8 bit (256 values)
    • Unicode
  • Unicode
    • Allows for a greater range of characters and symbols, e.g different languages and emojis
    • Requires more bits per character
  • Character set contents

    • Upper & lower case letters
    • Number digits
    • Punctuation marks
    • Other characters
  • Sample rate
    Number of samples taken per second
  • Sample resolution
    • Number of bits per sample
    • Defines number of different amplitudes that can be recorded
    • Determines how quiet/loud the sounds are that can be recorded
  • Increase in sample rate and resolution => Increase in accuracy of recording and file size
  • Analogue to digital sound conversion
    1. Sound wave's amplitude sampled at set intervals
    2. Converted/encoded as a binary number sequence
    3. Sequence provides a digital representation of the sound wave
    4. Processed by computer
  • Pixel
    One square of one color / smallest component of image
  • Resolution
    Number of pixels in image / pixels wide by pixels high
  • Color depth
    Number of bits used to represent each color/pixel
  • Increase in resolution and color depth => Increase in file size and quality of image (sharper, more detail)
  • Bitmap images
    • Pixels arranged in grid (set numbers pixels wide by high)
    • Each pixel stores one color
    • Each color has unique color code
    • Color value of each pixel is stored in sequence
    • File Header has metadata stores image size, color depth, resolution (identifies how file should be displayed)
  • Compression
    Reduce size of the file
  • Need for compression
    • Less bandwidth required (reduce time needed to search data)
    • Less storage space required/save
    • Shorter transmission time
    • Fit in limited size e.g attach in email
  • Lossless compression
    Without permanently removing data, original data can be reconstructed upon opening
  • Lossless compression
    1. Uses compression algorithm
    2. Identify patterns of elements -> grouped and indexed with number of occurrence and position
    3. Repeating sequence of elements encoded in two values: run count and run value
    4. Groups repeating data and store how many times they occur. Resolution is stored with data so computer knows the size to recreate it when decompressing
  • Lossless compression
    • Bitmap (.bmp), vector graphic (.svg) and .png images, text file compression, database records
  • Lossy compression
    Irreversibly eliminates unnecessary data
  • Lossy compression
    1. Uses compression algorithm
    2. Find unnecessary and redundant data to be permanently removed
  • Lossy compression
    • File accuracy/quality lower
    • File size is lower (~10% of lossless)
    • JPEG: remove colors human eye can't distinguish, reduce color depth, resolution
    • Sound files (.mp3): use Perceptual music shaping to remove certain parts of sound that are less audible/discernible to human hearing