Search Header Logo

Python Programming Quiz

Authored by Adham Elmuntser

Computers

1st Grade

Used 1+ times

Python Programming Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: def greet(): print("Hello, World!") greet()

Hello, Python!

Hello, World!

Hello!

World!

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In the function greet(name), what is name classified as?

A method

A string

A parameter

A loop

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following function return:

def add(a, b):

return a + b

Sum of a and b

Difference of a and b

Multiplication of a and b

Division of a and b

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default value for the parameter name in the function definition def greet(name="Guest")?

Alice

Guest

Bob

Python

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What type of object does the function get_min_max(numbers) return?

A list

A dictionary

A tuple

A string

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a lambda function in Python?

A named function

An anonymous function

A recursive function

A nested function

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the base case in the recursive function

def factorial(n):

if n == 0:

return 1

return n * factorial(n - 1)

n == 1

n == 0

n > 0

n < 0

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?