File Handling Question Bank - Assertion Reasoning
File Handling Question Bank - Assertion Reasoning
Q3. Assertion: When you open a file for writing, if the file Understanding
does not exist, an error occurs.
Reason: When you open a file for writing, if the file
exists, the existing file is overwritten with the new file.
Q26. Assertion: readline() function will read one line from the Knowledge
file. Understanding
Analysis
Reason: readlines() function will read all the lines from
the files.
Reason:
We can use readline( ) function which can read one line at
a time from the file.
Reason:
Seek() function with negative offset only works when file
is opened in binary mode.
myfile.close()
in the above code, data type of data_rec is a
list class.
Reason: Myfile.txt is a text file so it contains only list of
text lines.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q35 Assertion: f=open(‘story.txt’,’r+’) Knowledge and
Above statement will create a new file, it it is understanding
not exist.
Reason: when we open a file in write mode, it will create
a new file with same name.
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
Q36 Read the following statements and give the answer Analysis
Assertion: readline() read the files line by line
Reason: Without realine() lines from the file cannot be read
Q38 Read the following statements and give the answer Analysis
Assertion: seek (5,0) moves cursor after 5 bytes
Reason: It helps to read entire content after 5
characters
Q39. Read the following statements and give the answer Analysis
Assertion: readline(5) reads 5 characters from the
line.
Reason: next readline() read the same line.
Q40. Read the following statements and give the answer Analysis
Assertion: readlines() returns one line at a time
Reason: readlines() helps in counting number of lines
of the text file
Q56 Assertion: pickle module can save python objects into pickling process
binary file
Reason: pickling process converts python objects into
byte stream
(A) Both Assertion and reason are true and reason is
correct explanation of assertion.
(B) Assertion and reason both are true but reason is not
the correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
ANSWER
Question No Answer
Q1. (D) Assertion is false, reason is true.
Q2. (C) Assertion is true, reason is false.
Q3. (D) Assertion is false, reason is true.
Q4. (C) Assertion is true, reason is false
Q5. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q6. A
Q7. C
Q8. B
Q9. A
Q10. D
Q11. (A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q12. (D) Assertion is false, reason is true.
Q13. (C) Assertion is true, reason is false
Q14. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q15. (A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q16. A
Q17. A
Q18. B
Q19. A
Q20. A
Q21. A
Q22. C
Q23. A
Q24. C
Q25. A
Q26. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q27. (D) Assertion is false, reason is true.
Q28. (A) Both Assertion and reason are true and reason is correct
explanation of assertion.
Q29. (B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
Q30. (C) Assertion is true, reason is false.
Q31 C
Q32 C
Q33 A
Q34 B
Q35 D
Q36 C
Q37 B
Q38 A
Q39. B
Q40. D
Q41. A
Q42. B
Q43. B
Q44. A
Q45. B
Q46. (C) Assertion is true, reason is false
Q47. (B) Assertion and reason both are true but reason is not the
correct explanation of assertion
Q48. (A) Both Assertion and reason are true and reason is correct
explanation of assertion.
Q49. (A) Both Assertion and reason are true and reason is correct
explanation of assertion.
Q50. (D) Assertion is false, reason is true.
Q51 D
Q52 C
Q53 B
Q54 D
Q55 D
Q56 A
Q57 D
Q58 C
Q59 A
Q60 D
Q61 B
Q62 A
Q63 A
Q64 C
Q65 A
Q66.. a) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q67. c) Assertion is true, reason is false.
Q68. d) Assertion is false, reason is true.
Q69. a) Both Assertion and reason are true and reason is the correct
explanation of assertion.
Q70. c) Assertion is true, reason is false.