levo

Data Types and Number Representation

  • 9 subtopics
  • 23 things to know
  • Component 01

What Data Types and Number Representation covers

Data Types and Number Representation is examined on component 01 of OCR Computer Science, Computer systems. 152 recall questions across 9 subtopics.

Where it is assessed

Component 01

Computer systems, the whole of the first paper.

Check the OCR specification ↗

The 9 subtopics

Each one has its own page.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Numbers

What is a character set, and how do ASCII and Unicode differ?

Key term

What does a variable's data type actually tell the computer?

Numbers

A shop program stores prices. Would you use a real to hold 19.99, and why?

Key term

In a language where + works on both, what is the difference between 5 + 3 and "5" + "3"?

Key term

Convert the denary number 156 to eight-bit binary using the place value method.

Key term

Why does hexadecimal need the letters A to F?

Key term

Convert the hexadecimal number 7A3 to binary.

Key term

What is the range of an eight-bit sign and magnitude number?

Key term

Give three reasons why two's complement is preferred to sign and magnitude.

Key term

What are the four rules for adding two binary digits in one column?

Key term

Add 11010110 and 01101001 in eight bits and say what happens at the left-hand end.

Key term

Add the eight-bit two's complement numbers 01000001 and 00011110 and decide whether overflow has occurred.

Key term

Using an eight-bit two's complement mantissa and a four-bit two's complement exponent, represent 5.75.

Key term

Now represent minus 5.75 in the same eight-bit mantissa, four-bit exponent format.

Key term

How do you read the value of a negative mantissa such as 10100100?

Key term

What is the first thing you must do before adding two floating point numbers, and why?

Key term

An eight-bit fixed point number has four bits before the point and four after. What is the value of 01101010?

Evaluation

Give two practical advantages of fixed point over floating point.

Key term

Shift 00010110 two places left. What is the result in binary and in denary?

Key term

Shift 01001100 two places right logically and check the result.

Key term

What is an arithmetic right shift, and how does it differ from a logical one?

Key term

What is the effect of XOR with 11111111, and of XOR with 00000000?

Key term

The plaintext byte 01101000 is XORed with the key 00110011. Show the ciphertext, and show that XORing again with the key recovers the original.

Take Data Types and Number Representation further

The same content, four other ways.

Commonly confused

Pairs that lose marks when they are blurred together.

  • Sign and magnitude vs Two's complement

    Sign and magnitude: a representation reserving the leftmost bit to record the sign, the rest holding the size. Two's complement: a representation in which the leftmost bit carries a negative place value.

  • A fixed point binary number vs A floating point binary number

    A fixed point binary number: a representation with the binary point at an agreed, unchanging position. A floating point binary number: a representation storing a mantissa and an exponent, so the point can move.

  • ASCII vs Unicode

    ASCII: a character set of 128 codes in seven bits, extended to 256 in a full byte. Unicode: a character set assigning a code point to characters of every writing system.

Questions from this topic

Each one with the model answer underneath.

  1. 1

    What does a variable's data type actually tell the computer?

    Model answer

    Two things. First, how much memory to set aside for the variable. Second, how to interpret the bit pattern stored there, and therefore which operations are legal on it and what those operations mean. The same eight bits could be a small integer, part of a real number, or a character code; only the type decides which.

  2. 2

    Name the five primitive data types and state, in one line each, what they store.

    Model answer

    Integer: a whole number, positive or negative, with no fractional part. Real (also called floating point): a number that may have a fractional part. Character: a single symbol, stored as its code number from a character set. String: a sequence of characters of any length, including zero. Boolean: one of exactly two values, TRUE or FALSE.

  3. 3

    Why is 'primitive' the right word for these types?

    Model answer

    They are the built-in types the language provides directly, rather than types the programmer composes out of other types. Arrays, records and objects are built from primitives; primitives are not built from anything smaller within the language.

  4. 4

    An integer and a real number are both numbers. Why bother having two types?

    Model answer

    They are stored completely differently and behave differently. An integer is a plain binary place-value pattern, is exact, and arithmetic on it is fast. A real is stored as a mantissa and an exponent, is only an approximation for most values, and arithmetic on it is slower because the exponents have to be handled as well as the digits. Storing a whole number as a real would waste the range and introduce rounding error for no gain.

  5. 5

    Explain why 0.1 cannot be stored exactly in a real (floating point) variable.

    Model answer

    Binary fractions can only represent sums of halves, quarters, eighths and so on. Converting 0.1 by repeated multiplication by 2 gives 0.0001100110011... recurring forever, so it never terminates. The computer has a fixed number of mantissa bits, so it stores a truncated version, which is very slightly wrong. The same is true of any denary fraction whose denominator is not a power of two.

  6. 6

    Why is it dangerous to test two real numbers for exact equality?

    Model answer

    Because rounding errors mean two calculations that should give the same value may differ in the last bits. A total built by adding 0.1 ten times may not equal 1.0 exactly. The safe test is whether the difference between the two values is smaller than a small tolerance, rather than whether they are identical.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

If it matches, the search .
succeedsfailsrestarts

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

A0 + 0 gives 0.
B0 + 1 gives 1.
C1 + 1 gives 0 carry 1.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A global variable means a variable reachable from anywhere in the program.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Data Types and Number Representation revision questions

What does Data Types and Number Representation cover in OCR A-Level Computer Science?
9 subtopics: primitive data types, binary, hexadecimal and denary conversion, negative numbers: sign and magnitude and two's complement, binary addition, subtraction and overflow, floating point representation and normalisation, floating point addition and subtraction, and fixed point compared, bitwise shifts, masks with and, or and xor and character sets: ascii and unicode. Each one has its own page with questions and model answers.
How is Data Types and Number Representation organised?
By the OCR H446 specification, subtopic by subtopic, so it matches the order you are taught it in.

Every question in Data Types and Number Representation, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.