Special Offer! Guaranteed Success Made Affordable - 20% Off Exam Questions | Ends In Coupon code:TEL20
Stay Ahead with Latest PCAP-31-03 PCAP Practice Test Questions 2026
A class constructor (Select two answers)
What is the expected output of the following code?
1. file = open('data.txt', 'w+')
2. print('Name of the file: ', file.name)
3.
4. s = 'Peter Wellert\nHello everybody'
5. file.write(s)
6. file.seek(0)
7. for line in file:
8. print(line)
9.
10. file.close()
Which of the following messages will appear on the screen when the code is run?
1. class Failure(Exception):
2. def __init__(self, message):
3. self.message = message
4.
5. def __str__(self):
6. return "out of order"
7.
8.
9. try:
10. print("turn on")
11. raise Failure("crash")
12. except Failure as problem:
13. print(problem)
14. else:
15. print("success")
(Select two answers.)
Is there a way to check if a class is a subclass of another class?
A predefined Python variable that stores the current module name is called:
© Copyrights TheExamsLab 2026. All Rights Reserved
We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the TheExamsLab.