Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
th
QUIZ#4(26
April2015)
d.super.
Q6:Considertheclassesbelow,declaredinthesamefile:
classA
{
inta;
publicA()
{
a=7;
}
}
classBextendsA
{
intb;
publicB()
{
b=8;
}
}
Whichofthestatementsbelowisfalse?
a.Bothvariablesaandbareinstancevariables.
b.AftertheconstructorforclassBexecutes,thevariableawill
havethevalue7.
c.AftertheconstructorforclassBexecutes,thevariablebwill
havethevalue8.
d.AreferenceoftypeAcanbetreatedasareferenceoftypeB.
Q7: Which of the following is the superclass constructor call
syntax?
a.keywordsuper,followedbyadot(.).
b.keywordsuper,followedbyasetofparenthesescontainingthe
superclassconstructorarguments.
c.keywordsuper,followedbyadotandthesuperclassconstructor
name.
d.Noneoftheabove.
Q8:Whenasubclassconstructorcallsitssuperclassconstructor,
Q10:Whichofthefollowingstatementsaboutinterfacesisfalse?
a.Aninterfacedescribesasetofmethodsthatcanbecalledon
anobject,providingadefaultimplementationforthemethods.
b.Aninterfacedescribesasetofmethodsthatcanbecalledon
anobject,notprovidingconcreteimplementationforthemethods.
c. Interfaces are useful when attempting to assign common
functionalitytopossiblyunrelatedclasses.
d. Once a class implements an interface, all objects of that
classhaveanisarelationshipwiththeinterfacetype.
Q11:Polymorphismallowsforspecificstobedealtwithduring:
a.execution.
b.compilation.
c.programming.
d.debugging.
Q12:A(n)_________classcannotbeinstantiated.
a.final.
b.concrete.
c.abstract.
d.polymorphic.
Q13: If the superclass contains only abstract method
declarations,thesuperclassisusedfor:
a.implementationinheritance.
b.interfaceinheritance.
c.Both.
d.Neither.