Python - MCQ
Multiple Choice Questions
Python MCQ - File I/O Handling and Exception Handling - Set 40
21. Which of the following is incorrect file handling mode in Python
A). r
B). x
C). t+
D). b
View Answer
Correct: C
22. Use the following file to predict the output of the code
test.txt Content:
aaa
bbb
ccc
ddd
eee
fff
ggg
Code:
f = open("test.txt", "r")
print(f.readline(3))
A). bbb
B). Syntax Error
C). aaa
D). aa
View Answer
Correct: C
23. Which of the following is incorrect file handling mode in Python
A). wb+
B). ab
C). xr
D). ab+
View Answer
Correct: C
24. In Python3, which functions are used to accept input from the user
A). input()
B). raw_input()
C). rawinput()
D). string()
View Answer
Correct: A
25. What is the output of print('%x, %X' % (15, 15))
A). 15 15
B). F F
C). f f
D). f F
View Answer
Correct: D