Data Types and Number Representation | OCR A-Level Computer Science (H446)
Data Types and Number Representation
- 152 questions
- 9 subtopics
- Component 01: Computer systems
- Component 01
Data Types and Number Representation is examined on component 01 of OCR Computer Science, Computer systems.
152 recall questions across 9 subtopics.
Sample questions from Data Types and Number Representation
Answer each one closed book first, then open the answer.
-
Primitive data types
Why is it dangerous to test two real numbers for exact equality?
Show the 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. -
Primitive data types
In a language where + works on both, what is the difference between 5 + 3 and "5" + "3"?
Show the answer
5 + 3 is integer addition and gives 8. "5" + "3" is string concatenation and gives "53", because the operands are strings of characters, not numbers. The operator symbol is the same but the type of the operands decides which operation is performed. -
Binary, hexadecimal and denary conversion
Why does hexadecimal need the letters A to F?
Show the answer
Hexadecimal is base 16, so it needs sixteen distinct digit symbols. The denary digits only supply ten of them, so the remaining six values, ten to fifteen, are written A, B, C, D, E and F. A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. -
Binary, hexadecimal and denary conversion
Convert the hexadecimal number 7A3 to binary.
Show the answer
011110100011. Expand each hex digit into its own four-bit nibble: 7 is 0111, A is 1010 and 3 is 0011. Write them side by side in the same order. The leading zero can be dropped if you only want the significant bits, giving 11110100011. -
Negative numbers: sign and magnitude and two's complement
Describe the flip-and-add-one method for writing a negative number in two's complement.
Show the answer
Write the positive version of the number in binary using the full number of bits available. Flip every bit, so every 0 becomes 1 and every 1 becomes 0. Then add 1 to the result, working from the right and carrying as normal. The pattern you end up with is the negative of the number you started with. -
Negative numbers: sign and magnitude and two's complement
Convert the two's complement number 11000101 to denary.
Show the answer
It is minus 59. Reading place values with the leftmost worth minus 128 gives minus 128 + 64 + 4 + 1 = minus 59. Checking by flipping: 11000101 flipped is 00111010, plus 1 is 00111011, which is 32 + 16 + 8 + 2 + 1 = 59, so the value is minus 59. -
Binary addition, subtraction and overflow
Add the binary numbers 01011011 and 00101110, working column by column.
Show the answer
The result is 10001001. Starting from the right: 1 + 0 = 1. 1 + 1 = 0 carry 1. 0 + 1 + 1 = 0 carry 1. 1 + 1 + 1 = 1 carry 1. 1 + 0 + 1 = 0 carry 1. 0 + 1 + 1 = 0 carry 1. 1 + 0 + 1 = 0 carry 1. 0 + 0 + 1 = 1. Checking in denary, the inputs are 91 and 46, and 91 + 46 = 137, which is 10001001. -
Binary addition, subtraction and overflow
Add the eight-bit two's complement numbers 01000001 and 00011110 and decide whether overflow has occurred.
Show the answer
No overflow. The inputs are 65 and 30 and the result is 01011111, which is 95, comfortably within the range. The carry into the sign column is 0 and the carry out of it is also 0, so they match, and the two positive inputs have produced a positive answer as they should.
The 9 subtopics
One subtopic is one session. Work down the list.
| Subtopic | What it covers | Questions |
|---|---|---|
| Primitive data types | Recall questions on integer, real, Boolean, character and string types, why 0.1 cannot be stored exactly, testing reals for equality, storing prices, concatenation versus addition, integer division and modulus, casting and overflow. | 15 |
| Binary, hexadecimal and denary conversion | Recall questions on why computers use binary, place values and the number of values in n bits, converting between binary, denary and hexadecimal, the nibble shortcut, hexadecimal colour codes, and why programmers use hexadecimal. | 19 |
| Negative numbers: sign and magnitude and two's complement | Recall questions on sign and magnitude and its two zeros, two's complement and the flip-and-add-one method, converting negative numbers both ways, ranges of each, subtracting with an adder, and sign extension. | 21 |
| Binary addition, subtraction and overflow | Recall questions on binary addition and carries, binary subtraction with borrows and by adding a two's complement, overflow and how to detect it for unsigned and two's complement numbers, and guarding against overflow. | 16 |
| Floating point representation and normalisation | Recall questions on the mantissa and exponent, reading positive and negative mantissas, representing values in floating point, the normalisation rules and how to normalise, largest and smallest storable values, underflow, and range versus precision. | 20 |
| Floating point addition and subtraction, and fixed point compared | Recall questions on aligning exponents and adding or subtracting floating point numbers, arithmetic shifts of the mantissa, normalising results, rounding and associativity, fixed point numbers and their range, and choosing between fixed and floating point. | 19 |
| Bitwise shifts | Recall questions on logical left and right shifts and their effect on value, bits lost off the end, arithmetic right shifts on two's complement numbers, rounding, compilers replacing multiplication with shifts, and extracting packed values. | 12 |
| Masks with AND, OR and XOR | Recall questions on bit masks, using AND to clear, isolate and test bits, OR to set bits, XOR to toggle bits and in simple encryption, testing for even numbers, packed settings, and converting letter case with a mask. | 14 |
| Character sets: ASCII and Unicode | Recall questions on character sets, standard and extended ASCII, control codes, working out codes and sorting by code, character digits versus numbers, why Unicode was needed, UTF-8, storage costs, and garbled text between machines. | 16 |
How the guide is worked
Answering a question from memory stores it far better than reading the answer again. The guide runs that as a fixed procedure on one subtopic at a time, about twenty minutes a session.
-
Step 1 · Closed book
Cover the answers. Work through one subtopic and write down what you can. Leave blanks where you have nothing.
-
Step 2 · Open book
Go back to the top. Read each printed answer and write it out in full, including the ones you had right.
-
Step 3 · Closed book again
Same questions, same order, from memory. The gap between pass one and pass three is the session result.
Read the full method, the return schedule and the research behind it.
Nearby topics
OCR A-Level Computer Science Active Recall Guide
Every topic, not just this one. 1,549 questions with their answers.