×

Special Offer! November Sale at DumpsCity! Get 20% Off on All Certification Exam Questions. Use Code: DC20OFF

Free Python Institute PCPP-32-101 Exam Questions

Try our Free Demo Practice Tests for Comprehensive PCPP-32-101 Exam Preparation

  • Python Institute PCPP-32-101 Exam Questions
  • Provided By: Python Institute
  • Exam: Certified Professional in Python Programming 1
  • Certification: PCPP
  • Total Questions: 564
  • Updated On: Nov 12, 2024
  • Rated: 4.9 |
  • Online Users: 1128
Page No. 1 of 113
Add To Cart
  • Question 1
    • Suppose you have the following Laptop class:

      1. class Laptop:

      2.     def __init__(self, ram=8):

      3.         self.ram = ram

      4.  

      5.     def set(self, ram=4):

      6.         self.ram += ram

      7.         return self.ram

      What is the expected output of the following code?

      laptop = Laptop()

      print(laptop.ram)

      laptop.set()

      print(laptop.ram)

      laptop.set(8)

      print(laptop.ram)


      Answer: D
  • Question 2
    • Consider the following code snippet:

      class BankAccount:

          interest_rate = 0.05

          total_accounts = 0

       

          def __init__(self, account_number, balance):

              self.account_number = account_number

              self.balance = balance

              BankAccount.total_accounts += 1

       def deposit(self, amount):

              self.balance += amount

       

          def withdraw(self, amount):

              if amount <= self.balance:

                  self.balance -= amount

              else:

                  print("Insufficient funds!")

       @classmethod

          def set_interest_rate(cls, rate):

              cls.interest_rate = rate

       

      account1 = BankAccount("123456", 1000)

      account2 = BankAccount("987654", 500)

       

      account1.deposit(500)

      account2.withdraw(200)

       print(account1.balance)

      print(account2.balance)

      print(BankAccount.interest_rate)

      print(BankAccount.total_accounts)

      What will be the output of the code snippet?


      Answer: A
  • Question 3
    • What is the main reason for subclassing a built-in class?

      Answer: B
  • Question 4
    • Consider the following Python code:

      1. class Foo:

      2.     def __init__(self, bar):

      3.         self.bar = bar

      4.  

      5.     def update(self, bar):

      6.         self.bar = bar

      7.  

      8. foo = Foo(10)

      9. foo.update(20)

      10. print(foo.bar)

      What will the code print when executed?


      Answer: A
  • Question 5
    • Select all true statements about differences between static and class method. (select 2)

      Answer: B,C
PAGE: 1 - 113
Add To Cart

© Copyrights Dumpscity 2024. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the Dumpscity.