Python Institute PCAP-31-03 Certified Associate in Python Programming Exam Online Training
Python Institute PCAP-31-03 Online Training
The questions for PCAP-31-03 were last updated at Nov 19,2024.
- Exam Code: PCAP-31-03
- Exam Name: Certified Associate in Python Programming Exam
- Certification Provider: Python Institute
- Latest update: Nov 19,2024
Which of the following expression evaluate to True? (Select two answers)
- A . len(”•) == 1
- B . len("""
""") == o - C . chr(ordCA’) + 1) == ‘B’
- D . ord("Z") – ord("z") — ord("0")
With regards to the directory structure below, select the proper forms of the directives in order to import module_a. (Select two answers)
- A . import pypack.module_a
- B . import module_a from pypack
- C . import module_a
- D . from pypack import module_a
You are going to read 16 bytes from a binary file into a bytearray called data .
Which lines would you use?
- A . data = bytearray (16) bf.readinto (data)
- B . data = binfile.read (bytearray (16))
- C . bf. readinto (data = bytearray (16))
- D . data = bytearray (binfile.read (16))
D
Explanation:
https://docs.python.org/3/library/functions.html#func-bytearray https://docs.python.org/3/library/io.html
Which of the following statement are true? (Select two answers)
- A . closing an open file is performed by the closefile ( ) function
- B . the second open ( ) argument describes the open mode and defaults to ‘w’
- C . if open ( ) ‘s second argument is ‘r’ the file must exist or open will fail
- D . if open ( )’s second argument is ‘w’ and the invocation succeeds, the previous file’s content is lost
The__bases__property contains:
- A . base class locations (addr)
- B . base class objects (class)
- C . base class names (str)
- D . base class ids (int)
The following class hierarchy is given .
What is the expected out of the code?
- A . BB
- B . CC
- C . AA
- D . BC
A method for passing the arguments used by the following snippet is called:
- A . sequential
- B . named
- C . positional
- D . keyword
If you want to access an exception object’s components and store them in an object called e, you have to use the following form of exception statement
- A . except Exception(e):
- B . except e=Exception:
- C . except Exception as e:
- D . such an action is not possible in Python
C
Explanation:
Reference: https://stackoverflow.com/questions/32613375/python-2-7-exception-handling-syntax
What is true about Object-Oriented Programming in Python? (Select two answers)
- A . encapsulation allows you to protect some data from uncontrolled access
- B . the arrows on a class diagram are always directed from a superclass towards its
subclass - C . inheritance is the relation between a superclass and a subclass
- D . an object is a recipe for a class
What is the expected behavior of the following code?
- A . It outputs False
- B . It outputs nothing
- C . It outputs True
- D . It raises an exception