Glitch DevsJobs

Fundamentals

Python Basics Test

20 multiple choice questions on Python: types, collections, functions, comprehensions, exceptions and common pitfalls.

Questions
20
Time
20 min
Pass mark
60%

No account or email needed.

About this test

This test checks the foundations of Python: built-in types and which ones can change, lists, dictionaries and sets, functions and arguments, comprehensions, generators, exceptions, and a few well-known traps such as mutable default arguments.

It assumes Python 3.

What it covers

The question set has 24 questions: 14 easy, 8 medium and 2 hard. Each attempt draws 20 of them at random, so a second try is not the same test.

  • Python (24)

Try a few sample questions

These are real questions from the set, with the answers and a short explanation. Read the question, decide, then open it to check.

Sample 1 · Python · easyWhich of these Python types is immutable?Show the answer
  • list
  • dict
  • tupleCorrect
  • set

A tuple cannot be changed after it is created. Lists, dictionaries and sets can.

Sample 2 · Python · easyWhat does this code print?Show the answer
python
print(type(3 / 2))
  • <class 'int'>
  • <class 'float'>Correct
  • <class 'str'>
  • 1

The / operator always returns a float in Python 3, even when the result is a whole number.

Sample 3 · Python · easyWhat does 7 // 2 evaluate to?Show the answer
  • 3.5
  • 3Correct
  • 4
  • 1

// is floor division. It divides and rounds down to a whole number.

How it works

  • 20 multiple choice questions, drawn at random from a larger set.
  • 20 minutes on the clock. The test submits itself when time runs out.
  • Pass mark: 60%.
  • No marks are taken off for wrong answers, so answer every question.
  • Some questions have more than one correct answer. You must pick all of them to score.
  • When you finish you see your score, the correct answers and a short explanation for each.
  • Your answers save as you go, so a dropped connection will not lose your work.
  • Please stay on the test page. Switching to another tab or window is recorded and you will see a warning.
  • Copying text, printing and screenshots are not allowed during the test.

More practice tests

See all practice tests.

Share this test