Free PCAP-31-03 Mock Exam – Practice Online Confidently

Increase your chances of passing the Python Institute PCAP-31-03 exam questions on your first try. Practice with our free online PCAP-31-03 exam mock test designed to help you prepare effectively and confidently.

Exam Code: PCAP-31-03
Exam Questions: 704
Certified Associate in Python Programming
Updated: 03 Apr, 2026
Question 1

You are going to read 16 bytes from a binary file into a bytearray called dat
a. Which lines would you use? (Select two answers)

Options :
Answer: A,D

Question 2

What is the expected output of the following code?

1. class A:

2.     def __init__(self):

3.         self.text = 'abc'

4.         self.count = 0

5.  

6.     def __iter__(self):

7.         return self

8.  

9.     def __next__(self):

10.         if self.count == len(self.text):

11.             raise StopIteration

12.         value = self.text[self.count]

13.         self.count += 1

14.         return value

15.  

16.  

17. for x in A():

18.     print(x, end='')

Options :
Answer: C

Question 3

What is the expected output of the following code?

1. class A:

2.     def __init__(self, x=2, y=3):

3.         self.x = x

4.         self.y = y

5.  

6.     def __str__(self):

7.         return 'A'

8.  

9.     def __eq__(self, other):

10.         return self.x * self.y == other.x * other.y

11.  

12.  

13. a = A(1, 2)

14. b = A(2, 1)

15. print(a == b)

Options :
Answer: A

Question 4

Which one of the following is true?

Options :
Answer: A

Question 5

What is the expected output of the following code?

x = 4.5

y = 2

print(x // y)

Options :
Answer: D

Viewing Page : 1 - 71
Practicing : 1 - 5 of 704 Questions

© Copyrights FreeMockExams 2026. All Rights Reserved

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