Untitled

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

which one of the following is the right way to close a file?

  • file.close() (correct)
  • close(file)
  • close("file")
  • file.closed

if a file File.txt has 10 lines written in it, what will be the result of the following line? len(open("File.txt").readlines())

  • 0
  • 1
  • 5
  • 10 (correct)

a file is stored in ____ memory

  • primary
  • cache
  • volatile
  • secondary (correct)

what will happen when a file is opened in write mode and then immediately closed?

<p>file contents are deleted (B)</p> Signup and view all the answers

which one of the following is the right way to write "Good Morning" in a file?

<p>file.write(&quot;Good Morning&quot;) (D)</p> Signup and view all the answers

which method is used to read a single line from the file?

<p>readline() (C)</p> Signup and view all the answers

the default access mode is _______

<p>r (A)</p> Signup and view all the answers

by default, a new file is created in which directory?

<p>current working directory (A)</p> Signup and view all the answers

what is the purpose of the with statement in python file handling?

<p>to ensure that a file is properly closed after its operations are completed (D)</p> Signup and view all the answers

what is the purpose of the see() method in python file handling?

<p>to set the current position in a file (D)</p> Signup and view all the answers

Flashcards are hidden until you start studying

Use Quizgecko on...
Browser
Browser