Correct Answer: __repr__
Explanation:
Note: This Question is unanswered, help us to find answer for this one
Python Skill Assessment
Your Skill Level: Poor
Retake Quizzes to improve it
More Python MCQ Questions
Given str='code', what will be the result of the expression str[0] = 'm'?
filter(function, iterable) is equivalent to:
Is it possible to check for more than one error in one except line?
What does the following code do: @something def some_function(): pass
Output of the following script? def f(a, L=[]): L.append(a) return L print(f(1)) print(f(2)) print(f(3))
Correct answer from the given options. class ErrorInCode(Exception): def __init__(self, data): self.data = data def __str__(self): return repr(self.data) try: raise ErrorInCode(1000) except ErrorInCode as ae: print ('0'ae.data) finally: print ('1')
Output of the following Python code? import math a = 3.4536 print ('Result = ',end='') print (math.trunc(a)+math.ceil(a)+math.floor(a))
Correct answer from the options given below. tp1 = (Python ) m = 5 for i in range(int(m-1)):
Output of the following Python code? a = 1 def f(): print (a+2) def g(): a = 2 print (a+1) def h(): global a a = 3 print (a+3) print (a+4) f() print (a+2) g() print (a+1) h() print (a+2)
Output of the following Python code from the given options. set1 = set() set2 = set() for i in range(2, 6): set1.add(i) for i in range(4, 7): set2.add(i) print('Set1 = ', set1) print('Set2 = ', set2) set3 = set1 | set2 set4 = set1 & set2 print(set4) if set3 > set4: print('0') elif set3 < set4: print('2') else : print('1') if set4 < set3: print('0') set5 = set3 - set4 print(set5) if set4.isdisjoint(set5): print('1') set5.clear() print(set5)