Exam 10: Inheritance
Exam 1: Introduction to Computers and Java53 Questions
Exam 2: Java Fundamentals52 Questions
Exam 3: Decision Structures58 Questions
Exam 4: Loops and Files56 Questions
Exam 5: Methods56 Questions
Exam 6: A First Look at Classes58 Questions
Exam 7: Arrays and the Arraylist Class63 Questions
Exam 8: A Second Look at Classes and Objects52 Questions
Exam 9: Text Processing and More About Wrapper Classes62 Questions
Exam 10: Inheritance64 Questions
Exam 11: Exceptions and Advanced File Io59 Questions
Exam 12: Java-Fx: Gui Programming and Basic Controls42 Questions
Exam 13: Java-Fx: Advanced Controls40 Questions
Exam 14: Java-Fx: Graphics, Effects, and Media40 Questions
Exam 15: Recursion23 Questions
Exam 16: Databases40 Questions
Select questions type
In the following code, which line will cause a compiler error? Line 1 public class ClassA
Line 2 {
Line 3 public ClassA() {}
Line 4 public int method1(int a){}
Line 5 public final int method2(double b){}
Line 6 }
Line 7 public ClassB extends ClassA
Line 8 {
Line 9 public ClassB(){}
Line 10 public int method1(int b){}
Line 11 public int method2(double c){}
Line 12 }
(Multiple Choice)
4.9/5
(32)
In the following statement, which is the interface? public class ClassA extends ClassB implements ClassC
(Multiple Choice)
4.9/5
(39)
Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.
(True/False)
4.8/5
(40)
Which of the following statements declares Salaried as a subclass of PayType?
(Multiple Choice)
4.9/5
(41)
If a subclass constructor does not explicitly call a superclass constructor, __________.
(Multiple Choice)
4.8/5
(44)
In an inheritance relationship, the subclass constructor always executes before the superclass constructor.
(True/False)
4.8/5
(43)
If you don't provide an access specifier for a class member, the class member is given __________ access by default.
(Multiple Choice)
4.9/5
(28)
Which key word indicates that a class inherits from another class?
(Multiple Choice)
4.8/5
(46)
In Java, a reference variable is __________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.
(Multiple Choice)
4.8/5
(32)
Given 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 method1 will be executed when the following statements are executed?
ClassA item1 = new ClassB();
Item1.method1();
(Multiple Choice)
4.9/5
(40)
A subclass may call an overridden superclass method by __________.
(Multiple Choice)
4.9/5
(35)
You can write a super statement that calls a superclass constructor but only in the subclass's constructor.
(True/False)
4.9/5
(41)
Which of the following is an example of a lambda expression?
(Multiple Choice)
4.9/5
(37)
In 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.7/5
(46)
If two methods have the same name but different signatures they are __________.
(Multiple Choice)
4.9/5
(48)
Which of the following statements correctly specifies two interfaces?
(Multiple Choice)
4.7/5
(35)
Given 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.9/5
(33)
Replacing inadequate superclass methods with more suitable subclass methods is known as __________.
(Multiple Choice)
4.8/5
(40)
A(n) __________ method is a method that appears in a superclass but expects to be overridden in a subclass.
(Multiple Choice)
4.8/5
(43)
Showing 21 - 40 of 64
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)