What is the output of this code? a,b=1,0 a=a^b b=a^b a=a^b print(a)
Correct
Incorrect
Question 2 of 14
2. Question
What is the value of this expression? 2**2**3**1
Correct
Incorrect
Question 3 of 14
3. Question
Select all the correct statements. Please select 3 correct answers
Correct
Incorrect
Question 4 of 14
4. Question
How will you open a file for reading as a text file? Please select 2 correct answers
Correct
Incorrect
Question 5 of 14
5. Question
Suppose you have two sets s1 = {1, 2, 3} and s2 = {3, 4, 5}. Which of the following statements give us their union? Please select 5 correct answers
Correct
Incorrect
Question 6 of 14
6. Question
Polymorphism is when a subclass can modify the behavior of its superclass.
Correct
Incorrect
Question 7 of 14
7. Question
What will be the output of the following code? >>> scores = {‘Ayushi’: 97, ‘Megha’: 98} >>> if scores[‘Ayushi’]>97: print(“Scholar”) elif scores[‘Megha’]>97: print(“Topper”) elif scores[‘Melanie’]>97: print(“Teacher”) else: print(“Nobody topped”)
Correct
Incorrect
Question 8 of 14
8. Question
What is the output of the following code? >>> list = [‘a’, ‘b’, ‘c’] >>> list += ‘de’ >>> print(list)
Correct
Incorrect
Question 9 of 14
9. Question
What is the output of the following code? >>> val = 154 >>> while(not(val)): val**=2 else: val//=2
>>> print(val)
Correct
Incorrect
Question 10 of 14
10. Question
What will this code print? >>> from random import randint
>>> for i in range(5): print(random(1, 5))
Correct
Incorrect
Question 11 of 14
11. Question
Choose the correct output for this code: >>> a=1 >>> def func(a): return a**2
>>> a = func(a)**2 >>> print(func(a))
Correct
Incorrect
Question 12 of 14
12. Question
How many levels deep are sublists in this list? >>> l = list() >>> l.append([1, 2, [3, 4]]) >>> l.extend([5, 6, 7]) >>> print(l)
Correct
Incorrect
Question 13 of 14
13. Question
How many stars does this program output? i=7 while i>0: i-=3 print(‘*’) if i<=2: break else: print(‘*’)
Correct
Incorrect
Question 14 of 14
14. Question
Select the incorrect statements: I. Constructors cannot return values II. The __bases__ attribute will give you the names of the direct parent classes III. issubclass(A, B) returns True if A is an object derived from class B IV. Function overloading is an effective way to implement polymorphism in Python
Correct
Incorrect
Here we come to the end of the Python Quiz. Hope you enjoyed it!!!
Do share your feedback and score in the comments section.
You give me 15 seconds I promise you best tutorials Please share your happy experience on Google
DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.
Admin,in question 13 answer should be 3. You have given 2 as the correct answer. Please see to it and make the necessary correction so that its helpful for everyone.
Need some more questions like this…
Only 6 right answers
Thought I was at intermediate level before attempting this quiz. My bad
6 correct answers. Question no.13 doesn’t have input. Please check.
Only 7 correct
That was a nice experience….even though i am a beginner….i jus gave it a try and scored 8 out of 14….want some more…..
Hi Allen,
Thanks for sharing your experience. There are more Python quizzes coming your way. Till then, try the first Python quiz and test your skills.
It was good experience
Hi Gk,
Thanks for your kind words. Share the Python quiz on Facebook and Linkedin & let others also take benefit from it.
Good test…
Made 7 correct attempts:)
Hi Chandra,
Practice the concepts in which your answers got incorrect from our Python Tutorial Series. And, share the quiz on social media with your friends.
Only 5
Hi Yogesh,
No need to worry, if you got only 5 correct answers. Revise the Python concepts from the sidebar and strengthen your knowledge and skills.
Please check qsn no 12’s output and 13’s program is not available
Hi Sagar,
We have corrected the Q.13 and in Q.12, there is no need for output, it is understandable by code itself.
Not much tough, but requires complete basics to score out of.
I score 10 out of 14 experience is pretty good. The question cleared some dought. Thanks you!!
8 correct ones. Was a little bit perplexed even though I know the concepts well.
Hi Cassin,
You must revise the Python concepts from the sidebar in which your answers got wrong.
It was really good. Thank you…
All 14 are correct
Helped in brushing up my concepts. Thanks 🙂
I love nd enjoyed this quiz, especially explanation part which shows the reason where m wrong or what mistake i hv done,. Thanks alot to all team.
Hi Bhupender,
Do share the Python MCQ Quiz on social media platforms and spread the knowledge to all the Python aspirants.
Very good, by this kind of test we can know what we are. Thanks for the quiz and we expecting some more quiz like this by very soon.
The final output for question 12 given by the test is incorrect. The answer 3 is correct though. The final list output should be [[1,2,[3,4]],5,6,7]
I scored 9 out of 14
Hi Prithvi,
We have corrected it. Thanks for improving us.
2 Wrong
It was very easy
Python
i got 11/14
14 out of 14 I scored
is there any quiz on the modules of pythons
Admin,in question 13 answer should be 3. You have given 2 as the correct answer. Please see to it and make the necessary correction so that its helpful for everyone.
Good Test!… I scored 13/14. The Question No-14 is little tricky, Need more of this kind.
We have series of Python Quizzes at DataFlair. Attempt those to learn more.
I scored 6/14, it was hard to me.
Will suggest you to learn Python completely through Free Python Course
question no. 13 is answer is wrong. it doesnot give 2 stars it gives only one star.
12 correct out of 14 got stuck in 13 and 14 .
It’s a brilliant quiz. Thanks for this quiz and courses
It is the best way to test my skills. I gain all the concepts again.