Recursion in Python Quiz

Recursion in Python Quiz

9th Grade

14 Qs

quiz-placeholder

Similar activities

2.2 Fiber Ethernet

2.2 Fiber Ethernet

9th - 12th Grade

12 Qs

Kegiatan Sosial di Bulan Ramadhan

Kegiatan Sosial di Bulan Ramadhan

6th Grade - University

15 Qs

Mobile-First Design Quiz

Mobile-First Design Quiz

9th Grade

10 Qs

Tin 9 Bài 8. SUMIF

Tin 9 Bài 8. SUMIF

9th Grade - University

10 Qs

Quiz sui Messaggi ICMP e Test di Connettività

Quiz sui Messaggi ICMP e Test di Connettività

9th Grade

15 Qs

Sumatif 3_Analisis Data_Informatika Kelas VIII

Sumatif 3_Analisis Data_Informatika Kelas VIII

8th Grade - University

18 Qs

ÔN TẬP THIẾT BỊ VÀO RA, PHẦN MỀM MÁY TÍNH

ÔN TẬP THIẾT BỊ VÀO RA, PHẦN MỀM MÁY TÍNH

7th Grade - University

15 Qs

python(if / for / while / list)

python(if / for / while / list)

9th Grade

14 Qs

Recursion in Python Quiz

Recursion in Python Quiz

Assessment

Quiz

Information Technology (IT)

9th Grade

Practice Problem

Easy

Created by

Fadi Fadi

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

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

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is recursion in Python?

A way to create loops using for

A function that returns a list

A function that calls itself

A function that runs forever

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main danger of recursion if not written properly?

It prints the wrong result

It runs only once

It causes an infinite loop

It turns into a list

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which part of a recursive function stops it from calling itself forever?

Return statement

Loop

Base case

Recursive call

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this function return? def factorial(n): if n == 1: return 1 else: return n * factorial(n - 1) print(factorial(3))

3

6

9

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the base case in this function? def countdown(n): if n == 0: print("Blast off!") else: print(n) countdown(n - 1)

print(n)

n == 0

countdown(n - 1)

"Blast off!"

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is printed when this code runs? def test(x): if x == 0: return print(x) test(x - 1) test(3)

3 2 1 0

0 1 2 3

3 2 1

Nothing

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these problems is most suitable for recursion?

Printing numbers from 1 to 10

Finding maximum in a list

Searching a file in nested folders

Adding two numbers

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?