OpenExamsFREE PRACTICE — ANY EXAM

Free PCPP1™ – Certified Professional Python Programmer Level 1 Practice Questions

100 free questions · Answer explanations · No signup required

View examination details, outline and sources

Loading selected examination banks…

Sample Practice Questions

Try these 10 sample questions from the PCPP1™ – Certified Professional Python Programmer Level 1 practice bank. Each includes the answer and explanation. Continue with the interactive practice above to review the full question set.

  1. 1A Python class stores per-user messages in a list. Each new instance must start with its own empty list. Where should that list be initialized?

    1. A. Assign messages = [] in the class body.
    2. B. Assign self.messages = [] inside __init__.
    3. C. Assign User.messages = [] inside __init__.
    4. D. Assign messages = [] at module scope.

    Answer: B

    Explanation: The tutorial states, "instance variables are for data unique to each instance". Assigning a new list to self.messages during each initialization gives each user independent state. Class or module storage would share or replace common state.

    Reference: Python 3.10 Tutorial — Classes — 9.3.5 Class and Instance Variables

  2. 2According to PEP 1, what is a primary role of Python Enhancement Proposals?

    1. A. Implementing proposed features as soon as a PEP is published
    2. B. Proposing major features and documenting Python design decisions
    3. C. Making every PEP a compulsory coding rule for all Python projects
    4. D. Giving PEP authors final authority over Python design decisions

    Answer: B

    Explanation: PEP 1 calls PEPs "the primary mechanisms for proposing major new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python." A PEP is a design document, not automatic implementation or universal compulsion; authors seek consensus rather than unilaterally deciding every proposal.

    Reference: PEP 1 — PEP Purpose and Guidelines — What is a PEP?

  3. 3What role does tkinter play in Python GUI programming?

    1. A. It provides Python's standard interface to the Tcl/Tk GUI toolkit.
    2. B. It implements Tcl syntax by extending Python's own language grammar.
    3. C. It replaces the Tcl interpreter with a pure-Python GUI implementation.
    4. D. It bypasses Tcl/Tk and translates all widgets directly into OS calls.

    Answer: A

    Explanation: The documentation states, "The tkinter package (“Tk interface”) is the standard Python interface to the Tcl/Tk GUI toolkit." Tkinter assembles Tcl/Tk commands and uses an associated Tcl interpreter; it does not extend Python's grammar, replace that interpreter, or bypass Tcl/Tk.

    Reference: Python 3.10 Library Reference — tkinter: Python interface to Tcl/Tk — tkinter module introduction

  4. 4Two TCP services run at the same IPv4 address, one listening on 8000 and the other on 9000. Which part of the destination endpoint distinguishes those services?

    1. A. The host's domain-name suffix
    2. B. The size of the receive buffer
    3. C. The destination port number
    4. D. The encoding of the request body

    Answer: C

    Explanation: The Socket HOWTO describes a connection to the "host and port we’re bound to". With the host address and TCP protocol fixed, selecting a different listening port selects a different service endpoint; buffer size and payload encoding do not address the listener.

    Reference: Python 3.10 Socket Programming HOWTO — Creating a Socket, server accept discussion

  5. 5Which sqlite3 connection call creates a database in RAM rather than opening a database file on disk?

    1. A. sqlite3.connect('memory.db')
    2. B. sqlite3.connect(':memory:')
    3. C. sqlite3.connect('temporary.sqlite')
    4. D. sqlite3.connect('ram/database.db')

    Answer: B

    Explanation: The connect documentation says to pass :memory: for "a database that is in RAM instead of on disk." The other strings designate ordinary filesystem paths rather than the special in-memory database name.

    Reference: Python 3.10 Library Reference — sqlite3: DB-API 2.0 interface for SQLite databases — Module functions, sqlite3.connect, database parameter

  6. 6Given class Report: pass and class AuditReport(Report): pass, with item = AuditReport(), which expression tests whether item is an instance of Report or one of its subclasses?

    1. A. type(item) is Report
    2. B. issubclass(Report, AuditReport)
    3. C. item.__class__ is Report
    4. D. isinstance(item, Report)

    Answer: D

    Explanation: The tutorial says, "Use isinstance() to check an instance’s type" and explains that it includes a class derived from the supplied type. Exact type identity excludes AuditReport, while issubclass(Report, AuditReport) tests the reversed class relationship.

    Reference: Python 3.10 Tutorial — Classes — 9.5 Inheritance, built-in inheritance checks

  7. 7Which proposed subject fits the Process PEP category described by PEP 1?

    1. A. Introducing a new expression syntax into the Python language
    2. B. Adding a new implementation of a Python built-in data type
    3. C. Providing background on a design issue without proposing a change
    4. D. Changing the procedure used to make Python development decisions

    Answer: D

    Explanation: PEP 1 says Process PEP examples include "changes to the decision-making process". Language features belong to Standards Track; background information without a new feature fits Informational PEPs.

    Reference: PEP 1 — PEP Purpose and Guidelines — PEP Types, Process PEP

  8. 8In the terminology of Tkinter GUI programming, what is a widget?

    1. A. An event object describing a keyboard or mouse interaction
    2. B. A callback function invoked in response to user interaction
    3. C. An individual interface component represented by a Python object
    4. D. A geometry specification describing a row and column position

    Answer: C

    Explanation: The documentation says, "A Tkinter user interface is made up of individual widgets. Each widget is represented as a Python object". Frames, labels, and buttons are examples of these interface components.

    Reference: Python 3.10 Library Reference — tkinter: Python interface to Tcl/Tk — Important Tk Concepts, widgets

  9. 9A server binds an IPv4 listening socket specifically to 127.0.0.1 rather than all local interfaces. From where is that listener reachable?

    1. A. Only from the same machine through its loopback interface
    2. B. From every machine that knows the host's public IP address
    3. C. From all machines on the local network but not beyond it
    4. D. From the public Internet whenever the port number is known

    Answer: A

    Explanation: The HOWTO explains that binding to localhost or 127.0.0.1 gives a server "only visible within the same machine." Loopback binding does not expose that listener to LAN peers or Internet clients.

    Reference: Python 3.10 Socket Programming HOWTO — Creating a Socket, localhost binding

  10. 10A user-supplied name must be used as a value in a sqlite3 query. Which approach correctly binds it through a qmark placeholder?

    1. A. Interpolate name into SQL with Python's % operator.
    2. B. Concatenate name between quote characters in the SQL string.
    3. C. Put the ? marker inside SQL quotes and pass (name,) separately.
    4. D. Use an unquoted ? marker and pass (name,) as separate parameters.

    Answer: D

    Explanation: The tutorial states, "Always use placeholders instead of string formatting to bind Python values to SQL statements, to avoid SQL injection attacks". The placeholder must be SQL syntax outside string quotes and supplied with a separate one-item parameter sequence.

    Reference: Python 3.10 Library Reference — sqlite3: DB-API 2.0 interface for SQLite databases — Tutorial, parameterized INSERT and placeholder guidance

Topics in this practice bank

These topics describe the available practice for PCPP1™ – Certified Professional Python Programmer Level 1. Review the examination outline and its sources for scope and allocation details.

  • Advanced Object-Oriented Programming
    • Understand and explain the basic terms and programming concepts used in the OOP paradigm
    • Perform Python core syntax operations
    • Understand and use inheritance, polymorphism, and composition
    • Understand extended function argument syntax and use decorators
    • Design, build, and use static and class methods
    • Understand and use abstract classes and methods
    • Understand attribute encapsulation
    • Apply subclassing of built-in classes
    • Advanced techniques for creating and serving exceptions
    • Perform shallow and deep copy operations
    • (De)serialize Python objects
    • Explain the concept of metaprogramming
  • Coding Conventions, Best Practices, and Standardization
    • Python Enhancement Proposals and Python philosophy
    • Employ PEP 8 guidelines, conventions, and best practices
    • Employ PEP 257 conventions and related standards
  • GUI Programming
    • Basic concepts and terminology for GUI programming
    • Use GUI toolkits, blocks, and conventions to build simple GUIs
    • Widgets and event handling
  • Network Programming
    • Basic concepts of network programming
    • Work with sockets in Python
    • Data transfer mechanisms
    • Design, develop, and improve a simple REST client
  • File Processing and Communicating with a Program’s Environment
    • Database programming in Python
    • Process different file formats in Python

How to use these free practice questions

Choose an answer, check the explanation, and review your progress by chapter. Practice questions and explanations are free to access without signing up.

These are independent study questions, not actual examination items. For examination requirements and official information, view PCPP1™ – Certified Professional Python Programmer Level 1 details.