Python Functions Quiz

Python Functions Quiz

University

•

50 Qs

quiz-placeholder

Similar activities

MLA FORMATTING - EOC RESEARCH PAPER

MLA FORMATTING - EOC RESEARCH PAPER

9th Grade - University

•

50 Qs

English Clinic - Level 6 - Test

English Clinic - Level 6 - Test

6th Grade - University

•

45 Qs

Gatsby Review

Gatsby Review

9th Grade - University

•

50 Qs

B inggris k3las 9

B inggris k3las 9

9th Grade - University

•

50 Qs

Daily routines

Daily routines

University

•

50 Qs

Verb Form GK1 Exercises 1 for Grade 8

Verb Form GK1 Exercises 1 for Grade 8

8th Grade - University

•

50 Qs

Numbers

Numbers

University

•

50 Qs

Mastering Simple Past Tense

Mastering Simple Past Tense

6th Grade - University

•

50 Qs

Python Functions Quiz

Python Functions Quiz

Assessment

Quiz

•

English

•

University

•

Practice Problem

•

Hard

Created by

Srividhya R

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

50 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? python Copy def add(a, b): return a + b result = add(5, 3) print(result)

8

5

3

Error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code output? python Copy def multiply(x, y): return x * y result = multiply(4, 3) print(result)

7

12

3

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? python Copy x = 10 def func(): x = 5 return x print(func()) print(x)

5 10

10 5

5 5

10 10

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function demonstrates recursion? python Copy def factorial(n): if n == 1: return 1 else: return n * factorial(n - 1)

factorial

factorial_recursive

factorial_iteration

None of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? python Copy def func(a, b=3): return a * b result = func(4) print(result)

12

7

4

Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements about recursion is true? python Copy def count_down(n): if n == 0: return else: print(n) count_down(n-1)

Recursion will never terminate

Recursion is only valid for integer inputs

The function will print numbers from n down to 1

Recursion terminates before printing

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this code output? python Copy def test(x): return x + 2 x = test(10) print(x)

10

12

2

Error

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?