Skip to main contentSkip to solution

Match List-I with List-II

List-IList-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 IList 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".

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question