Examers.io
ExamsOrganizationsHow it worksPricingHelp & FAQ
Python Institute logo

Python InstitutePCAP - Certified Associate Python Programmer

Domain 4Objective 6

PCAP-31-03 4.6 Construct and Initialize Objects PCAP-31 Practice Questions (Page 7)

Part of the Object-Oriented Programming domain, which accounts for 34% of the PCAP-31 exam. Python Institute does not publish an official question count, but from its 65-minute exam (~25–45 total, ~9–15 in this domain), expect 2–3 from this objective — we provide 48 practice questions to prepare you well beyond it. (estimate)

48questions here
10free pages
5concepts
34%of the exam

Questions 31–35

  1. 31application · easy

    A developer is creating a `Rectangle` class and wants the constructor to accept `width` and `height` and store them as instance attributes. Which code snippet correctly declares the constructor?

    Select an answer first
  2. 32application · easy

    A `Movie` class has a constructor `def __init__(self, title, year):`. Which line correctly creates a `Movie` instance for 'Inception' from 2010?

    Select an answer first
  3. 33application · medium

    In a `Team` class, the constructor is `def __init__(self, name, members=None):`. The developer wants to store the `members` list as an instance attribute. Which line inside the constructor correctly does this?

    Select an answer first
  4. 34application · easy

    A developer defines `class Empty:` with no methods. They then write `e = Empty()`. What is the result?

    Select an answer first
  5. 35expert · hard

    A developer is refactoring a `DatabaseConnection` class. Currently, the constructor is `def __init__(self, host, port):`. The team wants to allow creating a connection with no arguments (using defaults), but also with a custom host and port. They also want to ensure that the `host` attribute is always a string. Which constructor definition best meets these requirements?

    Select an answer first
Finished these 5 questions?

Review the revealed explanations, or continue through the curriculum.

Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Python Institute. “PCAP-31” is a trademark of its owner, used for identification only.