Ec6301 - Object Oriented Programming and Data Structure
Ec6301 - Object Oriented Programming and Data Structure
Ec6301 - Object Oriented Programming and Data Structure
1. What is the output of the following program, if it is correct? Otherwise indicate the
mistake: [May 2006]
int l=10;
Void main ()
{int l=20;
{int l=30;
cout<<l<<::l;
}}
The program is in correct due to syntax error. Within the main function, there is no need of
another opening braces in the int l=20; and also closing braces.
2. Difference between Class and structure? [April -2010, Dec-2012]
Class is the ADT where as structure is udt.
Class needs access specifier such as private, public & private where as structure
members can be accessed by public by default & dont need any accessfiers.
Class is oops where structure is borrowed from traditional structured [pop] concept.
3. What is abstract Class? [Nov-2009]
An abstract class is a class that is designed to be specifically used as a base class. An abstract
class contains at least one pure virtual function. You declare a pure virtual function by using a
pure specifier [= 0] in the declaration of a virtual member function in the class declaration.
4. List out the advantages of new operator over malloc[] [Dec-2012]
It automatically computes the size of the data object.
It automatically returns the correct pointer type
It is possible to initialize the objects while creating_ the memory space.
It can be overloaded.
5. What are the basic concepts of OOS? [ April -2011]
Objects.
Classes.
Data abstraction and Encapsulation.
Inheritance.
Polymorphism.
Dynamic binding.
Message passing
6. What is the difference between local variable and data member? [Nov-2011]
A data member belongs to an object of a class whereas local variable belongs to its
current scope.
A local variable is declared within the body of a function and can be used only from the
point at which it is declared to the immediately following closing brace.
A data member is declared in a class definition, but not in the body of any of the class
member functions.
Data members are accessible to all member function of the class.
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
26. Show the maximum number of nodes in a binary tree of height H is 2H+1 1.
Consider H = 3
No. of nodes in a full binary tree = 2H+1 1
= 23+1 1
= 24 1
= 15 nodes
We know that a full binary tree with height h=3 has maximum 15 nodes.
Hence proved.
27. List out the cases involved in deleting a node from a binary search tree.
Case 1: Node to be deleted is a Leaf node
Case 2: Node to be deleted has one child
Case:3: Node to be deleted has two children.
28. Write the pre-order, in-order, post-order traversal for the tree. (AUC NOV/ DEC
2010)
In order traversal: (A * B) + (C * D) + E
Pre order traversal: + * A B + * C D EPost order traversal: A B * C D * E + +
AMSEC/ECE
AMSEC/ECE
AMSEC/ECE
Binary Search
The array should be arranged in
ascending or descending order.
The algorithm compares the search key
value with the key value of the middle
element of the array.
AMSEC/ECE
External sorting
of a computer
Less number of elements.
Example:
Bubble sort, Insertion sort, etc
PART - B
16 MARK QUESTIONS
UNIT 1
1. Explain in detail about the features of Object Oriented paradigm with diagram.
AMSEC/ECE
AMSEC/ECE
UNIT-5
1. Describe in detail about Heap Sort with example.
2. Explain Insertion sort with example?
3. Write a algorithm for merge sort with example?
4. Describe in detail about shell sort with example?
5. Brifly explain about quick sort with example?
6. Explain Shortest path algorithm with example?
7. Explain Depth first and breadth first traversal?
8. Explain spanning and minimum spanning tree?
9. Explain Kruskals and prims algorithm?
10. Explain topological sorting?
11. Explain Greedy algorithm with an example.
12. Explain about All pair shortest path algorithm.
13. Explain about Divide and Conquer technique in detail with an example.
AMSEC/ECE