Professional Documents
Culture Documents
18. Which of the following cannot be overloaded 23. Templates can be distributed to the client
a) Functions through
b) Classes a) header file
c) Keywords b) lib file
d) Operator c) both A and B
d) templates can not be distributed at all
19. For performing late binding the compiler
creates 24. What will be output of the following?
Page 3 b) an array of pointers b) an array of
pointers #include<iostream.h> class name { public:
a) vtable and vpointer name() { cout<<endl<<"in def con\n"; }
b) an array of pointers name(name n) { cout<<endl<<"in copy con\n"; }
c) a late binding function }; void main() { name n1; name n2(n1); }
d) none of the above a) output infinite “in copy con”
b) compile error
20. What will be output of following code? c) output “in def const in copy con”
d) runtime error
#include <iostream.h> class Base { public:
Base() { cout<<"Constructor: Base"<<endl; } 25. Balance Factor of AVL Tree
virtual ~Base() { cout<<"Destructor : a) Height of right sub-tree at that node - height of
Base"<<endl; } }; class Derived: public Base left sub-tree at that node.
{ public: Derived() { cout<<"Constructor: b) Height of left sub-tree at that node - height of
Derived"<<endl; } ~Derived() right sub-tree at that node.
{ cout<<"Destructor : Derived"<<endl; } }; int c) Balance factor of root node
main() { Base *Var = new Derived(); delete Var;
d) Balance Factor of leaf nodes
return 0; }
a) Constructor : Base
26. Consider a binary max-heap implemented d) Byte
using an array. Which one of the following array 32. An AVL tree is:
represents a binary max-heap? (A tree is max- a) Binary search tree with property that each
heap if data at every node in the tree is greater node has
than or equal to its children’s data.) Page 5 d) None of Above d) None of Above
a) 25, 12, 16, 13, 10, 8, 14 equal difference between Left and right sub trees
b) 25,14,13,16, 10,8,12 b) A tree having finite number of nodes
c) 25, 14,16,13,10, 8, 12 c) A tree having single node
d) 25, 14, 12, 13, 10, 8, 16 d) None of Above
27. Difference between Tree and Graph 33. What is the output of the following?
a) A tree is a specialized case of a graph. A tree
is a connected graph with no circuits and no self #include <iostream.h> class test { char x; static
loops. char c; }; void main() { test a; cout <<
b) A graph is a special case of tree. sizeof(a); }
c) A tree is nonlinear data structure, graph is a) 1
linear data structure. b) 2
d) Graph is created using tree as basic elements. c) 4
28. Adjacency matrix is d) Based on Compiler
a) The graph is made up of a set of vertices and a
matrix, whose rows and columns are indexed by 34. What is the signature of the output operator
vertices, and which contains a 1 entry if the for class test?
vertices are connected. a) friend ostream & operator << (test &);
b) The graph is made up of a set of vertices and a b) ostream & operator << (test &);
matrix, whose rows and columns are indexed by c) ostream & operator << (ostream &, test &);
no of edges, and which contains a positive entry d) friend ostream & operator << (ostream &, test
if the &);
vertices are connected.
c) Matrix which represents the weight of the 35. What is the member function called in the
edges statement "test b = a" shown below?
d) Matrix which represents the relation of edges
and vertices in terms of value in integers. void main() { test a(10); test b = a; }
a) Assignment operator
29. Consider the following tree. b) Constructor
c) Copy constructor
If this tree is used for sorting then a new number d) None of the above
8 is placed as the: 36. A variable that is part of a class, yet is not
a) left child of node labelled 30 part of an object of that class, is called a?
b) right child of node labeled 5 a) Static member
c) right child of node labeled 30 b) Friend member
d) left child of node labeled 10 c) Constant member
d) Non-static member
30. Consider the following tree.
If the post order traversal gives ab –cd * + then 37. Which of the following is true about the
the labels of the nodes 1, 2, 3, ….. will be insertion sort algorithm?
a) +, -, *, a, b, c, d a) This is advisable when the Data movement is
b) a, -, b, +, c, *, d more.
c) a, b, c, d, -, *, + b) This is advisable when Data is nearly/almost
sorted.
d) -, a, b, +, *, c, d
c) This is advisable when the data is complex
data-structure.
31. What does “B” in B–Tree mean?
d) Complexity of this algorithms is N log N
a) Better
b) Balanced
38. Which of the following sorting algorithm’s
c) Binary complexity is not always N Log N?
a) Quick Sort
b) Merge Sort
c) Heap Sort
d) None of the above