
Python Functions and Modules Quiz

Quiz
•
Computers
•
University
•
Hard
Dr. Deepti Sharma
FREE Resource
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.
Create a free account and access millions of resources
Similar Resources on Wayground
30 questions
Python Quiz

Quiz
•
University
32 questions
Midterms DevNet

Quiz
•
University
25 questions
Fundamentos de Programación

Quiz
•
University
25 questions
PHP dan MySQL

Quiz
•
University
25 questions
python 3-5 unit 10gr

Quiz
•
10th Grade - University
25 questions
Diagnostico Python

Quiz
•
University
25 questions
Python - List, Tuples

Quiz
•
University
30 questions
Python Function

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University