Python Institute Pcap 31 03 Practice Test - Set 1

Test your knowledge with this Python Institute Pcap 31 03 mock exam. Get real-world IT questions and prepare for certification success.

PCAP - Certified Associate in Python Programming - Exam Information

Exam Information

Exam Code

Python Institute Pcap 31 03

Exam Title

PCAP - Certified Associate in Python Programming

Vendor

Python Institute

Difficulty

Intermediate

Duration

65 Minutes

Question Format

Multiple Choice

Last Updated

February 23, 2025

The PCAP certification validates the ability to accomplish intermediate-level coding tasks in Python programming.

Practice Test

Shop Best PCAP - Certified Associate in Python Programming Resources Worldwide Amazon

1. Which module in Python is used for regular expressions?

re
regex
match
string

2. What does the __init__ method do in Python classes?

Initializes an instance
Deletes an instance
Defines a static method
Creates a class method

3. Which keyword is used to create a subclass in Python?

class
inherit
extends
subclass

4. Which method is called when an object is deleted?

__del__
__delete__
__destroy__
__remove__

5. How do you check if a key exists in a dictionary?

key in dict
dict.has_key(key)
exists(dict, key)
dict.contains(key)

6. Which of the following is true about Python class variables?

They are shared among all instances of a class
They are defined inside methods only
Each instance has a separate copy
They must be defined using global keyword

7. What will `print(type(lambda x: x))` output?

None

8. What will happen if you try to access an undefined variable?

NameError
ValueError
SyntaxError
None

9. Which Python function is used to dynamically import a module?

__import__()
importlib.import_module()
import()
sys.import()

10. Which of the following data types is mutable?

List
Tuple
String
Integer

11. What is the default return value of a function that does not return anything explicitly?

None
0
False
Empty String

12. Which of the following is used to handle exceptions in Python?

try-except
catch
error-handling
handle

13. Which of the following functions converts an object into a string representation?

repr()
str()
print()
stringify()

14. Which of the following is **not** a valid Python identifier?

3variable
_private
class_
varName

15. What will `list(range(2, 8, 2))` return?

[2, 4, 6]
[2, 3, 4, 5, 6, 7, 8]
[2, 8, 2]
[2, 6, 8]

16. Which method is used to add an element to a set?

add()
insert()
append()
push()

17. Which of the following is used to iterate over a dictionary’s keys and values?

items()
keys()
values()
iter()

18. Which of the following is **not** a valid way to create an empty set?

{}
set()
set([])
set(())

19. What does `enumerate()` return?

An iterator that yields pairs (index, value)
A list of tuples
A dictionary
An index

20. Which built-in function returns the largest item in an iterable?

max()
largest()
top()
greatest()

21. What does the `@property` decorator do in Python?

Creates a getter method
Makes a method private
Defines a class property
Marks a method as static

22. Which method is called when using the `with` statement?

__enter__()
__start__()
__open__()
__with__()

23. What will `print(globals() is locals())` output in global scope?

True
False
None
Error

24. Which function returns a map object?

map()
filter()
reduce()
apply()

25. What is the output of `print({x: x**2 for x in range(3)})`?

{0: 0, 1: 1, 2: 4}
[0, 1, 4]
{0, 1, 4}
Error

26. Which method is used to implement operator overloading for addition?

__add__()
__plus__()
__sum__()
__operator__()

27. What will `print(hasattr(str, "upper"))` output?

True
False
None
Error

28. Which module is used for working with dates?

datetime
date
time
calendar

29. What is the output of `print(all([True, False, True]))`?

False
True
None
Error

30. Which method is called to implement the iterator protocol?

__next__()
__iter__()
__loop__()
__sequence__()

31. What will `print(callable(len))` output?

True
False
None
Error

32. Which function returns a zip object?

zip()
map()
enumerate()
combine()

33. What is the output of `print(issubclass(bool, int))`?

True
False
None
Error

34. Which decorator is used for memoization?

@functools.lru_cache()
@memoize
@cache
@remember

35. What will `print(any([False, True, False]))` output?

True
False
None
Error

36. Which method is used to serialize an object to JSON?

json.dumps()
json.serialize()
json.encode()
json.to_string()

37. What is the output of `print(isinstance(True, int))`?

True
False
None
Error

38. Which module provides support for regular expressions?

re
regex
match
string

39. What will `print(sorted([3, 1, 2], reverse=True))` output?

[3, 2, 1]
[1, 2, 3]
[3, 1, 2]
Error

40. Which method is used to dynamically import a module?

__import__()
importlib.import_module()
import()
sys.import()

41. What is the output of `print([x**2 for x in range(3)])`?

[0, 1, 4]
[1, 4, 9]
[0, 1, 2]
Error

42. Which decorator is used to define a class method?

@classmethod
@staticmethod
@method
@class

The Python Institute Pcap 31 03 certification is a globally recognized credential for IT professionals. This practice test helps you prepare by covering key topics like hardware, networking, troubleshooting, and security.

Want more practice? Check out our other mock exams:

© 2025 ITCertRocket.com - Hands-On IT Lab Exercises & Certification Prep. All rights reserved.