OA FINAL PAPER 2026 COMPLETE
SOLUTION QUESTIONS GRADED A+
⩥ rstrip() method.
Answer: The .rstrip("\n") method removes just the newline at the end of
the string.
⩥ with open(...) as f:.
Answer: This syntax is a context manager in file handling that ensures
the file is closed when exiting the block.
⩥ if, elif, else statements.
Answer: They allow you to execute code conditionally, with indentation
marking the code blocks for each branch.
⩥ for loop in Python.
Answer: A for loop in Python iterates directly over elements of a
sequence (like a list, tuple, string, or range), rather than using an index
counter.
⩥ C-style for loop.
,Answer: A C-style loop typically uses an index counter, such as for (int
i=0; i<n; i++) { ... }.
⩥ range() function.
Answer: range() generates a sequence of numbers and is often used in
for-loops when you need to loop a certain number of times or over
indices.
⩥ enumerate() function.
Answer: enumerate() allows you to loop over a sequence while keeping
track of the index.
⩥ leading/trailing whitespace.
Answer: Leading/trailing whitespace includes spaces and newline
characters at the beginning or end of a string.
⩥ file handling.
Answer: File handling refers to the process of reading from and writing
to files in a programming context.
⩥ IT automation.
Answer: IT automation involves using technology to perform tasks with
reduced human intervention, particularly in data exports/imports.
, ⩥ conditional execution.
Answer: Conditional execution allows code to run based on whether a
condition evaluates to true or false.
⩥ off-by-one errors.
Answer: Off-by-one errors occur when a loop iterates one time too many
or too few, often due to incorrect index handling.
⩥ text file processing.
Answer: Text file processing involves reading and manipulating text
data from files.
⩥ programmatic resource management.
Answer: Programmatic resource management refers to the systematic
handling of resources like files and network connections in code.
⩥ range().
Answer: Generates a sequence of numbers; for example, range(5)
generates 0,1,2,3,4.
⩥ range(start, stop, step).
Answer: Specifies a start, stop, and step; for example, range(2, 10, 2)
gives 2,4,6,8.