Single logo
  • Courses
  • Articles
  • About
Join for freeJoin free
  1. Blog
  2. /
  3. full-stack-python-architect-fastapi-react-vibe-coding
  4. /
  5. Python Functions and Methods Quiz: Test Your Understanding

FULL STACK PYTHON ARCHITECT: FAST API + REACT + VIBE CODING
Web Development
0 views

Python Functions and Methods Quiz: Test Your Understanding

Think you've mastered Python functions, args/kwargs, and functional programming tools like map, filter, and lambda? Put your skills to the test with this hands-on quiz featuring real practice problems and detailed explanations.

A
Author
July 17, 2026

You've learned how to write functions, pass arguments, and maybe even dabbled in lambda expressions or the mysterious reduce() method. But here's the real question: can you actually apply these concepts under pressure? Reading about functions and writing your own from scratch are two very different skills, and the gap between them is exactly where most Python learners get stuck.

This self-assessment guide is designed to bridge that gap. Whether you're preparing for a technical interview, brushing up before diving into FastAPI development, or simply want to know if you're ready for more advanced topics, this quiz will test your grasp of Python functions, methods, scope, args/kwargs, and functional programming concepts like map(), filter(), and lambda.

Grab a notebook, resist the urge to peek at the answers immediately, and let's see how well you really know Python functions.

Section 1: Functions vs. Methods — Do You Know the Difference?

One of the most common points of confusion for new Python developers is distinguishing between a function and a method. Before jumping into code, test your conceptual understanding.

Quiz Question 1

What is the key difference between a function and a method in Python?

  • A) Methods can only be used with numbers
  • B) Functions are standalone, while methods are associated with an object or class
  • C) There is no difference — they are the same thing
  • D) Methods cannot return values

Answer: B. A function is a standalone block of reusable code defined with def, while a method is a function that belongs to an object (like my_list.append()). Understanding this distinction is foundational — it's one of the first concepts covered when learners explore Python methods and functions in depth.

Quiz Question 2

What will the following code print?

def greet(name):
    return f"Hello, {name}!"

print(greet("Alex"))

Answer: Hello, Alex! — This tests your understanding of parameters, arguments, and return values, three pillars of writing clean, reusable functions.

Section 2: Scope, Args, and Kwargs Challenge

Scope determines where a variable can be accessed, and it trips up even intermediate developers. Let's test your knowledge with a tricky example.

Quiz Question 3

x = 10

def change_value():
    x = 5
    return x

print(change_value())
print(x)

What gets printed?

Answer: 5 then 10. This is a classic scope question — the x inside the function is a local variable that only exists within the function's scope. The global x remains untouched. If you got this wrong, it's worth revisiting how local and global scope interact in Python before moving forward.

Quiz Question 4: Args and Kwargs

What's the difference between *args and **kwargs?

Answer: *args allows you to pass a variable number of positional arguments into a function, while **kwargs allows you to pass a variable number of keyword arguments. For example:

def show_info(*args, **kwargs):
    print(args)
    print(kwargs)

show_info(1, 2, 3, name="Sam", age=25)
# Output: (1, 2, 3)
# Output: {'name': 'Sam', 'age': 25}

Mastering args and kwargs is essential for writing flexible functions — especially when you start building APIs where endpoints need to handle varying inputs gracefully.

Section 3: Lambda, Map, and Filter — The Functional Programming Test

Functional programming tools like lambda, map(), and filter() often feel intimidating at first, but once they click, they dramatically simplify your code. Let's see if they've clicked for you.

Quiz Question 5

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

What is the output?

Answer: [1, 4, 9, 16, 25]. The map() function applies the lambda expression to every item in the list, squaring each number.

Quiz Question 6

numbers = [10, 15, 20, 25, 30]
result = list(filter(lambda x: x % 15 == 0, numbers))
print(result)

Answer: [15, 30]. Unlike map(), which transforms every element, filter() only keeps elements where the lambda returns True.

Quiz Question 7: Sorting with Key Functions

words = ["banana", "kiwi", "apple", "fig"]
sorted_words = sorted(words, key=len)
print(sorted_words)

Answer: ['fig', 'kiwi', 'apple', 'banana']. This demonstrates using sorted() with a key function — in this case, sorting strings by their length rather than alphabetically. This is a favorite interview question because it tests whether you understand how key functions work under the hood.

Section 4: The Reduce Method — Advanced Functional Programming

reduce() is often the most misunderstood functional tool in Python because it doesn't return a list — it aggregates values into a single result.

Quiz Question 8

from functools import reduce

numbers = [1, 2, 3, 4]
result = reduce(lambda acc, x: acc + x, numbers)
print(result)

Answer: 10. The reduce() function takes an accumulator (acc) and applies the lambda cumulatively across the list, effectively summing all the numbers. If this concept still feels fuzzy, it's a strong signal to slow down and practice a few more real-world aggregation examples before tackling data-heavy backend logic in frameworks like FastAPI.

Section 5: Applying Functions in Real-World Scenarios

Understanding syntax is one thing — applying it to solve real problems is another. Try this practice scenario inspired by common OOP and function-based exercises:

Quiz Question 9

Given a dictionary of student scores, write a function that calculates the class average and returns a letter grade based on standard grading scales (A, B, C, D, F).

def calculate_grade(average):
    if average >= 90:
        return "A"
    elif average >= 80:
        return "B"
    elif average >= 70:
        return "C"
    elif average >= 60:
        return "D"
    else:
        return "F"

scores = [85, 92, 78, 90, 88]
average = sum(scores) / len(scores)
print(f"Average: {average}, Grade: {calculate_grade(average)}")

This type of exercise blends functions, conditional logic, and F-strings — exactly the kind of practical, structured thinking you need when building real applications like grading systems, dashboards, or reporting tools.

How Did You Score?

Be honest with yourself:

  • 8-9 correct: You have a strong grasp of Python functions and functional programming. You're ready to move on to more advanced topics like decorators, generators, and OOP-driven architecture.
  • 5-7 correct: You understand the basics but may need more practice with scope, args/kwargs, or functional tools like reduce(). Revisit those sections and try writing your own variations of the practice problems.
  • Below 5: Don't worry — everyone starts somewhere. Functions and functional programming take repetition to sink in. Going back through structured lessons with guided examples will help solidify these concepts before you move forward.

Featured Video

[Course video embed placeholder]

Why These Concepts Matter for Full Stack Development

If you're aiming to become a well-rounded developer working with FastAPI and React, mastering these fundamentals isn't optional — it's the backbone of everything you'll build afterward. Clean function design, proper scope handling, and comfortable use of functional programming tools directly translate into writing efficient API endpoints, handling request data flexibly with args and kwargs, and processing datasets with map, filter, and reduce.

These aren't just academic exercises. They show up constantly in real-world backend logic, data transformation pipelines, and even frontend logic when working across the full stack.

Ready to Go Deeper?

If this quiz revealed a few gaps in your understanding, that's completely normal — and it's exactly why structured, hands-on learning matters. The Full Stack Python Architect: FastAPI + React + Vibe Coding course walks through each of these concepts step by step, from basic function syntax to advanced functional programming patterns like reduce(), all while building toward real full stack applications.

Whether you need to shore up your fundamentals or want to see how these concepts apply directly to production-ready projects, exploring the full course curriculum could be your next best step toward becoming a confident, professional Python developer.

Tags:
python functions quiz
python methods practice
test python knowledge
python skills check
python lambda map filter
python args kwargs
Share Article

Back to All Articles

Single logo

Empowering Education, One Course at a Time

About
About usContact usFAQs
Legal
Terms of ServicePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.