Search Header Logo

Python Functions Quiz

Authored by Aswini G

Computers

University

Used 1+ times

Python Functions Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a function in Python?

function myFunc():

define myFunc():

def myFunc():

def: myFunc()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly calls a function named greet()?

call greet()

greet[]

greet()

execute greet()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A variable defined inside a function has which type of scope?

Global

Local

Module

External

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the lifetime of a local variable in a function?

Until the program ends

Until the function terminates

Until the module terminates

As long as the function is not called again

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the return statement in a function do?

Terminates the program

Exits the function and returns a value

Restarts the function

Pauses the function execution

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if no return statement is used in a function?

The function returns None

The function returns 0

The function raises an error

The function automatically prints the result

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are required arguments in Python functions?

Arguments that must be passed in a specific order

Arguments with default values

Arguments passed using keyword names

Arguments passed as a tuple

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?

Discover more resources for Computers