AQA A-Level Computer Science 7517
Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation
Fundamentals of Data Representation
Fundamentals of Computer Systems
Fundamentals of Computer Organisation and Architecture
Fundamentals of Communication and Networking
Consequences of Uses of Computing
Systematic Approach to Problem Solving
Fundamentals of Databases
Big Data
Fundamentals of Programming
Arithmetic operations
- 3 things to know
- Paper 1
Overview
Recall questions on real division against integer division, DIV and MOD, the type each operation returns, and the packing problems the remainder is used to solve.
What you need to know
Answer each one before you reveal it.
What is 17 MOD 5, and how do the quotient and remainder relate back to the original number?
What does rounding do? Give the results of rounding 4.6 and 4.4 to the nearest whole number, and 3.14159 to two decimal places.
Questions from this subtopic
Each one with the model answer underneath.
- 1
Which arithmetic operations does a program need, and how do they group?
Model answer
Four are the ordinary operations of arithmetic: adding, subtracting, multiplying and dividing. Division splits into two, because a computer must be told which kind is wanted — real division gives a fractional result, while integer division discards the fraction and leaves a separate remainder alongside the quotient. Raising to a power is the fifth operation. The last two do not calculate at all but control precision: rounding adjusts a value to the nearest step, while truncation simply cuts the unwanted digits away, which is why the two disagree on a value such as −3.7.
- 2
What type of result do addition, subtraction and multiplication give?
Model answer
Applied to two integers each gives an exact integer result. If either operand is a real, the result is a real. Multiplication and addition of large integers can overflow if the result will not fit in the storage allowed for the type.
- 3
What does real (float) division give, and what is 7 / 2?
Model answer
It gives the full quotient including any fractional part, so 7 / 2 = 3.5. The result is a real even when it happens to have no fractional part, so 6 / 3 gives 3.0 rather than the integer 3 in most languages.
- 4
What does integer division give, and what is 17 DIV 5?
Model answer
It gives only the whole number of times the divisor goes into the dividend, discarding any fractional part, so 17 DIV 5 = 3.
- 5
What is 17 MOD 5, and how do the quotient and remainder relate back to the original number?
Model answer
17 MOD 5 = 2. The remainder is what is left over after the whole divisions, so divisor x quotient + remainder returns the original: 5 × 3 + 2 = 17. When the operands are positive the remainder is always at least 0 and less than the divisor.
- 6
Contrast integer division with real division using 22 and 7.
Model answer
Real division gives 22 / 7 = 3.142857..., a real value with a fractional part. Integer division gives 22 DIV 7 = 3 with 22 MOD 7 = 1, two exact whole numbers. Real division answers how much each share is worth; integer division answers how many whole shares there are and what is left over.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Fundamentals of Programming, 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.