Skip to content
KALANBLON
Show contents

Chapter 3 of 7 · 10 min

Quiz: functions

Parameters, return, scope, default values: let's check that functions hold no more secrets for you. You need 70% correct answers.

Quiz

5 questions · pass mark: 70%

  1. 1.What does this program display?

    One answer

    def f(x):
        x * 3
    
    print(f(2))
  2. 2.What does this program display?

    One answer

    n = 1
    def change():
        n = 5
    change()
    print(n)
  3. 3.With def greet(name, word="Hi"), which calls are valid? (several answers)

    Several answers possible

  4. 4.Fill in the keyword that sends back a value.

    Complete the code

    def square(x):
        ____ x * x
  5. 5.Why avoid def f(item, items=[])?

    One answer

Your progress is saved on this device. Create a free account to keep your progress on all your devices.