Each question in this quiz is timed.
What is the output of the following print() function
print(sep='--', 'Ben', 25, 'California')
Syntax Error
Ben–25–California
Ben 25 California
What is the output of the following print() function ?
print('%d %d %.2f' % (11, '22', 11.22))
11 22 11.22
TypeError
11 ’22’ 11.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)) f.close()
bbb
aaa
aa
What will be displayed as an output on the screen
x = float('NaN') print('%f, %e, %F, %E' % (x, x, x, x))
nan, nan, NAN, NAN
nan, NaN, nan, NaN
NaN, NaN, NaN, NaN,
What is the output of
print('[%c]' % 65)
65
A
[A]
In Python3, Whatever you enter as input, the input() function converts it into a string
print('%x, %X' % (15, 15))
15 15
F F
f f
f F
Which of the following is incorrect file handling mode in Python
wb+
ab
xr
ab+
r
x
t+
b
What is the output of the following code
print('PYnative ', end='//') print(' is for ', end='//') print(' Python Lovers', end='//')
PYnative / is for / Python Lovers /
PYnative // is for // Python Lovers //
PYnative // is for // Python Lovers//
PYnative / is for / Python Lovers/
What is true for file mode x
create a file if the specified file does not exist
Create a file, returns an error if the file exists
Create a file if it doesn’t exists else Truncate the existed file
In Python3, which functions are used to accept input from the user
input()
raw_input()
rawinput()
string()