
Python Functions and Modules Quiz
Authored by Dr. Deepti Sharma
Computers
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? python Copy code def func(a, b=5): return a + b print(func(3))
None
Error
5
3
8
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following allows a function to accept a variable number of keyword arguments?
**kwargs
**variables
*args
kwargs[]
*variables
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output? python Copy code def func(): return "Hello", "World" result = func() print(type(result))
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement about Python functions is false?
Functions can accept keyword arguments.
Functions can have default arguments.
Functions can be nested.
Functions can return multiple values as tuples.
Functions must return a value.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? python Copy code def func(x, y): x = x + y return x print(func("Hello", "World"))
HelloWorld
Hello World
Error
None
Hello-World
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? python Copy code def add(a, b=10): return a + b print(add(5))
None
15
5
Error
10
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the *args in a function definition?
It allows the function to accept any number of non-keyword arguments.
It allows the function to accept a fixed number of arguments.
It allows the function to accept any number of keyword arguments.
It is used for returning multiple values from a function.
It helps to create default parameters in the function.
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
25 questions
¿Sabes más que un estudiante de avanzada? 2023-1
Quiz
•
University
25 questions
Quiz on Emotional Interaction
Quiz
•
University
25 questions
Privacy, Security & Ethics
Quiz
•
University
30 questions
HCI-Chapter 8
Quiz
•
University
26 questions
Adversarial Search and CSP Quiz
Quiz
•
University
26 questions
TUGAS PEMBINAAN INFORMATIKA KELAS 8 SMP ISA
Quiz
•
8th Grade - University
26 questions
MASTERING THE MACHINE
Quiz
•
University
25 questions
Animation Quiz1
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