Python Quiz

451. What will be the output?

x = 5
def outer():
    x = 10
    def inner():
        nonlocal x
        x += 1
        return x
    return inner()

print(outer())
452. What does the following code return?

def f(a, b, *, c):
    return a + b + c

print(f(1, 2, c=3))
453. Which data structure is best suited for implementing a LIFO (Last-In First-Out) system?
454. What is the result of:

print(repr("\tTabbed"))
455. Which keyword allows a variable to be modified in the outer enclosing function but not global scope?
456. What does `__name__ == '__main__'` check?
457. What does the following code return?

{True: 'yes', 1: 'no', 1.0: 'maybe'}
458. Which function can be used to introspect attributes of a module or object?
459. What does `setdefault()` do in a dictionary?
460. Which of the following can be used to execute dynamic Python code?

Explore Programming Topics