Computer Science paper 2

Cards (34)

  • Sampling

    Measuring the height (amplitude) of a sound wave at set time intervals and storing the values in binary
  • Sampling rate
    The number of samples taken per second, measured in Hertz
  • Increasing sampling rate
    Improves the digital representation of the original analog wave, but also increases file size
  • Lossy compression
    Selectively deletes parts of a file to reduce file size, relying on the fact that some data is unlikely to be noticed as missing
  • Using lossy compression
    Reduces file size, which is beneficial for emailing the recording
  • Units from smallest to largest
    • Bit
    • Nibble
    • Byte
    • Kilobyte
    • Megabyte
    • Gigabyte
    • Petabyte
  • Converting 191 in base 10 to 8-bit binary

    Divide 191 by 128, 64, 32, 16, 8, 4, 2, 1 and record the remainders
  • Converting 3E in hexadecimal to decimal
    3 x 16 + 14 = 62
  • Algorithm to convert decimal 0-255 to 2-digit hexadecimal
    1. Divide number by 16 to get first digit, use hex subroutine if first digit is 10-15
    2. Subtract 16 times first digit from original number to get second digit
  • Adding two 8-bit binary numbers
    Can result in an overflow error if the sum exceeds 8 bits
  • Performing a 2-bit right shift on a binary number

    Effectively divides the number by 4, but the fractional part is lost
  • Truth table for boolean expression P = not A and B

    P is false when A is false and B is true, otherwise P is true
  • Username generation process
    1. Take first 3 letters of first name
    2. Take first 2 letters of surname
    3. Combine to form username
  • User name creation process

    1. Take first name and surname as inputs
    2. Take first 3 characters of first name
    3. Take first 2 characters of surname
    4. Combine first 3 of first name and first 2 of surname to create username
  • User name creation process for male
    1. Take last 3 characters of surname
    2. Take first 2 characters of first name
    3. Combine last 3 of surname and first 2 of first name to create username
  • Updated user name creation algorithm
    1. Get first name, surname, and gender as inputs
    2. If gender is male, username is last 3 of surname + first 2 of first name
    3. If gender is not male, username is first 3 of first name + first 2 of surname
    4. Output username
  • Compiler
    Translates the entire program at once and produces an executable file, reports all errors at the end
  • Interpreter

    Translates and executes the program line by line, stops execution when it encounters an error
  • When distributing a program, a compiler produces an executable file that hides the source code, while an interpreter needs to be distributed alongside the source code
  • 2D array
    A table-like data structure to store multiple pieces of data
  • Integer
    The most appropriate data type to store the number of minutes, as it is whole numbers
  • Accessing and printing data from the 2D array
    1. Access the value at row 2, column 1 (student 3, Wednesday)
    2. Print the total minutes played by that student on that day
  • Calculating the total minutes played by all students

    1. Initialize a total variable to 0
    2. Loop through all students and all days
    3. Add the minutes played each day to the total
    4. Print the total minutes played
  • Day of the week function
    • Takes an integer representing the day (0 for Monday, 1 for Tuesday, etc.)
    • Returns the corresponding day of the week as a string
  • Implementing the day of the week function
    1. Use a switch statement to map the integer input to the corresponding day string
    2. Return the day string
  • Calculating the average minutes played per day by the class
    1. Initialize a total variable to 0
    2. Loop through all students and all days
    3. Add the minutes played each day to the total
    4. Divide the total by the number of students and days to get the average
    5. Print the average minutes played per day
  • The Wealth of Nations was written

    1776
  • Rational
    (in classical economic theory) economic agents are able to consider the outcome of their choices and recognise the net benefits of each one
  • Producers act rationally by

    Selling goods/services in a way that maximises their profits
  • Workers act rationally by

    Balancing welfare at work with consideration of both pay and benefits
  • Governments act rationally by
    Placing the interests of the people they serve first in order to maximise their welfare
  • Rationality in classical economic theory is a flawed assumption as people usually don't act rationally
  • Marginal utility

    The additional utility (satisfaction) gained from the consumption of an additional product
  • If you add up marginal utility for each unit you get total utility