Exam 11: Inheritance
Exam 1: Introduction to Computers and Java42 Questions
Exam 2: Java Fundamentals53 Questions
Exam 3: Decision Structures52 Questions
Exam 4: Loops and Files48 Questions
Exam 5: Methods50 Questions
Exam 6: A First Look at Classes49 Questions
Exam 7: A First Look at Gui Applications49 Questions
Exam 8: Arrays and the Arraylist Class52 Questions
Exam 9: A Second Look at Classes and Objects40 Questions
Exam 10: Text Processing and More About Wrapper Classes49 Questions
Exam 11: Inheritance49 Questions
Exam 12: Exceptions and Advanced File Io46 Questions
Exam 13: Advanced Gui Applications46 Questions
Exam 14: Applets and More39 Questions
Exam 15: Recursion34 Questions
Exam 16: Sorting, Searching, and Algorithm Analysis46 Questions
Exam 17: Generics50 Questions
Exam 18: Collections50 Questions
Exam 19: Array-Based Lists20 Questions
Exam 20: Linked Lists36 Questions
Exam 21: Stacks and Queues36 Questions
Exam 22: Binary Trees, Avl Trees, and Priority Queues45 Questions
Select questions type
When declaring class data members,it is best to declare them as
(Multiple Choice)
4.8/5
(30)
In an inheritance relationship,the subclass constructor always executes before the superclass constructor.
(True/False)
4.8/5
(31)
Look at the following code. Line 1 public class ClassA
Line 2 {
Line 3 public ClassA(){}
Line 4 public void method1(){}
Line 5 }
Line 6 public class ClassB extends ClassA
Line 7 {
Line 8 public ClassB(){}
Line 9 public void method1(){}
Line 10 }
Line 11 public class ClassC extends ClassB
Line 12 {
Line 13 public ClassC(){}
Line 14 public void method1(){}
Line 15 }
Which method1 will be executed as a result of the following statements?
ClassA item1 = new ClassC();
Item1.method1();
(Multiple Choice)
4.9/5
(49)
What is wrong with the following code? public class ClassB extends ClassA
{
Public ClassB()
{
Super(40);
System.out.println("This is the last statement " +
"in the constructor.");
}
}
(Multiple Choice)
4.9/5
(32)
Look at the following code.Which line in ClassA has an error: Line 1 public interface MyInterface
Line 2 {
Line 3 int FIELDA = 55;
Line 4 public int methodA(double);
Line 5 }
Line 6 public class ClassA implements MyInterface
Line 7 {
Line 8 FIELDA = 60;
Line 9 public int methodA(double){ }
Line 10 }
(Multiple Choice)
4.8/5
(37)
When one object is a specialized version of another object,there is this type of relationship between them.
(Multiple Choice)
4.7/5
(46)
It is not possible for a superclass to call a subclass's method.
(True/False)
4.9/5
(34)
Which of the following statements declares Salaried as a subclass of PayType?
(Multiple Choice)
4.8/5
(39)
Look at the following code.The method in line _______ will override the method in line _______. Line 1 public class ClassA
Line 2 {
Line 3 public ClassA(){}
Line 4 public int method1(int a){}
Line 5 public double method2(int b){}
Line 6 }
Line 7 public ClassB extends ClassA
Line 8 {
Line 9 public ClassB(){}
Line 10 public int method1(int b,int c){}
Line 11 public double method2(double c){}
Line 12 }
(Multiple Choice)
4.9/5
(37)
Given the following code which of the following is true? public class ClassB implements ClassA{}
(Multiple Choice)
4.8/5
(38)
Look at the following code. Line 1 public class ClassA
Line 2 {
Line 3 public ClassA(){}
Line 4 public void method1(int a){}
Line 5 }
Line 6 public class ClassB extends ClassA
Line 7 {
Line 8 public ClassB(){}
Line 9 public void method1(){}
Line 10 }
Line 11 public class ClassC extends ClassB
Line 12 {
Line 13 public ClassC(){}
Line 14 public void method1(){}
Line 15 }
Which method will be executed when the following statements are executed?
ClassC item1 = new ClassA();
Item1.method1();
(Multiple Choice)
4.8/5
(39)
Look at the following code.What is missing from ClassA? Line 1 public interface MyInterface
Line 2 {
Line 3 int FIELDA = 55;
Line 4 public int methodA(double);
Line 5 }
Line 6 public class ClassA implements MyInterface
Line 7 {
Line 8 FIELDA = 60;
Line 9 public int methodB(double){ }
Line 10 }
(Multiple Choice)
4.8/5
(42)
If a superclass does not have a default constructor or a no-arg constructor,
(Multiple Choice)
4.8/5
(40)
Which of the following statements correctly specifies three interfaces:
(Multiple Choice)
4.9/5
(38)
In the following statement,which is the superclass? public class ClassA extends ClassB implements ClassC
(Multiple Choice)
4.8/5
(44)
Look at the following code.Which line has an error? Line 1 public interface Interface1
Line 2 {
Line 3 int FIELDA = 55;
Line 4 public int methodA(double){}
Line 5 }
(Multiple Choice)
4.8/5
(38)
What is wrong with the following code? public class ClassB extends ClassA
{
Public ClassB()
{
Int init = 10;
Super(40);
}
}
(Multiple Choice)
4.8/5
(34)
Showing 21 - 40 of 49
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)