CS-301 Final Term Exams Preparation Virtual University With Answers

CS-301 Final Term Exams Preparation Virtual University

Sr. # Questions Answers Choice
1 The definition of transitive property is For all element x member of S, x R x For all elements x and y, x R y if and only if y R x For all elements x, y and z, if x R y and y R z then x R z For all elements w, x, y and z, if x R y and w R z then x R z
2 Which of the following method is helpful in creating the heap at once? insert add update preculateDown
3 If there are 23 external nodes in a binary tree then what will be the no. of internal nodes in this binary tree? 23 24 21 22 (n-1)
4 If there are 56 internal nodes in a binary tree then how many external nodes this binary tree will have? 54 55 56 57
5 Compiler uses which one of the following to evaluate a mathematical equation Binary Tree Binary Search Tree Parse Tree AVL Tree
6 The difference between the binary tree and a binary search tree is that:

a binary search tree has two children per node whereas a binary tree can have none, one, or two children per node in binary search tree nodes are inserted based on the values they contain in binary tree nodes are inserted based on the values they contain none of these
7 Here is a small function definition:
void f(int i, int &k)
{ i
= 1; k = 2;
}
Suppose that a main program has two integer variables x and y, which are given the value 0. Then the main program calls f(x,y); What are the values of x and y after the function f finishes?
Both x and y are still 0. Both x and y are still 0. x is still 0, but y is now 2. x is now 1, and y is now 2.
8 A compound data structure is the data structure which can have multiple data items of same type or of different types,which of the following can be considered compound data structure ? Arrays LinkLists Binary Search Trees All of the given options
9 Suppose currentNode refers to a node in a linked list(using the Node class with member variables called data and next node),What statement changes currentNode so that it refers to the next node? currentNode ++; currentNode = nextNode; currentNode += nextNode; currentNode = currentNode->nextNode;
10 If numbers 5,222,4,48 are inserted in queue,which one will be removed first? 48 4 222 5
Download This Set

Is this page helpful?