OpenExamsFREE PRACTICE — ANY EXAM

Free PCAP™ – Certified Associate Python Programmer Practice Questions

200 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 PCAP™ – Certified Associate Python Programmer practice bank. Each includes the answer and explanation. Continue with the interactive practice above to review the full question set.

  1. 1A Python program runs `import sound.effects.echo` successfully. Which expression refers to the imported module using the name made available by that statement?

    1. A.`sound.effects.echo`Correct answer: A
    2. B.`effects.echo`
    3. C.`echo`
    4. D.`sound.echo`

    Explanation: The tutorial states: "This loads the submodule sound.effects.echo. It must be referenced with its full name." The statement binds the top-level package name, so the full path is used.

    Reference: The Python Tutorial: Modules — 6.4. Packages

  2. 2When an exception is raised in a `try` suite, in what order does Python search the corresponding `except` clauses?

    1. A.In the order they appearCorrect answer: A
    2. B.From the last clause to the first
    3. C.From the most specific class to the least specific class
    4. D.In alphabetical order by exception name

    Explanation: The reference states: "This search inspects the except clauses in turn until one is found that matches the exception." Python stops at the first matching handler.

    Reference: The Python Language Reference: Compound statements — 8.4. The try statement

  3. 3What does the notation `U+265E` identify in Unicode?

    1. A.A Unicode code pointCorrect answer: A
    2. B.A UTF-8 byte sequence
    3. C.A font-rendered glyph
    4. D.A Unicode character name

    Explanation: The documentation states: "U+265E is a code point, which represents some particular character;" The number identifies a code point, independently of its encoded bytes.

    Reference: Python Unicode HOWTO — Definitions

  4. 4In Python's object-oriented model, what is a class?

    1. A.A template for creating user-defined objectsCorrect answer: A
    2. B.One particular instance created from a template
    3. C.A stored value belonging to one instance
    4. D.A bound method belonging to one instance

    Explanation: The glossary defines a class as "A template for creating user-defined objects." Its instances are the objects created from that template.

    Reference: Python Glossary — class

  5. 5What is `[x * 2 for x in [1, 2, 3]]`?

    1. A.`[2, 4, 6]`Correct answer: A
    2. B.`[1, 2, 3, 1, 2, 3]`
    3. C.`[1, 4, 9]`
    4. D.`[2, 3, 4]`

    Explanation: The tutorial states: "each element is the result of some operations applied to each member of another sequence or iterable" The expression doubles each input value.

    Reference: The Python Tutorial: Data Structures — 5.1.3. List Comprehensions

  6. 6After `import foo.bar.baz as fbb` succeeds, which name directly refers to the imported `foo.bar.baz` module in the importing namespace?

    1. A.`foo`
    2. B.`bar`
    3. C.`fbb`Correct answer: C
    4. D.`baz`

    Explanation: The language reference gives the example "import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as fbb". The alias is bound to the requested module.

    Reference: The Python Language Reference: Simple statements — 7.11. The import statement

  7. 7Where must a bare `except:` clause appear among the handlers of a `try` statement?

    1. A.Before all named handlers
    2. B.After all named handlersCorrect answer: B
    3. C.Immediately before `else` only when there is no `finally`
    4. D.It can appear in any handler position

    Explanation: The reference states: "An expression-less except clause, if present, must be last; it matches any exception." A bare clause matches any exception and must be last.

    Reference: The Python Language Reference: Compound statements — 8.4. The try statement

  8. 8What is the relationship between ASCII text and UTF-8?

    1. A.Every ASCII text string is valid UTF-8 text.Correct answer: A
    2. B.ASCII text must always be converted to two-byte UTF-8 units.
    3. C.ASCII and UTF-8 use disjoint code points.
    4. D.Only ASCII digits are valid UTF-8 text.

    Explanation: The documentation states: "A string of ASCII text is also valid UTF-8 text." ASCII byte sequences are valid UTF-8 sequences.

    Reference: Python Unicode HOWTO — Encodings

  9. 9An account object has a balance attribute and methods for deposit, withdrawal, and display. Which component represents its stored state?

    1. A.The balance attributeCorrect answer: A
    2. B.The deposit method
    3. C.The withdrawal method
    4. D.The display method

    Explanation: The tutorial states: "Each class instance can have attributes attached to it for maintaining its state." A data attribute can represent the object's state.

    Reference: The Python Tutorial: Classes — 9. Classes

  10. 10What is `[x for x in [1, 2, 3, 4] if x % 2 == 0]`?

    1. A.`[2, 4]`Correct answer: A
    2. B.`[1, 3]`
    3. C.`[True, False, True, False]`
    4. D.`[1, 2, 3, 4]`

    Explanation: The tutorial states: "create a subsequence of those elements that satisfy a certain condition." Only the even values satisfy the filter.

    Reference: The Python Tutorial: Data Structures — 5.1.3. List Comprehensions

Topics in this practice bank

These topics describe the available practice for PCAP™ – Certified Associate Python Programmer. Review the examination outline and its sources for scope and allocation details.

  • Modules and Packages
    • Import and use modules and packages
    • Perform evaluations using the math module
    • Generate random values using the random module
    • Discover host platform properties using the platform module
    • Create and use user-defined modules and packages
  • Exceptions
    • Handle errors using Python-defined exceptions
    • Extend the exceptions hierarchy with self-defined exceptions
  • Strings
    • Understand machine representation of characters
    • Operate on strings
    • Employ built-in string methods
  • Object-Oriented Programming
    • Understand the object-oriented approach
    • Employ class and object properties
    • Equip a class with methods
    • Discover the class structure
    • Build a class hierarchy using inheritance
    • Construct and initialize objects
  • Miscellaneous (List Comprehensions, Lambdas, Closures, I/O)
    • Build complex lists using list comprehensions
    • Embed lambda functions into code
    • Define and use closures
    • Understand basic input/output terminology
    • Perform input/output operations

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 PCAP™ – Certified Associate Python Programmer details.