1 Parent classes are than their child classes a less specifi

1. Parent classes are than their child classes. a. less specific b. more specific c. easier to understand d. more cryptic 2. Abstract classes differ from other classes in that you . a. must not code any methods within them b. must instantiate objects from them c. cannot instantiate objects from them d. cannot have data fields within them 3. Abstract classes can contain . a. abstract methods b. nonabstract methods c. both of the above d. none of the above 4. An abstract class Product has two subclasses, Perishable and NonPerishable. None of the constructors for these classes requires any arguments. Which of the following statements is legal? e. Product myProduct = new Product(); f. Perishable myProduct = new Product(); g. NonPerishable myProduct = new NonPerishable(); h. none of the above 5. An abstract class Employee has two subclasses, Permanent and Temporary. The Employee class contains an abstract method named setType(). Before you can instantiate Permanent and Temporary objects, which of the following statements must be true? a. You must code statements for the setType() method within the Permanent class. b. You must code statements for the setType() method within both the Permanent and Temporary classes. c. You must not code statements for the setType() method within either the Permanent or Temporary class. d. You can code statements for the setType() method within the Permanent class or the Temporary class, but not both. 6. When you create a superclass and one or more subclasses, each object of the subclass superclass object. a. overrides the b. “is a” c. “is not a” d. is a new 7. Which of the following statements is true? a. Superclass objects are members of their subclass. b. Superclasses can contain abstract methods. c. You can create an abstract class object using the new operator. d. An abstract class cannot contain an abstract method. 8. When you create a in Java, you create a variable name in which you can hold the memory address of an object. a. field b. pointer c. recommendation d. reference 9. An application’s ability to select the correct subclass method to execute is known as method binding. a. polymorphic b. dynamic c. early d. intelligent 10. Which statement creates an array of five references to an abstract class named Currency? a. Currency[] = new Currency[5]; b. Currency[] currencyref = new Currency[5]; c. Currency[5] currencyref = new Currency[5]; d. Currency[5] = new Currency[5]; 11. You override the toString() method in any class you create. a. cannot b. can c. must d. must implement StringListener to 12. The Object class equals() method takes . a. no arguments b. one argument c. two arguments d. as many arguments as you need 13. Assume the following statement appears in a working Java program: if(thing.equals(anotherThing)) x = 1; You know that . a. thing is an object of the Object class b. anotherThing is the same type as thing c. Both of the above are correct. d. None of the above are correct. 14. The Object class equals() method considers two object references to be equal if they have the same . a. value in all data fields b. value in any data field c. data type d. memory address 15. Java subclasses have the ability to inherit from parent class(es). a. one b. two c. multiple d. no 16. The alternative to multiple inheritance in Java is known as a(n) . a. superobject b. abstract class c. interface d. none of the above 17. When you create a class that uses an interface, you include the keyword and the interface’s name in the class header. a. interface b. implements c. accouterments d. listener 18. You can instantiate concrete objects from a(n) . a. abstract class b. interface c. either a or b d. neither a nor b 19. In Java, a class can . a. inherit from one abstract superclass at most b. implement one interface at most c. both a and b d. neither a nor b 20. When you want to provide some data or methods that subclasses can inherit, but you want the subclasses to override some specific methods, you should write a(n) . a. abstract class b. interface c. final superclass d. concrete object

Solution

1. Parent classes are than their child classes. a. less specific

because the child classes will implement the methods their in the parent.The child class extends the features of the parent class

2. Abstract classes differ from other classes in that you .
c. cannot instantiate objects from them
from the concrete classes we can instantiate objects but in Abstract classes we can not because their methods dnt have the implementation

3. Abstract classes can contain
c. both of the above
The Abstract class is class that have atleast one Abstract method

4.. An abstract class Product has two subclasses, Perishable and NonPerishable. None of the constructors for these classes requires any arguments. Which of the following statements is legal?

e. Product myProduct = new Product(); f. Perishable myProduct = new Product(); g. NonPerishable myProduct = new NonPerishable(); h. none of the above

answer is g. NonPerishable myProduct = new NonPerishable();

because we can not create an object for abstract class
g is correct if and only if NonPerishable should implement the all methods in the Product class

1. Parent classes are than their child classes. a. less specific b. more specific c. easier to understand d. more cryptic 2. Abstract classes differ from other
1. Parent classes are than their child classes. a. less specific b. more specific c. easier to understand d. more cryptic 2. Abstract classes differ from other

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site