JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Python interview questions part 17
Python interview questions part 17
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is unpickling?
A. It is used for object serialization
B. It is used for object deserialization
C. None of the mentioned
D. All of the mentioned
Show Correct Answer
Correct Answer is :
It is used for object deserialization
2. What is the correct syntax of open() function?
A. file = open(file_name [, access_mode][, buffering])
B. file object = open(file_name [, access_mode][, buffering])
C. file object = open(file_name)
D. none of the mentioned
Show Correct Answer
Correct Answer is :
file object = open(file_name [, access_mode][, buffering])
3. What is the output of this program? fo = open("foo.txt", "wb")print "Name of the file: ", fo.namefo.flush()fo.close()
A. Compilation Error
B. Runtime Error
C. No Output
D. Flushes the file when closing them
Show Correct Answer
Correct Answer is :
Flushes the file when closing them
4. Correct syntax of file.writelines() is?
A. file.writelines(sequence)
B. fileObject.writelines()
C. fileObject.writelines(sequence)
D. none of the mentioned
Show Correct Answer
Correct Answer is :
fileObject.writelines(sequence)
5. Correct syntax of file.readlines() is?
A. fileObject.readlines( sizehint );
B. fileObject.readlines();
C. fileObject.readlines(sequence)
D. none of the mentioned
Show Correct Answer
Correct Answer is :
fileObject.readlines( sizehint );
6. In file handling, what does this terms means “r, a”?
A. read, append
B. append, read
C. all of the mentioned
D. none of the the mentioned
Show Correct Answer
Correct Answer is :
read, append
7. What is the use of “w” in file handling?
A. Read
B. Write
C. Append
D. None of the the mentioned
Show Correct Answer
Correct Answer is :
Write
8. What is the use of “a” in file handling?
A. Read
B. Write
C. Append
D. None of the the mentioned
Show Correct Answer
Correct Answer is :
Append
9. Which function is used to read all the characters?
A. Read()
B. Readcharacters()
C. Readall()
D. Readchar()
Show Correct Answer
Correct Answer is :
Read()
10. Which function is used to read single line from file?
A. Readline()
B. Readlines()
C. Readstatement()
D. Readfullline()
Show Correct Answer
Correct Answer is :
Readlines()
11. Which function is used to write all the characters?
A. write()
B. writecharacters()
C. writeall()
D. writechar()
Show Correct Answer
Correct Answer is :
write()
12. Which function is used to write a list of string in a file
A. writeline()
B. writelines()
C. writestatement()
D. writefullline()
Show Correct Answer
Correct Answer is :
writeline()
13. Which function is used to close a file in python?
A. Close()
B. Stop()
C. End()
D. Closefile()
Show Correct Answer
Correct Answer is :
Close()
14. Is it possible to create a text file in python?
A. Yes
B. No
C. Machine dependent
D. All of the mentioned
Show Correct Answer
Correct Answer is :
Yes
15. Which of the following is modes of both writing and reading in binary format in file.?
A. wb+
B. w
C. wb
D. w+
Show Correct Answer
Correct Answer is :
wb+
16. Which of the following is not a valid mode to open a file?
A. ab
B. rw
C. r+
D. w+
Show Correct Answer
Correct Answer is :
rw
17. What is the difference between r+ and w+ modes?
A. no difference
B. in r+ the pointer is initially placed at the beginning of the file and the pointer is at the end for w+
C. in w+ the pointer is initially placed at the beginning of the file and the pointer is at the end for r+
D. depends on the operating system
Show Correct Answer
Correct Answer is :
in r+ the pointer is initially placed at the beginning of the file and the pointer is at the end for w+
18. How do you get the name of a file from a file object (fp)?
A. fp.name
B. fp.file(name)
C. self.__name__(fp)
D. fp.__name__()
Show Correct Answer
Correct Answer is :
fp.name
19. Which of the following is not a valid attribute of a file object (fp)?
A. fp.name
B. fp.closed
C. fp.mode
D. fp.size
Show Correct Answer
Correct Answer is :
fp.size
20. How do you close a file object (fp)?
A. close(fp)
B. fclose(fp)
C. fp.close()
D. fp.__close__()
Show Correct Answer
Correct Answer is :
fp.close()
Similar Interview Questions
Search for latest jobs
Find Jobs