Skills101
← All practice quizzes

Quiz: Python Functions

5 questionsNo time limitPass: 60%+10 XP on first pass

Write reusable code with functions. Parameters and arguments, default and keyword arguments, return values, *args and **kwargs, and local vs global scope.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    def f(x):
        x = x * 2
    f(5)
    print(f(5))
    
  2. Question 2

    What does this print?

    def power(base, exp=2):
        return base ** exp
    print(power(3), power(2, 3))
    
  3. Question 3

    What type is args inside def f(*args)?

  4. Question 4

    What does this print?

    x = 5
    def change():
        x = 10
    change()
    print(x)
    
  5. Question 5

    Why is def f(items=[]) risky?