IT 116: Introduction to Scripting
Answers to Class 17 Ungraded Quiz

  1. What is a file?
    a linear arrangement of data on a storage medium
  2. What are the two things that uniquely specify a file?
    name and location
  3. What must you create to work with a file in Python?
    a file object
  4. What is the Python function that creates the thing you need to work with a file?
  5. What two things does this function do?
    creates a file object and returns a reference to it
  6. What two pieces of information do you need to give this function as arguments?
    pathname and access mode
  7. What are the three ways you can open a file?
    reading, writing, appending
  8. What are the two things that make up a pathname?
    path to the file (location) and name of file
  9. If I have a variable named file, what is the Python statement I would write to write the work "hello" to the file?
  10. What Python statement should I write when I am finished using the file variable mentioned above?