Python MCQ Questions Set-3

python-mcq
Q1: What is the output of the following code − a = (1, 2) a[0] +=1 a)(1,1,2) b)2 c)Type Error d)Syntax Error Answer: C Q2: Suppose we have two sets A & B, then A<B is: a)True if len(A) is less than len(B). b)True if A is a proper subset of B. c)True if the elements in A when compared are less than the elements in B. d)True if A is a proper superset of B. Answer : B Q3: Select the reserved keyword in python a) else b) import c) raise d) All of these Ans: D Q4...
Read More

Python MCQ Questions Set-1

python-mcq
This Python MCQ Questions and Answers are based on important and latest topics of Python programming. Q1: What will be the output of the following Python code? class A(): def disp(self): print("A disp()") class B(A): pass obj = B() obj.disp() a) Invalid syntax for inheritance b) Error because when object is created, argument must be passed c) Nothing is printed d) A disp() Answer: d Q2: What will be the output of the following Python code? class Test: de...
Read More