Beruflich Dokumente
Kultur Dokumente
ECE - SEMESTER 03
abc*+de*f+g*+
6. Define sentinel nodes, header node and tail node (MAY /JUNE 2016)
The first node in the list is referred to by a reference head node. The last node in
the list is optionally referred to by a reference tail node A sentinel node is a special node
which does not contain an element of the sequence. Sentinel nodes are useful to eliminate
some special cases that would otherwise arise when performing operations at the
beginning and end of the linked list.
7. Draw the expression tree for (a+b*c) + ((d*e+f) *g) (MAY /JUNE 2016)
Prepared By - D. NAVIS
NAYAGAM
#include<iostream.h>
#include<conio.h>
void swap (int &a, int &b)
{
/* &a and &b are reference variables */
int temp;
temp=a;
a=b;
b=temp;
}
main()
{
clrscr();
int i=5,j=10;
cout<<"Before swapping I = "<<i<<" J = "<<j<<endl;
swap(i,j);
cout<<"After swapping I = "<<i<<" J = "<<j<<endl;
}
12. Write a C++ code to display pen object instantiated and pen object destroyed when
class for pen constructor and destructor are called. (NOV/DEC 2014)
class Pen
{
Pen()
{
cout << "pen object instantiated";
}
~Pen()
{
cout << "pen object destroyed";
}
};
int main()
{
Pen obj1;
}
13. Write a simple C++ code to show the usage of this pointer in C++.(NOV/DEC 2014)
#include<iostream>
using namespace std;
/* local variable is same as a member's name */
class Test
Prepared By - D. NAVIS
NAYAGAM
{
private:
int x;
public:
void setX (int x)
{
// The 'this' pointer is used to retrieve the object's x
// hidden by the local variable 'x'
this->x = x;
}
};
int main()
{
Test obj;
int x = 20;
obj.setX(x);
return 0;
}
14. Evaluate the value of expression 53 + 82 - * using stack (NOV/DEC 2014)
Prepared By - D. NAVIS
NAYAGAM
Prepared By - D. NAVIS
NAYAGAM
15. Find the maximum number of nodes in complete binary tree if d is the depth (NOV/DEC
2014)
2d 1
16. Write short notes on connected components (NOV/DEC 2014)
In graph theory, a connected component of an undirected graph is a sub-graph in
which any two vertices are connected to each other by paths, and which is connected to
no additional vertices in the super-graph.
17. Give the representation of a network of cities as weighted graph? (NOV/DEC 2014)
Prepared By - D. NAVIS
NAYAGAM
A friend function of a class is defined outside that class' scope but it has the right
to access all private and protected members of the class. Even though the prototypes for
friend functions appear in the class definition, friends are not member functions.
22. What is overriding? (APRIL/MAY 2015)
If base class and derived class have member functions with same name and
arguments or if you create an object of derived class and write code to access that
member function then, the member function in derived class is only invoked, i.e., the
member function of derived class overrides the member function of base class. This
feature in C++ programming is known as function overriding.
23. Why there is need for operator overloading? (APRIL/MAY 2015)
Operator overloading feature in C++ programming allows programmer to redefine
the meaning of an operator when they operate on class objects (user defined data type).
24. What is ADT? (APRIL/MAY 2015)
An abstract data type (ADT) is a mathematical model for data types, where a data
type is defined by its behavior 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.
25. Write short notes on queue. (APRIL/MAY 2015)
Queue is a linear data structure, in which the first element is inserted from one end called
REAR(also called tail), and the deletion of existing element takes place from the other
end called as FRONT(also called head). This makes queue as FIFO data structure, which
means that element inserted first will also be removed first.
The process to add an element into queue is called Enqueue and the process of removal of
an element from queue is called Dequeue.
26. What is a tree? (APRIL/MAY 2015)
A tree is a non-linear data structure that is used to represents hierarchical
relationships between individual data items.
A tree is a finite set of one or more nodes such that, there is a specially designated
node called root. The remaining nodes are partitioned into n>=0 disjoint sets T1, T2,..Tn,
where each of these set is a tree T1,Tn are called the subtrees of the root.
Prepared By - D. NAVIS
NAYAGAM
Internal sorting
External sorting
Prepared By - D. NAVIS
NAYAGAM