Skip to content

2024 Sep OPPE 2 - Set 3

Section 1 · Question 1

Product of Sum and Abs Diff of Digits

Compute (tens + units) × |tens − units| for a two-digit number. Covers digit extraction with // 10 and % 10, and the zero-product edge case.

Solved
Section 1 · Question 2

Check Divisibility by Last Two Digits

Return True if a number is divisible by both its last two digits. Covers (num // 10) % 10 for the tens digit, zero guard, and the divisibility test.

Solved
Section 1 · Question 3

Swap Last Chars in Dictionary Values

In-place swap of the last characters of two dictionary values. Covers v[:-1] + new_char, the importance of reading both values before writing, and in-place mutation.

Solved
Section 2 · Question 1

Get Words That Come After "the"

Collect all words immediately following "the" (case-insensitive). Covers word.lower(), index-based iteration with range(len-1), and the adjacent-pair zip pattern.

Solved
Section 2 · Question 2

Ceil Marks to Nearest Tens if Close

Round up marks to the next ten if the units digit is 8 or 9, printing only updated records. Full I/O - covers marks % 10 in (8, 9) and (marks // 10 + 1) * 10.

Solved
Section 3 · Question 1

Cartesian Points Processing

Three operations on a set of points - sort by distance to y-axis, closest to origin, group by quadrant. Covers math.atan2, tuple keys for multi-criteria sorting, and setdefault grouping.

Solved
Section 3 · Question 2

Fill First n Blanks with 1 to n

Replace the first n underscores in a multi-line file with sequential numbers. File I/O → stdout - covers persistent counters across lines and multi-digit replacements of single characters.

Solved