Preparing for a Python internship or fresher interview? This free Python interview questions test gives you 15 random questions on basics, strings, lists and dictionaries, functions, classes, error handling, and comprehensions, and explains every answer. You get a new set of questions every time you take it.

What this Python interview test covers

Every attempt gives you 15 random questions, balanced across 7 topics, with the questions and answer options shuffled, so no two tests are the same.

TopicWhat it checksQuestions per test
Python basicsData types, operators, truthiness, None, range3
StringsSlicing, immutability, split, join, f-strings2
Lists, tuples, sets & dictsLists vs tuples, sets, dictionaries, copying, sorting3
Functions*args, **kwargs, lambdas, decorators, default arguments2
Classes & OOP__init__, self, inheritance, super(), dunder methods2
Errors & filestry/except/finally, with open(), common exceptions1
Comprehensions & generatorsComprehensions, generators, enumerate, zip2

How to read your score

ScoreWhat it means
12–15 (80%+)Interview-ready. Your fundamentals are strong. Practise explaining these answers out loud, then start applying.
8–11 (50–79%)Almost there. A good base with a few gaps. Review your weakest topics and retake the test with new questions.
0–7 (below 50%)Build the basics. Focus on fundamentals first, using the explanations in your results, and try again in a week.

Sample Python interview questions for freshers (with answers)

Here are five questions of the kind the test asks, with answers and explanations.

1. What is the result of 7 // 2?

  • A. 4
  • B. 3
  • C. 3.5
  • D. 1

Answer: B. // is floor division. 7 / 2 gives 3.5, and 7 % 2 gives the remainder, 1.

2. What does this code print?

a = [1, 2, 3]
b = a
b.append(4)
print(a)
  • A. [1, 2, 3]
  • B. [4]
  • C. [1, 2, 3, 4]
  • D. An error

Answer: C. b = a makes both names refer to the same list. Use a.copy() to make a separate list.

3. What is the main difference between a list and a tuple?

  • A. Tuples are mutable; lists are immutable
  • B. Lists can only hold numbers
  • C. Tuples cannot be indexed
  • D. Lists are mutable; tuples are immutable

Answer: D. Because tuples are immutable, they can also be used as dictionary keys.

4. What is a well-known pitfall of a default argument like def add(item, items=[]):?

  • A. The same list is shared across calls
  • B. The list is reset to empty after each call
  • C. Default arguments are not allowed for lists
  • D. It makes the function slower

Answer: A. Defaults are created once when the function is defined. Use items=None and create the list inside.

5. What does [x * x for x in range(4)] produce?

  • A. [0, 1, 2, 3]
  • B. [1, 4, 9, 16]
  • C. [0, 1, 4, 9]
  • D. [0, 2, 4, 6]

Answer: C. The comprehension squares each number from 0 to 3.

Ready to test yourself?

Take the free Python interview questions test now: 15 random questions, about 10 minutes, with an explanation for every answer.

How to prepare for a Python internship interview

More free interview questions tests

See all tests and which ones fit your target role on the free internship tests page.

Frequently asked questions

Is this Python interview test free?

Yes. The test is completely free, needs no login, and does not ask for any personal details. Your best score is saved only in your own browser.

How many questions are in the Python test?

Each attempt has 15 random multiple-choice questions, balanced across seven topics. The questions and answer options are shuffled, so every retake gives you a new test.

What level is this Python test?

It is designed for freshers and internship candidates. It checks the Python fundamentals interviewers commonly ask about, not advanced or certification-level topics.

Which version of Python does the test cover?

The questions are based on Python 3, which is the current version used in companies and colleges. Python 2 is no longer supported.

Does a high score guarantee an internship?

No. A high score shows strong fundamentals, but interviews also check your projects, problem solving, and communication. Use your result to decide what to study next.

Your next step

Scored well? Learn what happens in each internship interview round, from the online test to the HR interview.

Read the interview guide
Dhaivat Ajwaliya

About the author

Dhaivat Ajwaliya

Dhaivat has 16+ years of experience in the IT industry, working on AI and cloud technologies, project delivery, and engineering leadership. He has interviewed and mentored many interns, wrote The Lost Intern, and runs the non-commercial Career Impact Initiative, mentoring students for free.