Match List-I with List-II
List-I List-II (A) read() (I) writes the list of strings to the file (B) write() (II) reads the specified number of characters from the file (C) writelines() (III) writes the string to the file (D) readlines() (IV) reads the file line by line into a list
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A) read() | (I) writes the list of strings to the file |
| (B) write() | (II) reads the specified number of characters from the file |
| (C) writelines() | (III) writes the string to the file |
| (D) readlines() | (IV) reads the file line by line into a list |
Solution
✅ Correct Option: 3
| List I | List II |
|---|---|
| (A) read() | (II) reads the specified number of characters from the file |
| (B) write() | (III) writes the string to the file |
| (C) writelines() | (I) writes the list of strings to the file |
| (D) readlines() | (IV) reads the file line by line into a list |
read(n) returns n characters, or the whole file if n is not given.
writelines() does not add newline characters on its own, so each string in the list must already end with "\n".
Related questions:
2025: 14 May Shift 1
2025: 14 May Shift 1
2025: 27 May Shift 2