On This Page

This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 34

Q1 | print(f.closed)
  • true
  • false
  • none
  • error
Q2 | Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?
  • raw_input & input
  • input & scan
  • scan & scanner
  • scanner
Q3 | Which one of the following is not attributes of file?
  • closed
  • softspace
  • rename
  • mode
Q4 | What is the use of tell() method in python?
  • tells you the current position within the file
  • tells you the end position within the file
  • tells you the file is opened or not
  • none of the mentioned
Q5 | What is the current syntax of rename() a file?
  • rename(current_file_name, new_file_name)
  • rename(new_file_name, current_file_name,)
  • rename(()(current_file_name, new_file_name))
  • none of the mentioned
Q6 | What is the current syntax of remove() a file?
  • remove(file_name)
  • remove(new_file_name, current_file_name,)
  • remove(() , file_name))
  • none of the mentioned
Q7 | fo.close()
  • compilation error
  • syntax error
  • displays output
  • none of the mentioned
Q8 | What is the use of seek() method in files?
  • sets the file’s current position at the offset
  • sets the file’s previous position at the offset
  • sets the file’s current position within the file
  • none of the mentioned
Q9 | What is the use of truncate() method in file?
  • truncates the file size
  • deletes the content of the file
  • deletes the file size
  • none of the mentioned
Q10 | Which is/are the basic I/O connections in file?
  • standard input
  • standard output
  • standard errors
  • all of the mentioned
Q11 | Which of the following mode will refer to binary data?
  • r
  • w
  • +
  • b
Q12 | What is the pickling?
  • it is used for object serialization
  • it is used for object deserialization
  • none of the mentioned
  • all of the mentioned
Q13 | What is unpickling?
  • it is used for object serialization
  • it is used for object deserialization
  • none of the mentioned
  • all of the mentioned
Q14 | What is the correct syntax of open() function?
  • file = open(file_name [, access_mode][, buffering])
  • file object = open(file_name [, access_mode][, buffering])
  • file object = open(file_name)
  • none of the mentioned
Q15 | fo.close()
  • compilation error
  • runtime error
  • no output
  • flushes the file when closing them
Q16 | Correct syntax of file.writelines() is?
  • file.writelines(sequence)
  • fileobject.writelines()
  • fileobject.writelines(sequence)
  • none of the mentioned
Q17 | Correct syntax of file.readlines() is?
  • fileobject.readlines( sizehint );
  • fileobject.readlines();
  • fileobject.readlines(sequence)
  • none of the mentioned
Q18 | In file handling, what does this terms means “r, a”?
  • read, append
  • append, read
  • write, append
  • none of the mentioned
Q19 | What is the use of “w” in file handling?
  • read
  • write
  • append
  • none of the mentioned
Q20 | What is the use of “a” in file handling?
  • read
  • write
  • append
  • none of the mentioned
Q21 | Which function is used to read all the characters?
  • read()
  • readcharacters()
  • readall()
  • readchar()
Q22 | Which function is used to read single line from file?
  • readline()
  • readlines()
  • readstatement()
  • readfullline()
Q23 | Which function is used to write all the characters?
  • write()
  • writecharacters()
  • writeall()
  • writechar()
Q24 | Which function is used to write a list of string in a file?
  • writeline()
  • writelines()
  • writestatement()
  • writefullline()
Q25 | Is it possible to create a text file in python?
  • yes
  • no
  • machine dependent
  • all of the mentioned