1.4.1 Data types

    Cards (144)

    • What are the primitive data types mentioned in the OCR Computer Science A Level specification?

      Integer, Real / floating point, Character, String, Boolean
    • Why is it essential to use the correct data type when writing a program?
      To ensure that the right operations can be performed on the data
    • What is an integer?
      A whole number that cannot have a fractional part
    • What are real numbers used for?
      Measuring things
    • What is a character in computer science?

      A single symbol used by a computer
    • What values can a Boolean data type take?
      True and False
    • How do computers represent positive integers?
      Using binary
    • What is a bit in binary?

      A single binary digit
    • What is a byte?

      A combination of eight binary digits
    • What is a nybble?
      Half a byte, which is four bits
    • What does the least significant bit represent in a binary number?
      The value of 1
    • How do you convert the binary number 1101 to decimal?

      By calculating \( (8 \times 1) + (4 \times 1) + (2 \times 0) + (1 \times 1) = 13 \)
    • What is the first step in converting a decimal number to binary?
      Find the largest power of two smaller than the number
    • How would you represent the decimal number 47 in binary?
      By writing it as \( 00101111 \)
    • What are the four rules for binary addition?
      0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 10
    • What is the result of adding the binary numbers 1011 and 1110?
      11001
    • What is sign magnitude representation in binary?
      A method where a leading 1 indicates a negative number and a leading 0 indicates a positive number
    • How do you convert a sign magnitude binary number to decimal?
      By noting the most significant bit, remembering the sign, and converting the remaining bits to decimal
    • What is two's complement in binary?
      A method that makes the most significant bit negative and simplifies binary arithmetic with negative numbers
    • How do you convert a positive binary number to two's complement?
      By flipping all bits and adding one
    • What is hexadecimal?
      A base 16 number system that uses digits 0-9 and letters A-F
    • What does the hexadecimal number 4E7F represent in decimal?
      20095
    • What are the methods for representing negative numbers in binary?
      • Sign Magnitude
      • Two's Complement
    • What are the key operations involved in floating point arithmetic?
      • Addition and subtraction
      • Handling positive and negative numbers
    • What are the key operations in bitwise manipulation?
      • Shifts
      • Combining with AND, OR, and XOR
    • How are character sets used to represent text?

      • ASCII
      • Unicode
    • What is the process for converting between binary, hexadecimal, and denary?
      1. Represent the number in binary
      2. Convert binary to hexadecimal or denary as needed
      3. Use place values for conversion
    • What is the representation and normalization of floating point numbers in binary?

      • Representation involves storing the sign, exponent, and mantissa
      • Normalization adjusts the mantissa to fit within a specific range
    • What are the steps for binary subtraction using two's complement?

      1. Convert the number to be subtracted to two's complement
      2. Add the two's complement to the original number
      3. Read the result
    • What is the significance of leading zeros in binary representation?
      • Leading zeros do not affect the value of the number
      • They are used to represent a whole number of bytes
    • What is the process for converting hexadecimal to decimal?

      1. Identify the place values in powers of 16
      2. Multiply each digit by its place value
      3. Sum the results to get the decimal equivalent
    • What is the minimum number of bits required to represent -12 in two's complement?
      Five bits
    • What is the result of adding the two's complement numbers for -12?
      The result is 11100
    • How can you verify the calculation of -16 + 8 + 4?
      By checking that -16 + 8 + 4 equals -4
    • What base is hexadecimal?
      Base 16
    • What characters are used in hexadecimal to represent values 10-15?
      1. F
    • What are the place values in hexadecimal?
      • Starts with 1 (16<sup>0</sup>)
      • Increases in powers of 16
    • What is the decimal equivalent of the hexadecimal number 4E7F?
      20095
    • How do you convert hexadecimal digits to decimal?
      By multiplying each digit by its place value and summing the results
    • What is the binary equivalent of the hexadecimal digit B?
      1011