0

I had this question on my OOP Exam, and I had to choose one or multiple answers among the following:

What characterises an Abstract Data Type?

  1. The various operations (accessors and modifiers to the state) that it supports;
  2. The fact that the state of the object is modifiable;
  3. The fact that it has at least one method that modifies the state.

I suppose 1 and 2 are correct answers, but I'm not sure. For this reason I'd like to know from someone if they're actually correct or not.

Community
  • 1
  • 1

1 Answers1

0

The only correct answer is the first.

You might follow an elimination procedure: 2 need not to be true since there are immutable data types as Maurice Perry already pointed out. 3 need not to be true by the same reason, immutable types do not have state mutation methods.

Also, by definition an ADT is strictly defined by the values it may hold, the operations it supports and the properties/invariants of these. Everything else (data-structure holding the data, method implementation) is indeed abstracted away from the definition.

You might check this, this, this and this if you're interested in further reading on the subject.

Happy-Monad
  • 1,962
  • 1
  • 6
  • 13