Courseiva

PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions

A developer writes a function to calculate the area of a rectangle: def area(length, width): return length * width. They call it as area(5, 3). What is the result and why?

⚠ Common exam trap

The trap here is thinking that keyword arguments are mandatory or that multiplication requires a specific argument order.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

15, because the arguments are passed positionally, so length=5 and width=3.

Positional arguments are matched to parameters based on their order in the function call. The first argument binds to the first parameter, the second to the second, and so on. Since length and width are multiplied, area(5, 3) returns 15. No keyword arguments are necessary, and the function does not enforce keyword-only parameters.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    15, but only if the arguments are passed as area(length=5, width=3).

    Why it's wrong here

    While keyword arguments would also produce 15, they are not required. Positional arguments work equally well because the order matches the parameter order. The function does not define keyword-only parameters, so positional calls are perfectly valid. This option falsely implies that positional arguments are invalid or produce a different result, which contradicts Python's calling conventions.

  • ✓

    15, because the arguments are passed positionally, so length=5 and width=3.

    Why this is correct

    When a function is called with positional arguments, they are matched to parameters in the order they are defined. Here, the first argument 5 binds to length and the second argument 3 binds to width. The multiplication 5 * 3 yields 15. No keyword arguments are used, so there is no ambiguity. This is the standard positional argument passing mechanism in Python.

  • ✗

    A TypeError occurs because the function requires keyword arguments.

    Why it's wrong here

    The function definition does not force keyword arguments; it simply defines two positional parameters. Calling area(5, 3) supplies exactly two positional arguments, which is valid. A TypeError would occur only if the number of arguments mismatched or if a required keyword-only parameter were missing. This option incorrectly assumes that all parameters must be passed by keyword, which is not the case here.

  • ✗

    8, because the function adds the arguments instead of multiplying them.

    Why it's wrong here

    The function body explicitly uses the multiplication operator *, not addition. The parameters length and width are multiplied, so the result is 15. This option misreads the function definition, perhaps confusing the asterisk with a plus sign. It also ignores the order of arguments, but that order does not affect multiplication. The correct operation is multiplication, giving 15.

About these practice questions

One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Python Institute exam blueprint

This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.