levo

Recursion and Modular Programming

Integer division with DIV and MOD

  • 3 things to know
  • Component 1

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.

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.

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

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.

KDW to HAT.
decryptsencryptscompresses

Blank Blitz makes facts automatic

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

AThe two are not the same.
BOpen source refers to the availability of the code.
CMuch open source software is free of charge.

Build It gets the exam shape right

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

Backup means the copy of the data.
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.

Every question in Recursion and Modular 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.