Python - MCQ

Multiple Choice Questions


Share with a Friend

 

Python MCQ - File I/O Handling and Exception Handling - Set 41

26. What is true for file mode x
A). Create a file if the specified file does not exist
B). Create a file, returns an error if the file exists
C). Create a file if it doesn’t exists else Truncate the existed file
D).
View Answer
Correct: B


27. What is the output of the following print() function

print(sep='--', 'Ben', 25, 'California')
A). Syntax Error
B). Ben–25–California
C). Ben 25 California
D).
View Answer
Correct: B


28. What is the output of print('[%c]' % 65)
A). 65
B). A
C). [A]
D). Syntax Error
View Answer
Correct: C


29. What will be displayed as an output on the screen

x = float('NaN')
print('%f, %e, %F, %E' % (x, x, x, x))
A). nan, nan, NAN, NAN
B). nan, NaN, nan, NaN
C). NaN, NaN, NaN, NaN,
D).
View Answer
Correct: A


30. What is the output of the following code

print('ITDeveloper ', end='//')
print(' is for ', end='//')
print(' Programming Lovers', end='//')
A).
 
ITDeveloper / is for / Programming Lovers /
B).
 
ITDeveloper // is for // Programming Lovers //
C). ITDeveloper // is for // Programming Lovers//
D). ITDeveloper / is for / Programming Lovers/
View Answer
Correct: C



 
 
 
   
   
   
UltraInfo Technologies
ITDeveloper