मराठी

Consider the statement given below: f1 = open(“pqr.dat”,“______”) Which of the following is the correct file mode to open the file in read only mode? - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Consider the statement given below:

f1 = open(“pqr.dat”,“______”)

Which of the following is the correct file mode to open the file in read only mode?

पर्याय

  • a

  • rb

  • r+

  • rb+

MCQ
Advertisements

उत्तर

rb

Explanation:

  1. File Type: The extension .dat Usually indicates a binary file.
  2. Read-Only Mode: In Python, the character 'r' is used for reading. Adding ‘b’ specifies that the file should be opened in binary mode.
  3. Why others are wrong:
    • ‘a’ is for appending data.
    • ‘r+’ allows both reading and writing.
    • ‘rb+’ allows reading and writing in binary format.
  •  
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2025-2026 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×