Exam Code: PCPP1
Exam Questions: 564
Certified Professional in Python Programming 1
Updated: 16 Apr, 2026
Viewing Page : 1 - 57
Practicing : 1 - 5 of 564 Questions
Question 1

Assume that the following piece of code has been successfully executed:
class Vehicle:
    fleet = 0
 
    def __init__(self, category=None):
        self.category = category if category else 'vehicle'
        Vehicle.fleet += 1
 
    def __str__(self):
        return self.category
 
 
class LandVehicle(Vehicle):
    def __str__(self):
        return super().__str__() + ': land'
 
 
class AirVehicle(Vehicle):
    def __str__(self):
        return super().__str__() + ': air'
What is the expected output of the following piece of code?
veh1 = Vehicle()
veh2 = LandVehicle()
veh3 = AirVehicle()
 
print(veh1)
print(veh2)
print(veh3)

Options :
Answer: C

Question 2

Consider the following Python function:

def process_data(*args, **kwargs):

    if "mode" in kwargs:

        mode = kwargs['mode']

        if mode == 'sum':

            result = sum(args)

        elif mode == 'product':

            result = 1

            for arg in args:

                result *= arg

        else:

            result = None

    else:

        result = None

 return result

Which of the following function calls will correctly compute the product of the given numbers?

Options :
Answer: D

Question 3

Complete the following sentence.

PEP is...

Options :
Answer: C

Question 4

What is the result of the following code?
import shelve
 
 
sh = shelve.open('company', 'w')
sh['name'] = 'Apple'
sh['country'] = 'USA'
sh['currency'] = ['USD', '$']
sh.close()
 
sh_restored = shelve.open('company')
print(sh_restored['currency'])

Options :
Answer: B

Question 5

Suppose you have the following class:

1. class ProductionLine:

2.     def __init__(self, capacity):

3.         self.capacity = capacity

You've created two instances of this class:

1. prod1 = ProductionLine(100)

2. prod2 = ProductionLine(200)

What is the result of the following operation?

Options :
Answer: D

Viewing Page : 1 - 57
Practicing : 1 - 5 of 564 Questions

© Copyrights FreePDFQuestions 2026. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (FreePDFQuestions). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the FreePDFQuestions.