Free Python fundamentals practice quiz for interviews

Practice Python basics that show up in beginner projects, AI-assisted coding sessions, and junior developer interviews. The 12 questions cover data structures, control flow, functions, exceptions, environments, files, slicing, truthiness, and common pitfalls.

About the Python Fundamentals skill quiz

This Python Fundamentals quiz is a Practical fundamentals check. It covers lists, dictionaries, loops, functions, exceptions, virtual environments, comprehensions, imports, files, slicing, and truthiness. The quiz has 12 questions, takes about 8 minutes, and a score around 8 out of 12 means you have a workable baseline.

The 12 questions on this page are built for practical Python fundamentals screening. They focus on practical decisions you would make while building, debugging, querying, or operating real projects.

Related Python Fundamentals Practice Questions

Frequently asked questions about the Python Fundamentals skill quiz

Is this Python quiz useful for interview prep?+

Yes. The quiz checks beginner-to-junior Python fundamentals that often appear in coding interviews and technical screens: lists, dictionaries, loops, functions, exceptions, virtual environments, imports, file handling, slicing, truthiness, and mutable defaults.

What Python basics should I know first?+

Start with lists and dictionaries, then learn loops, functions, exception handling, imports, virtual environments, file context managers, list comprehensions, slicing, truthy values, and the mutable-default-argument pitfall.

Does the Python quiz explain wrong answers?+

Yes. Each question gives immediate feedback in the quiz, and each linked question explanation page breaks down the correct answer, distractors, practical rule of thumb, and related practice questions.

Do I need to sign up to take the Python practice quiz?+

No. The public Python Fundamentals quiz is free and starts without signup.

Sample Python Fundamentals questions

Three examples from the 12-question quiz. Answers stay hidden until you reveal them.

Sample Question 1Data Structures

What does text[:3] return?

AThe first three characters
BCharacters after index 3 only
CThe last three characters
DA syntax error
Show answer
Answer: A — The first three characters

text[:3] slices from the beginning up to, but not including, index 3.

Sample Question 2Files

Why use with open("file.txt") as f?

AIt automatically closes the file when the block exits
BIt makes the file read-only forever
CIt uploads the file to pip
DIt converts bytes to SQL
Show answer
Answer: A — It automatically closes the file when the block exits

The with statement uses a context manager. For files, it ensures the file is closed even if an error occurs.

Sample Question 3Control Flow

Which value is falsy in Python?

A[]
B[0]
C"false"
D42
Show answer
Answer: A — []

Empty containers such as [], {}, set(), and "" are falsy. Non-empty containers are truthy even if they contain zero or the string false.

Try another tech quiz

Compare your fundamentals across Git, AWS, Linux, SQL, Python, and Docker.

See all free quizzes