Exam 10: Introduction to Inheritance
Exam 1: Creating Java Programs61 Questions
Exam 2: Using Data67 Questions
Exam 3: Using Methods Classes and Objects66 Questions
Exam 4: More Object Concepts66 Questions
Exam 5: Making Decisions66 Questions
Exam 6: Looping66 Questions
Exam 7: Characters Strings and the Stringbuilder68 Questions
Exam 8: Arrays66 Questions
Exam 9: Advanced Array Concepts66 Questions
Exam 10: Introduction to Inheritance66 Questions
Exam 11: Advanced Inheritance Concepts66 Questions
Exam 12: Exception Handling66 Questions
Exam 13: File Input and Output66 Questions
Exam 14: Introduction to Swing Components66 Questions
Exam 15: Advanced Gui Topics66 Questions
Exam 16: Graphics66 Questions
Select questions type
____ polymorphism is the ability of one method to work appropriately for subclasses of the same parent class.
(Multiple Choice)
4.8/5
(42)
class Animal
{
void myDog()
{
System.out.println("Animal stuff");
}
}
class Dog extends Animal
{
void mydog()
{
System.out.println("Dog stuff");
}
public static void main(String args[])
{
Dog d = new Dog();
d.myDog();
super.myDog();
}
}
The above code gives a compiler error stating that the non-static variable super cannot be
referenced from a static context super.myDog(); . Explain why the error occurs and describe what changes you could make for the code to be executable.
(Essay)
4.7/5
(37)
Will the above code compile correctly? Why or why not? Explain your answer.


(Essay)
4.8/5
(32)
When you create parent and child classes of your own, the child classes use ____ constructors.
(Multiple Choice)
4.9/5
(43)
You can use the ____ modifier with methods when you don't want the method to be overridden.
(Multiple Choice)
4.9/5
(33)
class Vehicle {}
public class Car extends Vehicle
{
public static void main(String args[])
{
Vehicle myCar = new Car();
boolean result = myCar instanceof Car;
System.out.println(result);
}
}
The above code uses the instanceof operator to determine whether an object is a member of a class. What will be the output following execution?
(Essay)
4.7/5
(40)
An advantage to making a method ____________________ is that the compiler knows there will be only one version of the method.
(Short Answer)
4.8/5
(44)
You would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would achieve this?
(Multiple Choice)
4.8/5
(33)
Sometimes the superclass data fields and methods are not entirely appropriate for the subclass objects; in these cases, you want to ____ the parent class members.
(Multiple Choice)
4.9/5
(42)
Using the keyword ____ provides you with an intermediate level of security between public and private access.
(Multiple Choice)
4.8/5
(38)
Create a class named Student that contains methods getGPA() , setIDNum() , and setGPA() . Be sure to declare variables and methods appropriately as public or private.
(Essay)
4.8/5
(44)
The above code will generate an error message when compiling. Explain the error message and why it occurs.

(Essay)
4.9/5
(36)
You have a Student class with a constructor that requires two arguments: a character "F" for Freshman and an integer "2020" for the year. Create a Freshman class that is a subclass of Student with a constructor for Freshman . Include the initial super() statement and include a comment that reads "//Other statements go here".
(Essay)
4.9/5
(37)
Programmers and analysts sometimes use a graphical language to describe classes and object-oriented processes. This language is called ___________________________________.
(Essay)
4.9/5
(37)
You are never aware that ____ is taking place; the compiler chooses to use this procedure to save the overhead of calling a method.
(Multiple Choice)
4.9/5
(38)
Showing 21 - 40 of 66
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)