Skip to content
CodeKruPro

File modes: r, w, a and x

QuizEasy-MediumPython onlyAsked in: Cognizant, Infosys

Which statements about open() modes are true? Pick all that apply.

  • "w" creates the file or empties an existing one
  • "a" adds to the end of the file
  • "x" creates a new file and raises FileExistsError if it already exists
  • "r" creates the file if it is missing

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in