
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
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
52 questions
TracnghiemTACN
Quiz
•
University
45 questions
Quiz 1
Quiz
•
University
50 questions
5555
Quiz
•
University
51 questions
MKT 251H
Quiz
•
University
55 questions
Context clues
Quiz
•
KG - Professional Dev...
50 questions
Gerunds and Infinitives Review
Quiz
•
9th Grade - University
47 questions
Review Test - Units 8 - 13 book 1
Quiz
•
University
50 questions
TRYOUT SEM GANJIL INFORMATIKA 8
Quiz
•
1st Grade - University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
ELA Advisory Review
Quiz
•
7th Grade
15 questions
Subtracting Integers
Quiz
•
7th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade