levo

Recursion and Modular Programming

Integer division with DIV and MOD

  • 3 things to know
  • Component 1
Start revising · £5/month

Overview

The whole-number quotient and the remainder, worked with real figures, and the jobs they do — extracting digits, converting units, and testing divisibility.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What does the DIV operator return?

Key term

What does the MOD operator return?

Key term

State the values of 17 DIV 5 and 17 MOD 5.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What does the DIV operator return?

    Model answer

    DIV returns the whole number part of a division and discards the remainder. A DIV expression always evaluates to an integer.

  2. 2

    What does the MOD operator return?

    Model answer

    MOD returns the remainder left after an integer division. A MOD expression always gives a value smaller than the divisor.

  3. 3

    State the values of 17 DIV 5 and 17 MOD 5.

    Model answer

    17 DIV 5 gives 3 and 17 MOD 5 gives 2. The two results recombine as 3 × 5 + 2 = 17.

  4. 4

    State the values of 100 DIV 7 and 100 MOD 7.

    Model answer

    100 DIV 7 gives 14 and 100 MOD 7 gives 2. The check is 14 × 7 + 2 = 100.

  5. 5

    How would a program convert 250 seconds into whole minutes and remaining seconds?

    Model answer

    250 DIV 60 gives 4 minutes and 250 MOD 60 gives 10 seconds. The time is therefore 4 minutes and 10 seconds.

  6. 6

    How would a program convert 1375 pence into pounds and pence?

    Model answer

    1375 DIV 100 gives 13 pounds and 1375 MOD 100 gives 75 pence. The amount is £13.75.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Data Structures: Arrays, Records and Hash Tables
Stacks, Queues, Linked Lists and Trees
Boolean Logic and Simplification
Algorithms, Pseudo-Code and Programming Constructs

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

KDW to HAT.
decryptsencryptscompresses

Blank Blitz consolidates the facts

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

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

Backup means the copy of the data.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

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

Every question in Recursion and Modular Programming, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

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