Professional Documents
Culture Documents
One Marks
One Marks
A) True
B) False
Ans : A
Explanation
It is possible to delete an object of the class. On further
typing obj in the python shell, it throws an error
because the defined object has now been deleted.
Unit 4 – Files
1)The readlines() method returns ____________
A) Str
B) a list of lines
C) a list of single characters
D) a list of integers
Ans: A
Explanation
Every line is stored in a list and returned.
2)To read the remaining lines of the file from a file object
infile, we use ____________
A) infile.read(2)
B) infile.read()
C) infile.readline()
D) infile.readlines()
Ans: D
Explanation
Execute in the shell to verify.
A) True
B) False
C) None
D) Error
Ans: A
Explanation
The WITH statement when used with open file
guarantees that the file object is closed when the with
block exits