placeholder image to represent content

File handling in Python

Quiz by Mrs N Stammers

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
9 questions
Show answers
  • Q1
    What is the method used to close a file in Python?
    delete()
    close()
    remove()
    rename()
    30s
  • Q2
    What is the mode used to create a new file in Python?
    'r'
    'w'
    'a'
    'x'
    30s
  • Q3
    What method is used to write to a file in Python?
    delete()
    read()
    append()
    write()
    30s
  • Q4
    How do you open a file for reading and writing in Python?
    'r+'
    'w'
    'r'
    'a'
    30s
  • Q5
    What method is used to read the contents of a file in Python?
    write()
    append()
    delete()
    read()
    30s
  • Q6
    What keyword is used to create a file object in Python?
    read
    write
    close
    open
    30s
  • Q7
    What is the default mode for opening a file in Python?
    'a'
    'r'
    'x'
    'w'
    30s
  • Q8
    What function in Python is used to delete a file?
    os.rename
    os.chdir
    os.remove
    os.path
    30s
  • Q9
    How do you check if a file exists in Python?
    os.path.access()
    os.path.directory()
    os.path.isfile()
    os.path.exists()
    30s

Teachers give this quiz to your class