Q.1.
Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?
Q.2.
Which one of the following is not attributes of file?
Q.3.
What is the use of tell() method in python?
Q.4.
What is the current syntax of rename() a file?
Q.5.
What is the current syntax of remove() a file?
Q.6.
What will be the output of the following Python code? fo = open("foo.txt", "rw+")print "Name of the file: ", fo.name # Assuming file has following 5 lines# This is 1st line# This is 2nd line# This is 3rd line# This is 4th line# This is 5th line for index in range(5): line = fo.next() print "Line No %d - %s" % (index, line) # Close opened filefo.close()
Q.7.
What is the use of seek() method in files?
Q.8.
What is the use of truncate() method in file?