PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
    • Python Exercises
    • C Programming Exercises
    • C++ Exercises
  • Quizzes
  • Code Editor
    • Online Python Code Editor
    • Online C Compiler
    • Online C++ Compiler
Home » Python » Quizzes » Python Functions Quiz

Python Functions Quiz

Updated on: August 26, 2025 | 40 Comments

Mastering functions and modules is crucial for writing clean, efficient, and scalable Python code. This Python Functions Quiz is designed to test your understanding of two fundamental Python concepts: Functions and Modules.

From defining functions, understanding variable scope and function arguments to importing and utilizing modules, these Multiple Choice Questions (MCQs) will help solidify your knowledge and highlight areas for improvement.

  • The quiz contains 25 questions. There is no time limit.
  • You will get 1 point for each correct answer. Solve 15 correctly to pass the test
  • Read Python functions and Python function arguments for any help.

Also, See:

  • Python Functions Exercise.
  • 15 Python Quizzes: each focusing on a specific topic

1. You want to import the numpy module but refer to it as np in your code. Which syntax is correct?

 
 
 
 

2. What will be the output of the following Python code?

def do_nothing():
    pass

result = do_nothing()
print(result)
 
 
 
 

3. What will be the output of the following Python code?

def calculate_sum(*args):
    total = 0
    for num in args:
        total += num
    return total

print(calculate_sum(1, 2, 3, 4))
print(calculate_sum())
 
 
 
 

4. What is the output of the following code?

def outer_fun(a, b):
    def inner_fun(c, d):
        return c + d
    return inner_fun(a, b)

res = outer_fun(5, 10)
print(res)
 
 
 

5. What is the output of the following display() function call

def display(**kwargs):
    for i in kwargs:
        print(i)

display(emp="Kelly", salary=9000)
 
 
 
 

6. Choose the correct declaration for fun1().

To enable the successful execution of the below two fun1() function call, choose the correct declaration for fun1().

fun1(25, 75, 55)
fun1(10, 20)
 
 
 
 

7. What is the primary purpose of *args and **kwargs in Python function definitions?

 
 
 
 

8. Select all correct function calls

Given the following function fun1() Please select all the correct function calls.

def fun1(name, age):
    print(name, age)
 
 
 

9. What will be the output of the following Python code?

def multiply(a, b):
    return a * b

def apply_operation(func, x, y):
    return func(x, y)

result = apply_operation(multiply, 5, 3)
print(result)
 
 
 
 

10. Select which is True for Python function

 
 
 
 

11. What is the output of the following display() function call

def display(**kwargs):
    for i in kwargs.values():
        print(i)

display(emp="Kelly", salary=9000)
 
 
 
 

12. What is the output of the following display_person() function call

def display_person(*args):
    for i in args:
        print(i)

display_person(name="Emma", age="25")
 
 
 

13. What is the primary purpose of the if __name__ == "__main__": block in a Python script?

 
 
 
 

14. One of the main benefits of using modules in Python is:

 
 
 
 

15. Which of the following modules is NOT part of Python’s standard library (meaning you usually need to install it separately)?

 
 
 
 

16. Which of the following best describes a Python lambda function?

 
 
 
 

17. Which function from the random module would you use to get a random integer between 1 and 10 (including 1 and 10)?

 
 
 
 

18. What is the output of the following function call

def add(a, b):
  return a + b
  a = 20
  b = 30
  return a + b

result = add(5, 10)
print(result)
 
 
 
 

19. What is the output of the add() function call

def add(a, b):
    return a+5, b+5

result = add(3, 2)
print(result)
 
 
 
 

20. What will be the output of the following Python code?

list1 = [1, 2, 3]

def append_item(a_list, item):
    a_list.append(item)

append_item(list1, 4)
print(list1)
 
 
 
 

21. What is the output of the following function call

def fun1(name, age=20):
    print(name, age)

fun1('Emma', 25)
 
 
 

22. What will be the output of the following Python code?

numbers = [1, 2, 3, 4, 5]
squared_numbers = list(map(lambda x: x*x, numbers))
print(squared_numbers)
 
 
 

23. What is a Python decorator primarily used for?

 
 
 
 

24. Which of the following is the correct way to import only the pi constant from the math module?

 
 
 
 

25. What will be the output of the following Python code?

x = 5

def update_x():
    global x
    x = 10

update_x()
print(x)
 
 
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Image

I’m Vishal Hule, the Founder of PYnative.com. As a Python developer, I enjoy assisting students, developers, and learners. Follow me on Twitter.

Related Tutorial Topics:

Python Python Basics Python Quizzes

All Coding Exercises:

C Exercises
C++ Exercises
Python Exercises

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 25+ questions
  • Each Quiz contains 25 MCQ
Exercises
Quizzes

Loading comments... Please wait.

In: Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • 15 Python Quizzes
  • Python Online MCQ Test
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Multithreading and Multiprocessing Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

 Explore Python

  • Python Tutorials
  • Python Exercises
  • Python Quizzes
  • Python Interview Q&A
  • Python Programs

All Python Topics

Python Basics Python Exercises Python Quizzes Python Interview Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Coding Exercises

  • C Exercises
  • C++ Exercises
  • Python Exercises

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our:

  • Terms Of Use
  • Privacy Policy
  • Cookie Policy

Copyright © 2018–2026 pynative.com

Advertisement