Absolute Java 6th Edition Savitch Test Bank instant download
Absolute Java 6th Edition Savitch Test Bank instant download
install download
https://testbankfan.com/product/absolute-java-6th-edition-
savitch-test-bank/
https://testbankfan.com/product/absolute-java-5th-edition-walter-
savitch-test-bank/
https://testbankfan.com/product/absolute-java-5th-edition-walter-
savitch-solutions-manual/
https://testbankfan.com/product/absolute-c-6th-edition-savitch-
test-bank/
https://testbankfan.com/product/absolute-c-6th-edition-savitch-
solutions-manual/
Absolute C++ 5th Edition Savitch Test Bank
https://testbankfan.com/product/absolute-c-5th-edition-savitch-
test-bank/
https://testbankfan.com/product/absolute-c-5th-edition-savitch-
solutions-manual/
https://testbankfan.com/product/starting-out-with-java-early-
objects-6th-edition-gaddis-test-bank/
https://testbankfan.com/product/problem-solving-with-c-9th-
edition-savitch-test-bank/
https://testbankfan.com/product/problem-solving-with-c-10th-
edition-savitch-test-bank/
Chapter 7 Inheritance 1
Chapter 7
Inheritance
◼ Multiple Choice
1) Inheritance is the process by which a new class – known as a _________ - is created from another
class, called the _____________.
(a) base class, derived class
(b) derived class, base class
(c) inherited class, base class
(d) base class, inherited class
Answer: B
6) What does a derived class automatically inherit from the base class?
(a) instance variables
(b) static variables
(c) public methods
(d) all of the above
Answer: D
9) The special syntax for invoking a constructor of the base class is:
(a) super()
(b) base()
(c) parent()
(d) child()
Answer: A
10) An object of a derived class has the type of the derived class, and it also has the type of the base
class, and more generally, has the type of every one of its ___________ classes.
(a) descendant
(b) child
(c) ancestor
(d) sub
Answer: C
Copyright © 2016 Pearson Education, Inc., Hoboken NJ
Chapter 7 Inheritance 3
11) In using the keyword this in place of super(), the invocation of this must be the ___________
action taken by the constructor.
(a) first
(b) last
(c) it does not matter
(d) none of the above
Answer: A
13) If an instance variable is not modified by public, protected or private then it is said to have:
(a) Package access
(b) Default access
(c) Friendly access
(d) All of the above
Answer: D
16) The equals method for a class should have _________ as the type of its one parameter.
(a) String
(b) Object
(c) Integer
(d) Double
Answer: B
Copyright © 2016 Pearson Education, Inc., Hoboken NJ
Chapter 7 Inheritance 4
◼ True/False
1) A derived class contains only public instance variables and public methods from the base class.
Answer: False
3) A derived class is a class defined by adding instance variables and methods to an existing class.
Answer: True
4) When you define a derived class, you give only the added instance variables and the added methods
as well as all the methods from the base class.
Answer: False
6) Overriding is when a derived class redefines a method from the base class.
Answer: True
7) A constructor for a derived class begins with an invocation of a constructor for the base class.
Answer: True
8) The call to the base class constructor (super) must always be the last action taken in a constructor
definition.
Answer: False
9) You may substitute the keyword this for super() to call a constructor of the derived class.
Answer: True
10) An instance variable (or method) that is private in a base class is accessible by name in the definition
of a method in any other class.
Answer: False
11) Private methods of the base class are not available for use by derived classes.
Answer: True
◼ Short Answer/Essay
1) Explain what a call to super() does in a constructor of a derived class.
Answer: When super() is used in a constructor of a derived class, the matching constructor in the
immediate base class is invoked.
2) Define a base class to represent a Clock. Your class should have instance variables for hours,
minutes and seconds.
Answer:
public Clock()
hour = 0;
minute = 0;
second = 0;
setHour(h);
setMinute(m);
setSecond(s);
/**
*/
hour = h;
else
/**
*/
minute = m;
else
/**
*/
second = s;
else
return hour;
return minute;
return second;
//Facilitator methods
return "The current time is: " + hour + ":" + minute + ":" + second;
if(o == null)
return false;
return false;
else
3) Define a derived class to represent an alarm clock. Use the Clock class, created in number 2 above,
as your base class.
Answer:
/**
An alarm clock should include a time to sound the alarm as well as methods
*/
public AlarmClock()
super();
alarmHour = 0;
alarmMinute = 0;
alarmSecond = 0;
setAlarmHour(alarmH);
setAlarmMinute(alarmM);
setAlarmSecond(alarmS);
alarmHour = alarmH;
else
alarmMinute = alarmM;
else
alarmSecond = alarmS;
else
return alarmHour;
return alarmMinute;
return alarmSecond;
alarmSecond;
//Facilitators
if(o == null)
return false;
return false;
else
otherClock.alarmMinute) &&
(alarmSecond == otherClock.alarmSecond));
4) Create a test driver to test the functionality of your AlarmClock class created in number 3 above.
Answer:
System.out.println(myClock.toString());
myClock.setAlarmHour(7);
System.out.println(myClock.toString());
if(myClock.equals(mySecondClock))
else
5) Explain how parent and child classes are related to base and derived classes.
Answer: A base class is often called the parent class, and a derived class is often called a child
class.
9) What is encapsulation?
Answer: Encapsulation is synonymous with data and detail hiding. Java supports such hiding
through the private modifier.
12) Write Java statements that compares Objects, O1 and O2, using the getClass() method.
Answer:
if(O1.getClass() == O2.getClass())
System.out.println("Same class!");
else
14) What are the different ways in which you can check the class of an Object?
Answer: The method getClass() as well as the operator instanceof may be used to check the class
type of an Object.
15) Create a class to represent a Rectangle. Your class should contain instance variables for length and
width, as well as member method to calculate the area and perimeter.
Answer:
public Rectangle()
length = 0;
width = 0;
setLength(l);
setWidth(w);
if(l >= 0)
length = l;
else
if(w >= 0)
width = w;
else
return length;
return width;
if(o == null)
return false;
return false;
else
(width == otherRectangle.width));
16) Create a test driver to test the functionality of your Rectangle class created in number 14 above.
Answer:
Rectangle r3 = r2;
"\n" + r3.toString());
r1.setLength(8);
r1.setWidth(10);
if(r1.equals(r2))
else
if(r2.equals(r3))
else
Language: Spanish
LIBROS ESPAÑOLES
RAROS Ó CURIOSOS.
TOMO TERCERO.
TRAGICOMEDIA
DE
LISANDRO Y ROSELIA,
LLAMADA ELICIA,
MADRID,
IMPRENTA Y ESTEREOTIPIA DE M. RIVADENEYRA,
calle del Duque de Osuna, núm. 3.
1872.
ADVERTENCIA PRELIMINAR.
A mediados del siglo XVI vió la pública luz en España una obra
titulada La Tragi-comedia de Lisandro y Roselia, escrita en excelente
prosa, con algunos muy escandidos versos, y cuya fábula estaba tan
felizmente concebida como ejecutada; mas tales méritos no
bastaron para salvarla del olvido en que hoy yace; que suele
tambien la desdicha perseguir á los libros notables lo mismo que á
los hombres esclarecidos, como si el ingenio y la fortuna difícilmente
pudieran estrecharse la mano.
Esta produccion se ha hecho tan rara, que sólo tenemos noticia
de dos ejemplares[1], uno que conservaba en su selecta librería el Sr.
D. Vicente Salvá, y otro del cual se sacó la esmerada copia que
existe en la biblioteca del señor Estébanez Calderon, hoy del
Ministerio de Fomento; de modo que el público en general está
privado de conocer las bellezas de este libro, cuya escasez de
ejemplares, no ménos que su mérito literario, nos ha movido á
incluirle en nuestra coleccion. Publicóse sin nombre de autor, como
tambien aconteció con la famosa tragi-comedia de Calixto y Melibéa,
ó la Celestina; pero, ménos afortunado que sus antecesores, cuyos
nombres han llegado á saberse, con gloria para ellos, el autor de
Lisandro y Roselia, á pesar del enigma acróstico con que termina su
obra, permanece todavía ignorado.
[1] Despues de escrita la advertencia que precede al tomo anterior, ha
llegado á nuestra noticia que ademas de los ejemplares allí citados, en la
biblioteca que en la ciudad de Granada posee el Exmo. Sr. Duque de Gor,
muy rica por cierto en obras de nuestra antigua literatura, existe
tambien un ejemplar de los Comentarios de Francisco Verdugo.
F. del V. J. S. R.
¶ Tragicomedia de Lysandro y Roselia llamada Elicia y por otro
nombre quarta obra y tercera Celestina. 1542.
CARTA DEL AUCTOR
EN QUE DIRIGE É INTITULA SU OBRA AL MUY MAGNÍFICO Y ILUSTRE SEÑOR
DON DIEGO DE ACEVEDO Y FONSECA.
COMPARACION.
APLICACION.
¶ De la esclava poesía
Lo superfluo así tirado,
Lo dañoso desechado,
Siguiré su compañía;
A la católica via
Reduciéndola, por modo
Que valga más que su todo
La parte que hago mia.
✠
¶ ARGUMENTO DE LA PRIMERA CENA
DEL PRIMER ACTO.
Lisandro, noble mancebo, pasando por cierta calle, vió á la ventana á Roselia,
doncella de alta guisa, de cuyo amor es vencido; trabaja Oligides, su leal
criado, con muchas razones y exemplos de apartarle de este propósito, y al
cabo, como ve que su trabajo es en balde, promete de darle medios como
pueda llevar á execucion sus deseos.
LISANDRO. — OLIGIDES.