Q) Do you think \"Data Structure\" and \"Abstract Data Type (ADT)\" are same? Wh
ID: 3627115 • Letter: Q
Question
Q) Do you think "Data Structure" and "Abstract Data Type (ADT)" are same? Why or why not?Elaborate with the help of an example.
Q) You know that Polymorphism is an important feature of OOP. Let’s suppose you a programmer and you are given any particular task to code and that task demands more efficient usage of system resources. For this, you have a choice to implement this particular task by using “Static polymorphism” or Dynamic Polymorphism”.
Give your opinion in three to five concrete points in favor or against of anyone technique of Polymorphism that you will use.
Explanation / Answer
Q1 ) They are not same. Abstract data type is a specification of data types having some defined set of operations and which are independent of their implementation. That is for a particular collection of data only the structure of data and the functions to be performed on the data is defined but the implementation is not defined. but in data structure we have to define the implementation. For Ex: - stack is an Abstract data type.but stack implemented with an array and with linked list are both different data structures. second example - you might have an ADT called list and list can be several different but similar data structures such as list, linked list etc. Q2 ) For better effecient usage of system resources, static polymorphism is better - 1. Collections of built-in types are easily implemented. More generally, the interface commonality need not be expressed through a common base class. 2. Generated code is potentially faster thus saving system resources(because no indirection through pointers is needed a priori and nonvirtual functions can be inlined much more often). 3. Concrete types that provide only partial interfaces can still be used if only that part ends up being exercised by the application. 4. Static polymorphism is often regarded as more type safe than dynamic polymorphism because all the bindings are checked at compile time. For example, there is little danger of inserting an object of the wrong type in a container instantiated from a template. 5. Statically bound methods are bound to their calls at compile time. Dynamic function calls are bound to the functions during run-time. This involves the additional step of searching the functions during run-time. On the other hand, no run-time search is required for statically bound functions. So i hope this much explanation is necessary and would surely help you out. Please rate ... :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.