Dear candidates you will find MCQ questions of Python here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
R
Q. What is the output of the following program?
import sys L1 = tuple() print(sys.getsizeof(L1), end = " ") L1 = (1, 2) print(sys.getsizeof(L1), end = " ") L1 = (1, 3, (4, 5)) print(sys.getsizeof(L1), end = " ") L1 = (1, 2, 3, 4, 5, [3, 4], 'p', '8', 9.777, (1, 3)) print(sys.getsizeof(L1))
R
Q. What is the output of the following program?
T = (1, 2, 3, 4, 5, 6, 7, 8) print(T[T.index(5)], end = " ") print(T[T[T[6]-3]-6])
R
Q. What is the output of the following program?
L = [1, 3, 5, 7, 9] print(L.pop(-3), end = ' ') print(L.remove(L[0]), end = ' ') print(L)
R
Q. What is the output of the following program? def REVERSE(L):
L.reverse() return(L) def YKNJS(L): List = list() List.extend(REVERSE(L)) print(List) L = [1, 3.1, 5.31, 7.531] YKNJS(L)
R
Q. What is the output of the following program?
from math import sqrt L1 = [x**2 for x in range(10)].pop() L1 + = 19 print(sqrt(L1), end = " ") L1 = [x**2 for x in reversed(range(10))].pop() L1 + = 16 print(int(sqrt(L1)))
R
Q. What is the output of the following program?
D = dict() for x in enumerate(range(2)): D[x[0]] = x[1] D[x[1]+7] = x[0] print(D)
R
Q. What is the output of the following program?
D = {1 : 1, 2 : '2', '1' : 1, '2' : 3} D['1'] = 2 print(D[D[D[str(D[1])]]])
R
Q. What is the output of the following program?
D = dict() for i in range (3): for j in range(2): D[i] = j print(D)
R
Q. What is the output of the following program?
from math import * a = 2.13 b = 3.7777 c = -3.12 print(int(a), floor(b), ceil(c), fabs(c))
R
Q. What is the output of the following program?
import string import string Line1 = "And Then There Were None" Line2 = "Famous In Love" Line3 = "Famous Were The Kol And Klaus" Line4 = Line1 + Line2 + Line3 print(string.find(Line1, 'Were'), string.count((Line4), 'And'))
Don't have account? Register here.