Python Quiz

421. What is the output of this code?

x = [1, 2, 3]
y = x
del x[:]
print(y)
422. What does `functools.lru_cache` do?
423. Which of these will NOT raise an error?

x = (1, 2, 3)
x[0] = 10
424. What is the result of:

''.join(reversed('abc'))
425. Which of the following is true about Python's GIL (Global Interpreter Lock)?
426. What will this print?

x = [i*i for i in range(3)]
print(x)
427. What does the following code output?

print((lambda x: x * 2)(5))
428. How do you define a property in a Python class?
429. What is true about list comprehension vs. generator expressions?
430. What will this code output?

x = {'a': 1, 'b': 2}
print(x.get('c', 3))

Explore Programming Topics