1/80
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What are the three defining characteristics of object-oriented programming?
Supports user-defined abstract data types, allows inheritance, and provides polymorphism based on dynamic method binding
What two concerns of procedure-oriented ADTs are addressed by inheritance?
Difficulty of reuse and lack of hierarchy
What is a class?
Object-oriented abstract data type
What is an object?
An instance of a class
What is a derived (child) class or subclass?
A class that inherits from another class
What is a parent (super) class?
The class that is inherited from
What is a method (member function)?
A subprogram that defines operations on objects
What is a message in OOP?
A call to a method
What is a message interface?
The collection of visible methods of an object
What is an API?
A collection of interfaces for multiple classes
What is method overriding?
A child class modifying an inherited method
What is a class variable?
One variable per class
What is an instance variable?
One variable per object
What is a class method?
A method that accepts messages sent to the class
What is an instance method?
A method that accepts messages sent to objects
What is single inheritance?
A class may inherit from only one superclass
What is multiple inheritance?
A class may inherit from more than one superclass
What are the two parts of a message?
Method name and destination object
What aspect of information hiding can complicate inheritance?
Access controls that hide entities from subclasses
What is a disadvantage of inheritance for software reuse?
Interdependence among classes that complicates maintenance
What is a polymorphic variable?
A variable that can refer to objects of its class or any of its subclasses
What distinguishes an abstract method from an ordinary method?
It has no body and is declared but not defined
What is an abstract class?
A class containing at least one abstract method
What is a concrete class?
A class containing only concrete methods
Why can an abstract class not be instantiated?
It provides only a partial implementation of a class
What is the primary disadvantage of Ruby being purely object-oriented?
Slow operations on simple objects
Which language has the more complete typing system, Java or C++?
C++
What does it mean for a subclass to be a subtype?
The subclass can be used wherever its parent type is expected
Where is a protected member visible?
Within the class, its subclasses, and related scopes depending on language
What are the access control levels in C++?
private, public, protected
What are the access control levels in Ruby?
public, protected, private
What are the access control levels in Java?
public, protected, package-private, private
Are subclasses always subtypes in C++?
Yes, with public derivation
Are subclasses always subtypes in Ruby?
No
Are subclasses always subtypes in Java?
Yes
Which provides broader access in Java: protected or package-private?
protected
What is the key difference between a public method in a package-private class and a package-private method in a public class?
Public methods in package-private classes can be accessed indirectly via public subclasses; package-private methods in public classes cannot be accessed outside the package
What is the primary advantage of multiple inheritance?
Writability
What is the primary disadvantage of multiple inheritance?
Cost
How does C++ support multiple inheritance?
Direct multiple inheritance
How does Ruby support multiple inheritance?
Mixins
How does Java support multiple inheritance?
Interfaces
What Ruby construct defines mixin methods?
module
How are Java interfaces treated similarly to Java classes?
Both can be used as variable types, parameter types, and generic type parameters
How are Java interfaces treated differently from Java classes?
A class may implement multiple interfaces but inherit from only one class
What is an advantage of supporting both static and dynamic method binding?
More efficient execution
Does C++ support static binding of method calls?
Yes
Does Ruby support static binding of method calls?
No
Does Java support static binding of method calls?
Yes
What is the default method binding in C++?
Static
What is the default method binding in Ruby?
Dynamic
What is the default method binding in Java?
Dynamic
What is a virtual function in C++?
A method that can be overridden to support polymorphism
What is a pure virtual function in C++?
A virtual function with no definition
What is an abstract class in C++?
A class containing at least one pure virtual function
What happens in Ruby if a method is not found in a class?
The method is searched for in the inheritance chain
Name one Java keyword that forces static binding.
final
Name another Java keyword that forces static binding.
static
Name a third Java keyword that forces static binding.
private
What is a nested class?
A class hidden from some other classes
In Java, where is a nested class visible?
In scopes determined by its access modifier
Does declaring a C++ variable of class type create an object?
Yes
Does declaring a C++ variable of pointer-to-class type create an object?
No
Does every class have a parent class in C++?
No
Does every class have a parent class in Ruby?
Yes
Does every class have a parent class in Java?
Yes
Can a default constructor be called implicitly in C++?
Yes
Can a default constructor be called implicitly in Ruby?
Yes
Can a default constructor be called implicitly in Java?
Yes
How is a parent constructor called explicitly in C++?
By adding the parent constructor call to the class declaration
How is a parent constructor called explicitly in Ruby?
By calling super
How is a parent constructor called explicitly in Java?
By calling super
What is the name of the constructor method in Ruby?
initialize
What two kinds of data are in a C++ Class Instance Record (CIR)?
Instance variables and a pointer to a vtable
What information does a C++ vtable contain?
Pointers to dynamically bound methods
What is the purpose of vtables?
Store method information once per class and share it among all objects
When might a CIR contain multiple vtable pointers?
When a class uses multiple inheritance
Are instance variables stored statically or dynamically in C++?
Dynamic
Are instance variables stored statically or dynamically in Ruby?
Dynamic
Are instance variables stored statically or dynamically in Java?
Static