The floor function returns the greatest integer less than or equal to x. For −2.7, we need the greatest integer that is ≤ −2.7. That is −3 (since −3 < −2.7 < −2, and −3 is the greatest integer on the left). The common error is choosing −2, which is greater than −2.7, not less than or equal to it. For negative numbers, 'rounding down' means going further from zero — floor always moves toward negative infinity.
Question 2 Multiple Choice
A computer must divide an array of 15 elements into groups of 4 for parallel processing. If there are leftover elements, they still need a group. How many groups are required?
A3, because ⌊15/4⌋ = 3
B4, because ⌈15/4⌉ = 4
C3.75, because 15 ÷ 4 = 3.75
D4, because you always round up in computer science
When leftover elements still need a group, you need ⌈n/k⌉ groups — enough groups so no element is left behind. ⌈15/4⌉ = ⌈3.75⌉ = 4. Option A gives ⌊15/4⌋ = 3, which counts only complete groups — three groups of 4 handle 12 elements, leaving 3 unprocessed. Option C gives the real number, not an integer count. Option D happens to give the right answer but for the wrong reason — you use floor when counting complete groups and ceiling when counting groups needed to accommodate everyone.
Question 3 True / False
For any real number x, ⌊x⌋ generally rounds x toward zero.
TTrue
FFalse
Answer: False
Floor rounds toward negative infinity, not toward zero. For positive numbers, these happen to be the same direction (⌊3.7⌋ = 3 moves toward zero). But for negative numbers they diverge: ⌊−1.2⌋ = −2, which moves away from zero (further negative), not toward it. The correct statement is: floor returns the greatest integer ≤ x, which is always at or to the left of x on the number line — toward negative infinity.
Question 4 True / False
If x is not an integer, then ⌈x⌉ = ⌊x⌋ + 1.
TTrue
FFalse
Answer: True
For any non-integer x, the floor traps x from below (⌊x⌋ < x) and the ceiling traps x from above (⌈x⌉ > x). Since there are no integers between ⌊x⌋ and x, and no integers between x and ⌈x⌉, the ceiling must be exactly one more than the floor. The only exception is when x is itself an integer, in which case ⌊x⌋ = ⌈x⌉ = x, so the difference is 0.
Question 5 Short Answer
You need to find how many complete weeks fit in a 100-day period, and separately, how many weeks are needed to fully contain a 100-day period (i.e., no day is left uncovered). Express both answers using floor and ceiling functions and explain the difference.
Think about your answer, then reveal below.
Model answer: Complete weeks: ⌊100/7⌋ = ⌊14.28...⌋ = 14. Weeks needed to fully contain: ⌈100/7⌉ = ⌈14.28...⌉ = 15. The floor counts how many groups of 7 fit entirely within 100; the ceiling counts how many groups of 7 are needed so that every day falls in some week, even if the last week is incomplete.
This is the canonical application of floor vs. ceiling: floor for 'how many complete groups fit,' ceiling for 'how many groups are needed to cover everything.' The distinction arises everywhere in computing: dividing memory into pages, distributing tasks across processors, scheduling events. The formula ⌈n/k⌉ = ⌊(n + k − 1)/k⌋ is an equivalent way to compute the ceiling using only floor, useful in contexts where ceiling is not a built-in operation.