logo

AQA A-Level Computer Science practice

For each value below, state the result of rounding it to the nearest whole number and the result of truncating it to a whole number: 6.4 and 6.8. Include suitable Python 3 expressions.

Try the question first, then check the answer and practise the same topic again.

At a glance

Question

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

For each value below, state the result of rounding it to the nearest whole number and the result of truncating it to a whole number: 6.4 and 6.8. Include suitable Python 3 expressions.

Answer and explanation

Concise answer

For 6.4: round(6.4) gives 6 and int(6.4) gives 6.

Why this is correct

Rounding selects the nearest whole number, so 6.4 rounds to 6 and 6.8 rounds to 7. Truncation removes the fractional part without increasing the value, so both 6.4 and 6.8 become 6 when converted to an integer using int().

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions