Courseiva

PCAP Modules and Packages Practice Question

Match each Python built-in function to its description.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Returns the length of an object

Generates a sequence of numbers

Returns a sorted list from an iterable

Returns index and value pairs

Aggregates elements from multiple iterables

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

✓

len(): Returns the length (number of items) of an iterable.

The correct matches are: len() returns length, map() applies a function, filter() filters by truth, zip() combines iterables. Common confusions involve swapping the definitions of map and len, or filter and zip.

Answer analysis

Option-by-option breakdown

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

  • ✓

    len(): Returns the length (number of items) of an iterable.

    Why this is correct

    len() is the built-in function that returns the number of items in an object, using the object's __len__ method. It works with sequences like lists, strings, tuples, and ranges, as well as collections such as dictionaries (returning the number of keys) and sets. The description is accurate because len() never applies a callable; it produces a single integer count.

  • ✓

    map(): Applies a function to every item of an iterable and returns a map object.

    Why this is correct

    The map() function creates a lazy iterator by applying a given callable to every item of an iterable (or items from multiple iterables in parallel). The result is a map object, not a list or a numeric value, and elements are produced on demand when iterated. This matches the description exactly: map() transforms items one by one rather than aggregating or filtering them.

  • ✓

    filter(): Filters an iterable based on a function returning True for each item.

    Why this is correct

    filter() returns an iterator that yields only those elements of an iterable for which the provided function returns a truthy value. It does not modify the elements themselves; it simply selects a subset based on the predicate's boolean result. If the function is omitted, it removes falsy items directly, which still aligns with the stated behavior of filtering based on a function returning True.

  • ✓

    zip(): Aggregates elements from multiple iterables into tuples.

    Why this is correct

    The zip() function pairs the corresponding elements of multiple iterables into tuples, forming an iterator of those tuples. It stops when the shortest input iterable is exhausted, so the resulting tuples all have the same length. This description correctly captures how zip() aggregates elements across iterables, rather than transforming or filtering them.

  • ✗

    len(): Applies a function to every item of an iterable and returns a map object.

    Why it's wrong here

    This statement is false because it confuses len() with map(). len() takes a single object and returns an integer representing the number of items, using the __len__ protocol; it never accepts a function as an argument and does not produce a map object. The behavior described — applying a function to every item — is exclusively that of map(), so the function call to len() would actually raise a TypeError when passed a function.

  • ✗

    map(): Returns the length (number of items) of an iterable.

    Why it's wrong here

    This option incorrectly attributes the behavior of len() to map(). When map() is called, it returns a map object (an iterator), not an integer length, and it requires at least one iterable along with a callable to apply. The length of an iterable is determined by len(), while map() is used for element-wise transformation, so the statement conflates two fundamentally different operations.

About these practice questions

One of 421 original PCAP 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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCAP 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 PCAP exam.