Search Header Logo

Course 5 - functions

Authored by Madalina Barbu

Computers

3rd Grade

Used 2+ times

Course 5 - functions
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The input() function is an example of a:

user-defined function

built-in function

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when you try to invoke a function before you define it?

example:

hi()

def hi():

print("hi!")

Python will search the function through the code and after will execute it

It will return an error

if after seach the function is not found, then it will ignore it and execute the code below

Answer explanation

NameError: name 'function_name' is not defined

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen when you run the code below?

def hi():

print("hi")

hi(5)

It will print 5 times "hi"

It will print "hi 5"

error

Answer explanation

TypeError: hi() takes 0 positional arguments but 1 was given

4.

OPEN ENDED QUESTION

3 mins • 1 pt

What is the output of the following snippet?

def intro(a="James Bond", b="Bond"):

print("My name is", b + ".", a + ".")

intro()

Evaluate responses using AI:

OFF

Answer explanation

My name is Bond. James Bond.

5.

OPEN ENDED QUESTION

3 mins • 1 pt

What is the output of the following snippet?

def intro(a="James Bond", b="Bond"):

print("My name is", b + ".", a + ".")

intro(b="Sean Connery")

Evaluate responses using AI:

OFF

Answer explanation

My name is Sean Connery. James Bond.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?