← All quizzes

💻 Computer Science & IT

Python: beyond the basics

Generators, decorators, context managers, the GIL and the mutable-default trap. What interviews probe once you know the syntax.

10questions

mediumdifficulty

+20max XP (1st try)

not rated yet

Question 1 of 10

What does calling a generator function return?

Question 2 of 10

What does @functools.lru_cache do to a function?

Question 3 of 10

Given def f(x, acc=[]): acc.append(x); return acc, what does the second call f(2) return, after f(1)?

Question 4 of 10

What does CPython's Global Interpreter Lock mean in practice?

Question 5 of 10

What is the difference between "is" and "=="?

Question 6 of 10

What is [x * x for x in range(4) if x % 2 == 0]?

Question 7 of 10

What does "with open(path) as f:" guarantee?

Question 8 of 10

In def f(*args, **kwargs), what are args and kwargs?

Question 9 of 10

What is a decorator?

Question 10 of 10

Which of these built-in types is immutable?

0/10 answered

Part of

Python: beyond the basics quiz: 10 questions with answers · DevLearn