CMSC FINAL UPDATED ACTUAL Questions and CORRECT Answers
1. Inheritance is the process by which one new class, derived
called the class
2. Derived class is created from another class, called the base
class
3. The derived class is also called: or class subclass, child
4. The base class is also called: superclass or parent class
5. Derived Class should have all the and that Methods and instance
Base Class has. variables
6. Derived Class can define new instance variables and True
new methods
7. Extends Syntax public class derivedClass
extends baseClass { ... }
8. Derived Class Base Class is a
9. When initializing a new Student object, we need to base class
initialize its
10. SubClass objects inherit all the private data True
11. Private members of the base class cannot be accessed True
directly
12. When a class element (instance variable or method) derived
is declared to be protected (rather than public or pri- package
vate) it is accessible:
To any class (and hence to all descendents), and
To any class in the same
, 13. Package: When a class element is not given any access modifier
(private, public, protected) it is said to have pack- package
age access.
It is accessible: To any class in the same
14. When should a person use public? public interface
Methods of the object's Constant
instance variables (static final)
15. When should a person use private? Instance variables
(other than constants) helper/utility methods
Internal (not intended for use except in this
class)
16. Protected/Package: Internal helper/utility
methods (for use in this class and related class-
es)
17. A class at the top of the hierarchy, called . Object
18. The class Object has no i , but defines a number Instance variables
of methods
19. Late (or dynamic) binding: method that is called de- actual type
pends on an object's declared type
, and not the of the referring variable
20. Java's makes it possible for a single reference late binding
variable to refer to objects of many different types polymorphic
21. getClass( ): Returns a of the class of any object representation
22. operator
1. Inheritance is the process by which one new class, derived
called the class
2. Derived class is created from another class, called the base
class
3. The derived class is also called: or class subclass, child
4. The base class is also called: superclass or parent class
5. Derived Class should have all the and that Methods and instance
Base Class has. variables
6. Derived Class can define new instance variables and True
new methods
7. Extends Syntax public class derivedClass
extends baseClass { ... }
8. Derived Class Base Class is a
9. When initializing a new Student object, we need to base class
initialize its
10. SubClass objects inherit all the private data True
11. Private members of the base class cannot be accessed True
directly
12. When a class element (instance variable or method) derived
is declared to be protected (rather than public or pri- package
vate) it is accessible:
To any class (and hence to all descendents), and
To any class in the same
, 13. Package: When a class element is not given any access modifier
(private, public, protected) it is said to have pack- package
age access.
It is accessible: To any class in the same
14. When should a person use public? public interface
Methods of the object's Constant
instance variables (static final)
15. When should a person use private? Instance variables
(other than constants) helper/utility methods
Internal (not intended for use except in this
class)
16. Protected/Package: Internal helper/utility
methods (for use in this class and related class-
es)
17. A class at the top of the hierarchy, called . Object
18. The class Object has no i , but defines a number Instance variables
of methods
19. Late (or dynamic) binding: method that is called de- actual type
pends on an object's declared type
, and not the of the referring variable
20. Java's makes it possible for a single reference late binding
variable to refer to objects of many different types polymorphic
21. getClass( ): Returns a of the class of any object representation
22. operator