R7.1 What happens if you try to open a file for reading that doesn’t exist? What happens if you try to open a file for writing that doesn’t exist? An IOError occurs if you try to open a reading file that doesn’t exist. A new file will be created when you try to open a writing file that doesn’t exist. R7.2 What happens if you try to open a file for writing, but the file or device is write-protected (sometimes called read-only)? Try it out with a short test program. The program will have a PermissionError R7.3 How do you open a file whose name contains a backslash, like c:\temp\output.dat? You provide the backslash twice instead of once. R7.4 If a program Woozle is started with the command python woozle.py -Dname=piglet -Ieeyore -v heff.txt a.txt lump.txt what are the values of argv[0], argv[1], and so on? argv[0] =woozle.py argv[1] =-Dname=piglet argv[2] =-Ieeyore argv[3] =-v argv[4]=heff.txt argv[5] =a.txt argv[6]=lump.txt R7.5 What is the difference between raising an exception and handling an exception? Raising an exception= when you detect an error condition raise an exception Handling an exception= passing control from the point of error detection to a handler R7.6 When your program executes a raise statement, which statement is executed next? The first except statement that processes that type of exception R7.7 What happens if an exception does not have a matching except clause? It is passes to outer try statements If no handler is found , program stops with an error message R7.8 What can your program do with the exception object that an except clause receives? You can store the exception object in a variable and do anything with it R7.9 What is the difference between sequential access and random access? Sequential access- program reads/write to the file from the beginning to the end Random Access- program reads/writes info to the file anywhere in the data file R7.10 What is the difference between a text file and a binary file? A text file - alphabets, digits and other special characters A binary file- bytes Horstmann, C. S., Necaise, R. D. (11/2018). Python For Everyone, Enhanced eText, 3rd Edition [VitalSource Bookshelf version]. Retrieved from vbk://9781119498537