Python Institute PCAD – Certified Advanced Python Developer Exam Questions And Correct A, Exams of Computer Science

Python Institute PCAD – Certified Advanced Python Developer Exam Questions And Correct Answers (Verified Answers) Plus Rationales 2025/2026 Q&A | Instant Download Pdf

Typology: Exams

2025/2026

Available from 12/16/2025

lewis-nyaga-muriithi
lewis-nyaga-muriithi 🇺🇸

2.2K documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Python Institute PCAD Certified Advanced Python
Developer Exam Questions And Correct Answers (Verified
Answers) Plus Rationales 2025/2026 Q&A | Instant Download
Pdf
1. Which of the following is TRUE about Python’s descriptor
protocol?
A. Descriptors only work with classes that inherit from object
B. Descriptors must define all three methods: __get__, __set__, and
__delete__
C. Descriptors are objects implementing any of the methods
__get__, __set__, or __delete__
D. Descriptors cannot be used with class attributes
Answer: C
Any object implementing at least one of the descriptor methods is
treated as a descriptor.
2. What is the result of calling super() inside a class using multiple
inheritance?
A. It always calls the method on the first base class
B. It calls the method on the last base class
C. It follows the MRO (Method Resolution Order)
D. It calls all parent classes in order
Answer: C
super() follows the MRO determined by C3 linearization.
3. Which of the following creates a context manager without a
class?
A. with lambda():
B. context()
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Python Institute PCAD – Certified Advanced Python Developer Exam Questions And Correct A and more Exams Computer Science in PDF only on Docsity!

Python Institute PCAD – Certified Advanced Python

Developer Exam Questions And Correct Answers (Verified

Answers) Plus Rationales 2025/2026 Q&A | Instant Download

Pdf

1. Which of the following is TRUE about Python’s descriptor protocol? A. Descriptors only work with classes that inherit from object B. Descriptors must define all three methods: get, set, and delete C. Descriptors are objects implementing any of the methods get, set, or delete D. Descriptors cannot be used with class attributes Answer: C Any object implementing at least one of the descriptor methods is treated as a descriptor. 2. What is the result of calling super() inside a class using multiple inheritance? A. It always calls the method on the first base class B. It calls the method on the last base class C. It follows the MRO (Method Resolution Order) D. It calls all parent classes in order Answer: C super() follows the MRO determined by C3 linearization. 3. Which of the following creates a context manager without a class? A. with lambda(): B. context()

C. @contextmanager decorator from contextlib D. @dataclass Answer: C The @contextmanager decorator transforms a generator function into a context manager.

4. Which operation is atomic in CPython due to the GIL? A. Appending to a list B. Incrementing a variable using x += 1 C. Sorting a list D. Writing to a file Answer: B x += 1 is atomic in CPython due to bytecode-level GIL protection. 5. What does the yield from statement do? A. Returns values from multiple functions B. Delegates iteration to a sub-generator C. Runs functions concurrently D. Creates a coroutine automatically Answer: B yield from simplifies generator delegation. 6. Which of the following is TRUE about metaclasses? A. They modify only instance behavior B. Only one metaclass is allowed in a program C. A metaclass controls class creation D. Metaclasses cannot inherit from other types Answer: C Metaclasses customize class construction.

A. It raises StopIteration B. It raises GeneratorExit inside the generator C. It restarts the generator D. Nothing happens Answer: B Closing a generator injects a GeneratorExit.

11. Which module provides tools for memory profiling? A. threading B. multiprocessing C. tracemalloc D. syslog Answer: C tracemalloc tracks memory allocations. 12. Which operator is used to merge dictionaries (Python 3.9+)? A. + B. | C. << D. ^^ Answer: B The | operator merges dictionaries. 13. What is the purpose of slots? A. Makes attributes private B. Prevents dynamic attribute creation & saves memory C. Makes objects faster D. Enables threading

Answer: B slots eliminates per-object dict.

14. What does functools.singledispatch provide? A. Multi-threading B. Function overloading based on argument type C. Decorator for caching D. Dataclass validation Answer: B singledispatch enables generic functions. 15. Which pattern uses a function to wrap another to modify behavior at runtime? A. Proxy B. Factory C. Decorator D. Strategy Answer: C Decorators wrap functions dynamically. 16. What does the walrus operator := do? A. Compares values B. Assigns and returns a value inside an expression C. Creates lambdas D. Clones objects Answer: B The assignment expression evaluates and stores. 17. Which is NOT a valid asyncio state?

Answer: C deepcopy recursively copies objects.

21. Which method is used by async with context managers? A. enter B. exit C. await D. aenter and aexit Answer: D Async context managers implement async variants. 22. Which function retrieves the current event loop? A. asyncio.loop() B. asyncio.get_running_loop() C. loop.current() D. asyncio.loop_current Answer: B get_running_loop() is preferred. 23. What is monkey patching? A. Adding attributes to lists B. Modifying modules or classes at runtime C. Overloading operators D. Inheriting from built-ins Answer: B Monkey patching changes behavior dynamically. 24. What does the GIL primarily protect?

A. Functions B. OS threads C. Python object memory management D. Bytecode execution speed Answer: C The GIL protects reference counting.

25. What is a coroutine? A. A thread B. A function that can be suspended and resumed C. A generator replacement D. A decorator Answer: B Coroutines allow cooperative multitasking. 26. Which method is invoked when using await on a coroutine? A. exec B. future C. await D. async Answer: C Awaitable objects implement await. 27. Which is TRUE about abstract base classes? A. They cannot contain concrete methods B. They can enforce method implementation via @abstractmethod C. They execute faster D. Only built-ins can be ABCs

A. A deep copy of bytes B. A zero-copy view of binary data C. A text formatter D. A file handler Answer: B Memoryviews avoid copying buffer data.

32. Which of the following is TRUE about multithreading in CPython? A. Threads run fully in parallel B. Only one thread executes Python bytecode at a time C. It is deprecated D. It is faster for CPU tasks Answer: B The GIL prevents simultaneous bytecode execution. 33. Which pattern creates objects without specifying exact classes? A. Decorator B. Strategy C. Composite D. Factory Answer: D Factories encapsulate object creation. 34. What is output of sorted(['10', '2', '1'], key=int)? A. ['1','10','2'] B. ['1','2','10'] C. ['10','2','1'] D. TypeError

Answer: B Sorting numerically based on int conversion.

35. What is the purpose of @lru_cache? A. Multithreading safety B. Memoization C. Provides async features D. Avoid recursion Answer: B LRU cache stores computed results. 36. What happens when an exception is not handled in a thread? A. It is ignored B. It terminates the thread but not the program C. Stops all threads D. Raises in main thread Answer: B Unhandled thread exceptions kill only that thread. 37. What does ast module do? A. Runs async tasks B. Creates sockets C. Parses and manipulates Python abstract syntax trees D. Handles timezones Answer: C ast helps analyze or transform code. 38. What is a context variable used for?

Answer: B Pickle handles arbitrary Python objects.

42. Which tool helps identify code bottlenecks? A. xml B. tracemalloc C. cProfile D. mailbox Answer: C cProfile is a performance profiler. 43. What is a frozen dataclass? A. A dataclass with no fields B. A dataclass stored on disk C. A dataclass whose fields are immutable D. A dataclass for caching Answer: C Frozen dataclasses prohibit modification. 44. Which decorator converts a function into a static method? A. @classmethod B. @staticmethod C. @static D. @function Answer: B @staticmethod does not receive an implicit self. 45. What is the result of calling next() on a closed generator?

A. Restarts B. Raises StopIteration immediately C. Returns None D. Reopens the generator Answer: B A closed generator is exhausted.

46. What is the function of super().init()? A. Creates new methods B. Calls the parent class initializer C. Changes inheritance D. Creates metaclasses Answer: B Delegates initialization to parent. 47. What does a re-entrant lock allow? A. Only one acquisition B. No thread safety C. The same thread can acquire it multiple times D. Multiple threads inside the lock Answer: C RLocks allow repeated acquisitions by the same thread. 48. What is the complexity of accessing a dict key? A. O(n) B. O(1) average C. O(log n) D. O(n log n)

A. io B. queue C. sched D. contextlib Answer: B queue supports synchronized FIFO/LIFO/priority queues.

53. Which function registers exit handlers executed on normal interpreter termination? A. atexit.run() B. runtime.exit() C. os.cleanup() D. atexit.register() Answer: D atexit functions execute when the interpreter finishes. 54. Which format is safest for cross-language serialization? A. pickle B. marshal C. json D. repr Answer: C JSON is language-agnostic; pickle is Python-specific. 55. What keyword forces a generator to continue running after receiving sent values? A. push B. yield* C. continue

D. yield Answer: D yield receives values sent via .send().

56. Which method is invoked when an attribute lookup fails? A. getitem B. members C. getattr D. getattribute Answer: C getattr is called only for missing attributes. 57. Which of the following can be used as a coroutine cancellation mechanism? A. try–except–finally B. asyncio.CancelledError C. ValueError D. abort Answer: B Cancelled coroutines receive CancelledError. 58. Which library provides tools for working with IPv4/IPv addresses? A. binary B. web C. ipaddress D. network Answer: C ipaddress handles IP networks and interfaces.

D. Encrypts data Answer: C bisect provides efficient insertion into sorted lists.

63. What does shutil.copytree() do? A. Copies only files B. Copies only directories C. Recursively copies an entire directory tree D. Compresses folders Answer: C copytree duplicates full directory structures. 64. Which object is used in asyncio to synchronize coroutines? A. Event B. Semaphore C. Lock D. All of the above Answer: D asyncio implements async locks, events, and semaphores. 65. Which statement is TRUE about frozenset? A. Mutable B. Slower than set C. Can contain lists D. Hashable (if elements are hashable) Answer: D frozenset can be used as dict keys. 66. What is the purpose of enter in a context manager?

A. Cleanup B. Error handling C. Resource acquisition D. Sleep Answer: C Executed before the with block runs.

67. Which method allows customizing attribute access globally? A. read B. intercept C. getattribute D. get Answer: C getattribute is always called for attribute lookup. 68. What is the state of a Future that completed with an exception? A. PENDING B. FINISHED C. CANCELLED D. EXCEPTIONAL Answer: B Finished—its result contains an exception. 69. What type is returned by re.finditer()? A. list B. tuple C. iterator of match objects D. string