以下程序的输出是( )class cls1(object):a=1def mt(self):return self.aclass cls2(cls1):def mt(self):return self.a+1class prt(object):def mt(self,obj):obj.a+=1obj=cls2()p=prt()p.mt(obj)print(obj.a)A 1B 2C 3D 4

以下程序的输出是( )

class cls1(object):

a=1

def mt(self):

return self.a

class cls2(cls1):

def mt(self):

return self.a+1

class prt(object):

def mt(self,obj):

obj.a+=1

obj=cls2()

p=prt()

p.mt(obj)

print(obj.a)

A 1

B 2

C 3

D 4

参考答案与解析:

相关试题

class CircularQueue: def __init__(self, cap=10): self.capacity = cap # 循环队列的容量 sel

class CircularQueue: def __init__(self, cap=10): self.capacity = cap

  • 查看答案
  • 1 Stuart is a self£­employed business co

    [试题]1 Stuart is a self-employed business consultant aged 58. He is married to Rebecca, aged 55. They have one child,Sam, who is aged 24 and single.In November 2005 Stuart sold a house in Plymouth for £422,100. Stuart had inherited the house on the death o

  • 查看答案
  • 运行以下程序后,输出的图案是()。Form1.ClS A$=Strillg$(1

    [单选题]运行以下程序后,输出的图案是( )。F.orm1.ClSA.$=Strillg$(10,“*”)F.ori=1 To 5n=10-2*IX$=A$:Y$=Space$(n)Mid$(X$,i+1,n)=Y$PrintX$NextiA.B.C.D.

  • 查看答案
  • Match the qualities with the numbered explanations below thema Self - awareness b Self - managementc

    Match the qualities with the numbered explanations below thema Self - awareness

  • 查看答案
  • 运行以下程序后,输出的图案是()。Forml.ClS ForA=1 To5 Pt

    [单选题]运行以下程序后,输出的图案是( )。F.orml.ClSF.orA=1 To5Ptintf Space(5-A);StdnS(A,"*")NextAA.B.C.D.

  • 查看答案
  • Career Planning CycleStage 1: Self Understanding- Know yourself through an 1 ____________ psychometr

    Career Planning CycleStage 1: Self Understanding- Know yourself through an 1 ___

  • 查看答案
  • According to the study, there are two primary types of self-awareness. Internal self-awareness refle

    According to the study, there are two primary types of self-awareness. Internal

  • 查看答案
  • It is obvious that_________,self£­awaren

    [单选题]It is obvious that_________, self-awareness is a healthy quality, overdoing it is harmful.A. sinceB. asC. whenD. while

  • 查看答案
  • Criticism and self£­criticism is necessa

    [单选题]C.riticismandself-criticismisnecessary________ithelpsustofindandcorrectourmistakes.A.)bythatB)atthatC)onthatD)inthat

  • 查看答案
  • 自我评价(self evaluation)

    [名词解释] 自我评价(self evaluation)

  • 查看答案