Theory of Programming Languages Chapter 12

0.0(0)
studied byStudied by 0 people
0.0(0)
call with kaiCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/80

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:29 PM on 12/14/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

81 Terms

1
New cards

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

2
New cards

What two concerns of procedure-oriented ADTs are addressed by inheritance?

Difficulty of reuse and lack of hierarchy

3
New cards

What is a class?

Object-oriented abstract data type

4
New cards

What is an object?

An instance of a class

5
New cards

What is a derived (child) class or subclass?

A class that inherits from another class

6
New cards

What is a parent (super) class?

The class that is inherited from

7
New cards

What is a method (member function)?

A subprogram that defines operations on objects

8
New cards

What is a message in OOP?

A call to a method

9
New cards

What is a message interface?

The collection of visible methods of an object

10
New cards

What is an API?

A collection of interfaces for multiple classes

11
New cards

What is method overriding?

A child class modifying an inherited method

12
New cards

What is a class variable?

One variable per class

13
New cards

What is an instance variable?

One variable per object

14
New cards

What is a class method?

A method that accepts messages sent to the class

15
New cards

What is an instance method?

A method that accepts messages sent to objects

16
New cards

What is single inheritance?

A class may inherit from only one superclass

17
New cards

What is multiple inheritance?

A class may inherit from more than one superclass

18
New cards

What are the two parts of a message?

Method name and destination object

19
New cards

What aspect of information hiding can complicate inheritance?

Access controls that hide entities from subclasses

20
New cards

What is a disadvantage of inheritance for software reuse?

Interdependence among classes that complicates maintenance

21
New cards

What is a polymorphic variable?

A variable that can refer to objects of its class or any of its subclasses

22
New cards

What distinguishes an abstract method from an ordinary method?

It has no body and is declared but not defined

23
New cards

What is an abstract class?

A class containing at least one abstract method

24
New cards

What is a concrete class?

A class containing only concrete methods

25
New cards

Why can an abstract class not be instantiated?

It provides only a partial implementation of a class

26
New cards

What is the primary disadvantage of Ruby being purely object-oriented?

Slow operations on simple objects

27
New cards

Which language has the more complete typing system, Java or C++?

C++

28
New cards

What does it mean for a subclass to be a subtype?

The subclass can be used wherever its parent type is expected

29
New cards

Where is a protected member visible?

Within the class, its subclasses, and related scopes depending on language

30
New cards

What are the access control levels in C++?

private, public, protected

31
New cards

What are the access control levels in Ruby?

public, protected, private

32
New cards

What are the access control levels in Java?

public, protected, package-private, private

33
New cards

Are subclasses always subtypes in C++?

Yes, with public derivation

34
New cards

Are subclasses always subtypes in Ruby?

No

35
New cards

Are subclasses always subtypes in Java?

Yes

36
New cards

Which provides broader access in Java: protected or package-private?

protected

37
New cards

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

38
New cards

What is the primary advantage of multiple inheritance?

Writability

39
New cards

What is the primary disadvantage of multiple inheritance?

Cost

40
New cards

How does C++ support multiple inheritance?

Direct multiple inheritance

41
New cards

How does Ruby support multiple inheritance?

Mixins

42
New cards

How does Java support multiple inheritance?

Interfaces

43
New cards

What Ruby construct defines mixin methods?

module

44
New cards

How are Java interfaces treated similarly to Java classes?

Both can be used as variable types, parameter types, and generic type parameters

45
New cards

How are Java interfaces treated differently from Java classes?

A class may implement multiple interfaces but inherit from only one class

46
New cards

What is an advantage of supporting both static and dynamic method binding?

More efficient execution

47
New cards

Does C++ support static binding of method calls?

Yes

48
New cards

Does Ruby support static binding of method calls?

No

49
New cards

Does Java support static binding of method calls?

Yes

50
New cards

What is the default method binding in C++?

Static

51
New cards

What is the default method binding in Ruby?

Dynamic

52
New cards

What is the default method binding in Java?

Dynamic

53
New cards

What is a virtual function in C++?

A method that can be overridden to support polymorphism

54
New cards

What is a pure virtual function in C++?

A virtual function with no definition

55
New cards

What is an abstract class in C++?

A class containing at least one pure virtual function

56
New cards

What happens in Ruby if a method is not found in a class?

The method is searched for in the inheritance chain

57
New cards

Name one Java keyword that forces static binding.

final

58
New cards

Name another Java keyword that forces static binding.

static

59
New cards

Name a third Java keyword that forces static binding.

private

60
New cards

What is a nested class?

A class hidden from some other classes

61
New cards

In Java, where is a nested class visible?

In scopes determined by its access modifier

62
New cards

Does declaring a C++ variable of class type create an object?

Yes

63
New cards

Does declaring a C++ variable of pointer-to-class type create an object?

No

64
New cards

Does every class have a parent class in C++?

No

65
New cards

Does every class have a parent class in Ruby?

Yes

66
New cards

Does every class have a parent class in Java?

Yes

67
New cards

Can a default constructor be called implicitly in C++?

Yes

68
New cards

Can a default constructor be called implicitly in Ruby?

Yes

69
New cards

Can a default constructor be called implicitly in Java?

Yes

70
New cards

How is a parent constructor called explicitly in C++?

By adding the parent constructor call to the class declaration

71
New cards

How is a parent constructor called explicitly in Ruby?

By calling super

72
New cards

How is a parent constructor called explicitly in Java?

By calling super

73
New cards

What is the name of the constructor method in Ruby?

initialize

74
New cards

What two kinds of data are in a C++ Class Instance Record (CIR)?

Instance variables and a pointer to a vtable

75
New cards

What information does a C++ vtable contain?

Pointers to dynamically bound methods

76
New cards

What is the purpose of vtables?

Store method information once per class and share it among all objects

77
New cards

When might a CIR contain multiple vtable pointers?

When a class uses multiple inheritance

78
New cards

Are instance variables stored statically or dynamically in C++?

Dynamic

79
New cards

Are instance variables stored statically or dynamically in Ruby?

Dynamic

80
New cards

Are instance variables stored statically or dynamically in Java?

Static

81
New cards

Explore top flashcards