19,937 views
43 votes
43 votes

An Abstract Data Type (ADT) is:

  1. same as an abstract class
  2. a data type that cannot be instantiated
  3. a data type for which only the operations defined on it can be used, but none else
  4. all of the above

8 Answers

Best answer
63 votes
63 votes

An abstract data type (ADT) supports only the operations which are defined.

Abstract class is one that may not have definitions of all the objects it have. Moreover it can not be instantiated. To instantiate we have to create a subclass then instantiate the class.

Abstract Data Type is  like data structure  eg. $STACK$ where we have $PUSH()$ $POP()$ operation defined .

Hence, they are not the same thing.

http://www.devx.com/tips/Tip/5681

Correct Answer: $C$

edited by
11 votes
11 votes

ADT of any data structure is "what operation stacks you can perform on this data structure."

for ex:

ADT of stack:

(1) push()

(2) pop()

ADT of queue:

(1) enqueue

(2) dequeue

3 votes
3 votes
Correct answer will be C) A data type for which only the operation defined on it can be used but none else.

Stack is Abstract Data Type, We can not perform any other operation on stack other that push() and pop() operation.
3 votes
3 votes

See link: https://www.devx.com/tips/Tip/5681 

An abstract class is a class that has at least one pure virtual member function. It is not a data type (normally, abstract classes do not contain any data members), nor can you instantiate an object thereof. An abstract class is merely a skeletal interface, which specifies a set of services that its subclasses implement.

This clears why option a) is incorrect.

 An abstract data type (also called a concrete type) is a self-contained, user-defined type that bundles data with a set of related operations. It behaves in the same way as a built-in type does. However, it does not inherit from other classes, nor does it serve as the base for other derived classes. Some examples of abstract data types or concrete types include std::string, std::complex, and std::vector.

 We can instantiate abstract data type or concrete type as all operations are defined on it. For example, in C++ you can instantiate the abstract data type string by:

std::string mystring = “Hello World”;


So option B) is false. 

Also see: https://wikipedia.org/wiki/Abstract_data_type

In computer science, an abstract data type (ADT) is a mathematical model for data types. An abstract data type is defined by its behavior (semantics) from the point of view of a user, of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations.

So option c) is correct.

edited by
Answer:

Related questions

23.5k
views
8 answers
23 votes
Kathleen asked Sep 22, 2014
23,478 views
In a complete $k$-ary tree, every internal node has exactly $k$ children. The number of leaves in such a tree with $n$ internal node is:$nk$(n-1)k + 1$n(k-1) +1$n(k-1)$
25.2k
views
4 answers
31 votes
Kathleen asked Sep 22, 2014
25,197 views
How many distinct binary search trees can be created out of $4$ distinct keys?$5$14$24$42$
14.3k
views
1 answers
21 votes
Kathleen asked Sep 22, 2014
14,258 views
A priority queue is implemented as a Max-Heap. Initially, it has $5$ elements. The level-order traversal of the heap is: $10, 8, 5, 3, 2$. Two new elements $1$ and $7$ are inserted into ... $10, 8, 7, 3, 2, 1, 5$
11.6k
views
3 answers
22 votes
Kathleen asked Sep 22, 2014
11,634 views
Postorder traversal of a given binary search tree, $T$ produces the following sequence of keys$10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29$Which one of the following sequences of ... 50, 95$95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29$