
PCPP1 Free Practice Questions
The PCPP1™ – Certified Professional Python Programmer Level 1 certification is the first-level credential of the General-Purpose Programming track offered by the OpenEDG Python Institute. This certification is designed for developers, IT professionals, and individuals in the workforce seeking to validate their skills and expertise in advanced computer programming and the Python language.
The PCPP1™ certification demonstrates a candidate's proficiency in using classes and advanced features of Python, adhering to coding conventions and standards, creating GUI applications using standard tools and event-driven programming, understanding network programming and data formats, and utilizing key modules from the Python Standard Library for file processing and system interaction.
The following questions sourced from the PCPP1 Practice Tests Study Plan provided by MyExamCloud. For brief explanations of these questions, you can take the Free PCPP1 (PCPP-32-101) Practice Mock Exam available at the PCPP1 Practice Tests Study Plan.
Topic:Section 1: Creating and Distributing Packages
QUESTION: 1
Which of the following ways a distribution may relate to packages?
A:It can provide packages or modules.
B:It can require packages or modules.
C:It can obsolete packages or modules.
D:It can export packages or modules.
ANSWER: Choice A,Choice B,Choice C
Topic:Section 1: Creating and Distributing Packages
QUESTION: 2
Which of the following statemente are true about Distutils?
A:If you leave packages = ['foo'], the Distutils will issue an error and the package process will be broken.
B:When packages = ['foo'] is included in setup script, the Distutils will issue a warning but still process the broken package anyway.
C:When packages = ['foo'] is included in setup script, you are promising that the Distutils will find a file foo/__init__.py
D:If you leave packages = ['foo'], the Distutils will issue a warning but still process the broken package anyway.
ANSWER: Choice C
Topic:Section 1: Creating and Distributing Packages
QUESTION: 3
Which class can be subclassed for a testcase?
A:unittest.TestCase
B:pytest.TestCase
C:test.TestCase
D:abc.TestCase
ANSWER: Choice A
Topic:Section 2: Patterns
QUESTION: 4
Which pattern is implemented in the below code?
from abc import ABC
class Action(ABC):
def __init__(self, receiver):
self.receiver = receiver
def process(self):
pass
def perform_action(self):
pass
class ActionHandler(Action):
def __init__(self, receiver):
self.receiver = receiver
def process(self):
self.receiver.perform_action()
class LoginAction():
def perform_action(self):
print('Login Action Called...')
class LogoutAction():
def perform_action(self):
print('Logout Action Called...')
class App:
def handle_action(self, action):
self.action = action
def execute(self):
self.action.process()
if __name__ == "__main__":
login = LoginAction()
logout = LogoutAction()
action1 = ActionHandler(login)
action2 = ActionHandler(logout)
action1.process()
action2.process()
A:State
B:Model-View-Controller
C:Factory
D:Command
E:Observer
ANSWER: Choice D
Topic:Section 2: Patterns
QUESTION: 5
A developer has created follolwing code to read config information of your app.
class AppConfig:
app_dic = {}
def __init__(self, file):
self.file = file
app_dic = {} # load values from file
def get_value(self, key):
return self.state
You are assigned to re-factor the above code to provide one and only AppConfig object when your team tries to creates AppConfig objects.
Which design pattern can achive your goal?
A:Command
B:Singleton
C:Template Method
D:Proxy
ANSWER: Choice B
Topic:Section 3: Interprocess Communication
QUESTION:Which package offers both local and remote concurrency?
A:multiprocessing
B:threading
C:Both multiprocessing and threading
D:None of the above.
ANSWER: Choice A
Topic:Section 3: Interprocess Communication
QUESTION: 6
What is the output of the following code?
from threading import Thread
class MyThread(Thread):
def run(self):
count = 0
count += 1
print("Run called...", count)
th1 = MyThread()
th2 = MyThread()
th3 = MyThread()
th1.start()
th2.start()
th3.start()
A:AttributeError: 'MyThread' object has no attribute 'start'.
B:Run called... 1
Run called... 1
Run called... 1
C:Run called... 1
Run called... 2
Run called... 3
D:Run called... 0
Run called... 1
Run called... 2
ANSWER: Choice B
Topic:Section 3: Interprocess Communication
QUESTION: 7
What is the output of the following code?
from multiprocessing import Pool
def fun(name):
return name*2
if __name__ == '__main__':
with Pool(5) as p:
print(p.map(fun, ["A", "B", "C"]))
A:['AA', 'BB', 'CC', 'AA', 'BB']
B:['AA', 'BB', 'CC']
C:['AA', 'BB', 'CC']['AA', 'BB', 'CC']['AA', 'BB', 'CC']['AA', 'BB', 'CC']['AA', 'BB', 'CC']
D:None of the above.
ANSWER: Choice B
Topic:Section 4: Python Network Programming
QUESTION: 8
Which code creates non-blocking sockets?
A:socket.setnonblocking(False)
B:socket.setnonblocking(True)
C:socket.setblocking(True)
D:socket.setblocking(False)
ANSWER: Choice D
Topic:Section 5: Python-MySQL Database Access
QUESTION: 9
Which option creates MySQL connection?
A:import mysql.connector
conn = mysql.connector.connect(host='localhost',
database='python_mysql',
user='root',
password='pass')
B:import mysql.connector
conn = mysql.connector.create_connect(host='localhost',
database='python_mysql',
user='root',
password='pass')
C:import mysql.connector
conn = mysql.connector.get_connect(host='localhost',
database='python_mysql',
user='root',
password='pass')
D:import mysql.connection
conn = mysql.connection.create_connect(host='localhost',
database='python_mysql',
user='root',
password='pass')
E:import mysql.connection
conn = mysql.connection.get_connect(host='localhost',
database='python_mysql',
user='root',
password='pass')
F:import mysql.connection
conn = mysql.connection.connect(host='localhost',
database='python_mysql',
user='root',
password='pass')
ANSWER: Choice A
Topic:Section 4: Python Network Programming
QUESTION: 10
Which option enables myserver would be visible to the outside world?
myserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
A:myserver.bind(('localhost', 80))
B:myserver.bind((socket.gethostname(), 80))
C:myserver.bind(('127.0.0.1', 80))
D:None of the above.
ANSWER: Choice B
Topic:Section 5: Python-MySQL Database Access
QUESTION: 11
Which MySQLConnection
method check if the connection to the MySQL database has been established successfully or not?
A:is_established()
B:is_connected()
C:connected()
D:isconnected()
ANSWER: Choice B
Author | JEE Ganesh | |
Published | 4 months ago | |
Category: | Python Certification | |
HashTags | #Python #PythonCertification |