Question:medium

Match List-I with List-II:
List-IList-II
(A) readline()(I) Writes a sequence of strings to the file
(B) writelines()(II) Reads a single line from the file
(C) seek()(III) Force any buffered output to be written to the file
(D) flush()(IV) Moves the file pointer to the specified position

Updated On: Jan 16, 2026
  • (A) - (I), (B) - (II), (C) - (III), (D) - (IV)
  • (A) - (II), (B) - (I), (C) - (IV), (D) - (III)
  • (A) - (II), (B) - (I), (C) - (III), (D) - (IV)
  • (A) - (III), (B) - (IV), (C) - (I), (D) - (II)
Show Solution

The Correct Option is B

Solution and Explanation

To accurately associate the methods and their functions from List-I and List-II, an analysis of each is provided:

  • (A) readline(): This method performs the action of reading a single line from a file. Consequently, it corresponds to (II).
  • (B) writelines(): This method is designed to write a sequence of strings to a file. Therefore, it matches with (I).
  • (C) seek(): This method enables the movement of the file pointer to a specific position within the file. Hence, it aligns with (IV).
  • (D) flush(): This method ensures that any buffered output is written to the file. Thus, it is matched with (III).
List-IList-II
(A) readline()(II) Reads a single line from the file
(B) writelines()(I) Writes a sequence of strings to the file
(C) seek()(IV) Moves the file pointer to the specified position
(D) flush()(III) Force any buffered output to be written to the file

The definitive pairings are: (A) - (II), (B) - (I), (C) - (IV), and (D) - (III).

Was this answer helpful?
0