Question bank

Pick an answer to see if you're right — with an explanation.

PythonMedium
Which `json.dumps` argument keeps Hindi text readable instead of `\u` escapes?
aindent=2
bsort_keys=True
cdefault=str
densure_ascii=False
PythonHard
What does this print?
a = [[1, 2], [3, 4]]
b = a.copy()
b[0].append(99)
print(a[0])
a[1, 2]
b[1, 2, 99]
c[[1, 2, 99], [3, 4]]
dAttributeError
PythonHard
Why use `functools.wraps` inside a decorator?
aIt copies the wrapped function's name, docstring and metadata onto the wrapper
bIt makes the wrapper run faster
cIt caches return values
dIt is required for decorators to accept arguments
PythonHard
What is printed?
fs = [lambda: i for i in range(3)]
print(fs[0]())
a2
b0
c1
dTypeError
PythonHard
What does this print?
def add(item, bucket=[]):
    bucket.append(item)
    return bucket
add(1)
print(add(2))
a[2]
b[1, 2]
c[1]
d[]