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?
  • a) Raw_input & Input
  • b) Input & Scan
  • c) Scan & Scanner
  • d) Scanner
Q.2
Which one of the following is not attributes of file?
  • a) closed
  • b) softspace
  • c) rename
  • d) mode
Q.3
What is the use of tell() method in python?
  • a) tells you the current position within the file
  • b) tells you the end position within the file
  • c) tells you the file is opened or not
  • d) none of the mentioned
Q.4
What is the current syntax of rename() a file?
  • a) rename(current_file_name, new_file_name)
  • b) rename(new_file_name, current_file_name,)
  • c) rename(()(current_file_name, new_file_name))
  • d) none of the mentioned
Q.5
What is the current syntax of remove() a file?
  • a) remove(file_name)
  • b) remove(new_file_name, current_file_name,)
  • c) remove(() , file_name))
  • d) none of the mentioned
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()
  • a) Compilation Error
  • b) Syntax Error
  • c) Displays Output
  • d) None of the mentioned
Q.7
What is the use of seek() method in files?
  • a) sets the file’s current position at the offset
  • b) sets the file’s previous position at the offset
  • c) sets the file’s current position within the file
  • d) none of the mentioned
Q.8
What is the use of truncate() method in file?
  • a) truncates the file size
  • b) deletes the content of the file
  • c) deletes the file size
  • d) none of the mentioned
0 h : 0 m : 1 s