Functions Quiz
Sign in to Google to save your progress. Learn more
Email *
Programme

Which Python keyword indicates the start of a function definition?

1 point
Clear selection
In Python, how do you indicate the end of the block of code that makes up the function?
1 point
Clear selection
In Python what is the input() feature best described as?
1 point
Clear selection

What does the following code print out?

def thing():

    print('Hello')


print('There')

1 point
Clear selection
In the following Python code, which of the following is an "argument" to a function?

x = 'banana'

y = max(x)

print(y)

1 point
Clear selection
What will the following Python code print out?

def func(x) :

    print(x)

 

func(10)

func(20)

1 point
Clear selection
Which line of the following Python program will never execute?

def stuff():

    print('Hello')

    return

    print('World')

 

stuff()

1 point
Clear selection

What will the following Python program print out?

def greet(lang):

    if lang == 'es':

        return 'Hola'

    elif lang == 'fr':

        return 'Bonjour'

    else:

        return 'Hello'

 

print(greet('fr'),'Michael')

1 point
Clear selection

What does the following Python code print out? (Note that this is a bit of a trick question and the code has what many would consider to be a flaw/bug - so read carefully).

def addtwo(a, b):

    added = a + b

    return a

 

x = addtwo(2, 7)

print(x)

1 point
Clear selection

What is the most important benefit of writing your own functions?

1 point
Clear selection
Submit
Clear form
This form was created inside of Kalinga Institute of Social Sciences. Report Abuse