
Python Functions Quiz
Quiz
•
English
•
University
•
Practice Problem
•
Hard
Srividhya R
FREE Resource
Enhance your content in a minute
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
50 questions
JETS OLYMPIAD 2024
Quiz
•
7th Grade - University
49 questions
Aptis Mock Test 2 - 2023-1. Listenig, Speaking, G & V.
Quiz
•
University
50 questions
KBWT. 0-50
Quiz
•
University
47 questions
Unit 5 - The Odyssey Final Quiz
Quiz
•
9th Grade - University
53 questions
ELR301_REVIEW of Chapters1-3
Quiz
•
University
50 questions
EXAM #1.
Quiz
•
9th Grade - University
50 questions
Speakout 3rd Unit 5 Review Grammar
Quiz
•
University
50 questions
(2022) FLASH CARD 7: SHOPPING
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
