Python Functions Quiz

Python Functions Quiz

University

50 Qs

quiz-placeholder

Similar activities

ENGLISH 3_TEST_NEW ENGLISH FILE INTER

ENGLISH 3_TEST_NEW ENGLISH FILE INTER

10th Grade - University

45 Qs

PSYCHOLOGY

PSYCHOLOGY

University

50 Qs

Conditionals 1,2,3

Conditionals 1,2,3

University

50 Qs

Cả Cam 11 T2 P3

Cả Cam 11 T2 P3

University

46 Qs

SMS Midterm

SMS Midterm

University

50 Qs

Unit 1 Test Review

Unit 1 Test Review

8th Grade - University

45 Qs

Gr9 - U2 - Grammar - Past Simple vs Present Perfect

Gr9 - U2 - Grammar - Past Simple vs Present Perfect

5th Grade - University

55 Qs

Sri Rama Navami శ్రీ రామ నవమి

Sri Rama Navami శ్రీ రామ నవమి

KG - Professional Development

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?