On This Page

This set of Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Python Programming Set 1

Q1 | What is the output of the following code : print 9//2
Q2 | Which function overloads the >> operator?
Q3 | What is the output of the following program :i = 0while i < 3:print iprint i+1
Q4 | What is the output of the following program:
Q5 | Which module in Python supports regular expressions?
Q6 | What is the output of the following program :
Q7 | Which of these is not a core data type?
Q8 | What data type is the object below?L = [1, 23, „hello?, 1]
Q9 | What is the output of the following program :def myfunc(a):a = a + 2a = a * 2return aprint myfunc(2)
Q10 | What is the output of the expression : 3*1**3
Q11 | What is the output of the following program :print '{0:.2}'.format(1.0 / 3)
Q12 | What is the output of the following program :print '{0:-2%}'.format(1.0 / 3)
Q13 | What is the output of the following program :i = 0while i < 3:print ii += 1else:print 0
Q14 | What is the output of the following program :i = 0while i < 5:print(i)i += 1if i == 3:breakelse:print(0)
Q15 | What is the output of the following program : print 'cd'.partition('cd')
Q16 | What is the output of the following program :print 'abcefd'.replace('cd', '12')
Q17 | What will be displayed by the following code?def f(value, values):v = 1values[0] = 44t = 3v = [1, 2, 3]f(t, v)print(t, v[0])
Q18 | Predict the output of following python programsdictionary1 = {'Google' : 1,'Facebook' : 2,'Microsoft' : 3}dictionary2 = {'GFG' : 1,'Microsoft' : 2,'Youtube' : 3}dictionary1.update(dictionary2);for key, values in dictionary1.items():print(key, values)
Q19 | What is the output of the following program?dictionary1 = {'GFG' : 1,'Google' : 2,'GFG' : 3}print(dictionary1['GFG']);
Q20 | What is the output of the following program?temp = dict()temp['key1'] = {'key1' : 44, 'key2' : 566}temp['key2'] = [1, 2, 3, 4]for (key, values) in temp.items():print(values, end = "")
Q21 | What is the output of the following program?data = [2, 3, 9]temp = [[x for x in[data]] for x in range(3)]print (temp)
Q22 | What is the output of the following program?data = [x for x in range(5)]temp = [x for x in range(7) if x in data and x%2==0]print(temp)
Q23 | What is the output of the following program?L1 = [1, 2, 3, 4]L2 = L1L3 = L1.copy()L4 = list(L1)L1[0] = [5]print(L1, L2, L3, L4)
Q24 | What is the output of the following program?import sysL1 = 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))
Q25 | 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])