Python Institute PCPP1

Page:    1 / 113   
Total 564 questions | Updated On: Apr 25, 2024
Question 1

Diamond Problem. Suppose you have the following class hierarchy:
class A:
    def hello(self):
        print('Hello from class A')
 
 
class B(A):
    def hello(self):
        print('Hello from class B')
 
 
class C(A):
    def hello(self):
        print('Hello from class C')
 
 
class D(A, C):
    pass
What is the result of the following method call?
D().hello()


Answer: A
Question 2

Which of the following statements best describes the difference between inheritance and composition in object-oriented programming?


Answer: B
Question 3

In Python, which of the following methods is necessary to override when inheriting from a built-in immutable class (like tuple or str) if you want to add additional attributes to it?


Answer: A
Question 4

You are building a Python application that needs to send an HTTP POST request with JSON data to a remote server. Which code snippet correctly demonstrates the usage of the requests module to accomplish this task?


Answer: D
Question 5

Suppose you have the following code:
class ClientList(list):
    def search_email(self, value):
        result = [client for client in self if value in client.email]
        return result
 
class Client:
    all_clients = ClientList()
 
    def __init__(self, name, email):
        self.name = name
        self.email = email
        Client.all_clients.append(self)
Select all true statements. (select 2)


Answer: B,C
Page:    1 / 113   
Total 564 questions | Updated On: Apr 25, 2024

Quickly grab our PCPP1 product now and kickstart your exam preparation today!

Name: Certified Professional in Python Programming 1
Exam Code: PCPP1
Certification: PCPP
Vendor: Python Institute
Total Questions: 564
Last Updated: Apr 25, 2024