Posts

File Handling Theory Questions

Computer Science  ( Class XII Sc )  ( Subject Code 083) Q1. Difference between r+ and rb+ mode Both modes open file in reading and writing mode and the  file pointer is placed at the beginning of file. But rb+ is used for binary files Q2. Write statements for following purpose (a) Open file abc.txt in read mode       f1=open("abc.txt",r) (b) Open file abc.txt in write mode       f1=open("abc.txt",w) Q3. rename file test1 to test2 import  os # Rename a file from test1.txt to test2.txt os.rename ( "test1.txt", "test2.txt" ) Q4.Write a statement in python so that new contents can be added in the end of text file abc.txt f1=opne("abc.txt",a) # Open file in append mode Q5. What is file object and file modes? File object is a reference of file available on Disk. f1=open("abc.txt",r) f1 is File object reference the file abc.txt . This is used  to perform operations on file. r mode is used for reading file. “  r  “, for reading. “  w 
Recent posts