
Python Functions Quiz

Quiz
•
English
•
University
•
Hard
Srividhya R
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
50 questions
50 câu bài 1 ( Ngữ Âm )

Quiz
•
University
45 questions
Ағылшын Мұхамеджан

Quiz
•
University
50 questions
Level 3 Final OLT Review 2

Quiz
•
University
48 questions
Maritime English ETO IV_Pre Final

Quiz
•
University
50 questions
150-200

Quiz
•
University
54 questions
Quiz về sở thích và hoạt động

Quiz
•
University
45 questions
Flowers For Algernon Review

Quiz
•
8th Grade - University
50 questions
EEP - PRELIM EXAMINATION (WEEKEND)

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade