0% found this document useful (0 votes)
225 views40 pages

CS301 Quiz-4 by Vu Topper RM

Uploaded by

sheryar shery
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
225 views40 pages

CS301 Quiz-4 by Vu Topper RM

Uploaded by

sheryar shery
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

CS301 Data Structures

Update MCQS For Quiz-4 File


Solve By Vu Topper RM
85% To 100% Marks

For More Help Contact What’s app 03224021365


A pair of sets which does not have any ________ element are called
disjoint sets
Common

Which of the following is NOT true regarding the maze generation?


Remove a randomly chosen wall if the cells it separates are already
in the same set. Page 424

A table consists of several columns, known as


Fields

If whole data is given to construct the min heap, then which of the
following is true?
A. Insert method is appropriate for construction
B. Both Insert and BuildHeap method are equally appropriate
C. BuildHeap method is appropriate for construction
D. Both Insert and Buildheap methods are inappropriate.

The scenario “If Ali is brother of Asif and Asif is brother of Uzma then
Ali is brother of Uzma” is the example of ___________ property.
Transitive

What is the time complexity of binary search with iteration?


O(logn)

Which of the following heap method lowers the value of key at position
‘p’ by the amount ‘delta’?
increaseKey(p,delta)

Suppose there are a set of fruits and a set of vegetables. Both sets are
______________ sets.
Disjoint

For More Help Contact What’s app 03224021365


The expressionif ( ! heap->isFull() )check
Heap is not full

In min heap, if there are 100 elements in a heap and we perform 100
deleteMin operations then we will get the elements in _________.
Ascending order

If we want to find median of 50 elements, then after applying buildHeap


method, how many times deleteMin method will be called ?
25

There are 100 elements in a heap, if we perform 100 deleteMin


operations then we will get ___________ list
Sorted

Which of the following is NOT an implementation of Table ADT?


Skip List

For a perfect binary tree of height 4. What will be the sum of heights of
nodes?
31

If a tree has 20 edges/links, then the total number of nodes in the tree
will be :
19

Which of the following properties are satisfied by Equivalence


relationship?
Reflexive , Symmetric and Transitive

Suppose there are 100 elements in an equivalence class, so initially there


will be 100 trees. The collection of these trees is called
________________.

For More Help Contact What’s app 03224021365


Forest

For a perfect binary tree of height h, having N nodes, the sum of heights
of nodes is _____________.
N-(H+1)

Heap can be used to implement


Priority Queue

Which of the following statement is NOT correct regarding Table ADT?


A table consists of several columns, known as entities.

In perfect binary tree ______________ .


A. Internal nodes has only right child
B. Internal nodes has only left child
C. Internal nodes has exactly two child nodes
D. Leaf nodes are situated at different levels

Median is __________.
A. K = N * 3
B. K = N / 3
C. K = N * 2
D. K = N /2

Which of the following possible operations are performed on Table


ADT?
A. Only Find and Remove
B. Insert, Find, Remove
C. Only Insert and Remove
D. Only Insert and Find

A perfect binary tree is constructed using 131071 nodes then what will
be the maximum height of that binary tree?
A. 14

For More Help Contact What’s app 03224021365


B. 15
C. 16
D. 17

If the bottom level of a binary tree is not completely filled, depicts that
the tree is not a _______.
A. Expression tree
B. Threaded binary tree
C. Complete Binary tree Page 323
D. Perfectly complete Binary tree

There are four cases of rotation in an __________ tree.


A. AVL
B. Tree
C. Binary
D. Heap

Which type of rotation can balance the following AVL tree?


A. Single left
B. Single right
C. Double right-left
D. Double left-right Google

Finding the minimum is easy; it is _____ of the min heap.


A. Top Page 351
B. Left most child.
C. Right most child
D. None of the given options.

When a complete binary tree, represented by an array then for any array
element at position i, the parent is at position ______ .
A. 2i
B. 2i-1

For More Help Contact What’s app 03224021365


C. (2i+1)
D. Floor(i/2)

If there are 56 internal nodes in a binary tree then how many external
nodes this binary tree will have?
A. 55
B. 56
C. 57 Page 303
D. 58

In an expression tree, a unary operator will have only ________ subtree.


A. One Google
B. Two
C. Three
D. None

Consider a min heap, represented by the following array:


3,4,6,7,5,10
After inserting a node with value 1. Which of the following is the
updated min heap?
A. 3,4,6,7,5,1,10
B. 1,4,3,7,5,10,6 Google
C. 1,4,6,7,5,10,3
D. 3,4,6,7,5,10,1

For the inorder traversal of threaded binary tree, we introduced a dummy


node. The left pointer of the dummy node is pointing to the ________
node of the tree.
A. Root
B. Left must
C. Right must
D. any of the given node

For More Help Contact What’s app 03224021365


If both pointers of the node in a binary tree are NULL then it will be a/an
A. Leaf node
B. Root node
C. Inner node
D. None of the given options

In complete binary tree the bottom level is filled from ________


A. Left to right
B. Right to left
C. Not filled at all
D. None of the given options

Consider a max heap, represented by the following array:


40,30,20,10,15,16,17,8,4
After inserting a node with value 35.
Which of the following is the updated max heap?
A. 40,30,20,10,15,16,17,8,4,35
B. 40,35,20,10,30,16,17,8,4,15
C. 40,30,20,10,35,16,17,8,4,15
D. 40,35,20,10,15,16,17,18,4,30

A complete binary tree of height 3 has between ________ nodes.


A. 8 to 17
B. 8 to 14
C. 8 to 15
D. 8 to 17

To develop a character encoding scheme in Huffman tree, _______ will


be assigned to left branch.
A. 1
B. 2
C. 3 Page 301
D. 4

For More Help Contact What’s app 03224021365


If there are 23 external nodes in a binary tree then what will be the no. of
internal nodes in this binary tree?
A. 20
B. 21
C. 22
D. 23

Which of the following is a correct statement?


A. An AVL tree is not identical to a BST, its altogether kind of tree.
B. An AVL tree is identical to a BST except height of the left and
right subtrees can differ by at least 1.
C. An AVL tree is identical to a BST except height of the left and
right subtrees can differ by at most 1. Page 220
D. An AVL tree is identical to a BST except height of the left and
right subtrees must differ by at least 1.

Which of the following statement is true about dummy node of threaded


binary tree?
A. The right pointer of dummy node points to the itself while the left
pointer is always NULL.
B. The left pointer of dummy node points to the root node of the tree
while the right pointer is always NULL.
C. The left pointer of dummy node points to the itself while the right
pointer points to the root of tree.
D. The left pointer of dummy node points to the root node of the
tree while the right pointer points itself i.e. to dummy node

Which one of the following is TRUE about iteration?


A. Iteration extensively uses stack memory
B. Recursion is more efficient than iteration
C. Iterative function calls consumes a lot of memory
D. Threaded Binary Trees use the concept of iteration

For More Help Contact What’s app 03224021365


Traversing a binary tree can only be done using _________
A. Recursion
B. Iteration
C. None of the given options
D. Both Iteration and Recursion
In the SingleRightRotation function, the height routine will return
________ if the argument passed to it is NULL.
A. 0
B. -1 Page 259
C. 1
D. Invalid

The worst case of building a heap of N keys is _______ .


A. N
B. N-1
C. N2
D. NlogN

By using __________we avoid the recursive method of traversing a


Tree, which makes use of stacks and consumes a lot of memory and
time.
A. Binary tree only
B. Huffman encoding
C. Heap data structure
D. Threaded binary tree Page 306

We implement the heap by ______________ .


A. AVL tree
B. Threaded Tree
C. Expression tree
D. Complete binary tree Page 336

In threaded binary tree, the NULL pointers are replaced by the

For More Help Contact What’s app 03224021365


A. NULL pointers are not replaced.
B. preorder successor or predecessor
C. inorder successor or predecessor
D. postorder successor or predecessor

Which one of the following is best for traversals,


A. Heap
B. AVL tree
C. Binary Search Tree
D. Threaded Binary Tree

If min heap is implemented through array, then the first element of heap
will be will be stored ________.
A. 0
B. 1
C. 2
D. 3

In which of the following tree, parent node has key greater than or equal
to its both children?
A. Max heap
B. Binary search tree
C. Threaded Binary tree
D. Complete Binary tree

If the bottom level of a binary tree is NOT completely filled, depicts that
the tree is NOT a ----------
A. Expression tree
B. Threaded binary tree
C. Complete Binary tree Page 323
D. Perfectly complete Binary tree

For More Help Contact What’s app 03224021365


An expression tree will always be a/an,
A. Heap
B. AVL tree
C. Strictly binary tree
D. Binary search tree

To search an element in ALV tree, it takes maximum 1.88 Log2n time.


A. False
B. True
C. In some cases
D. Searching cannot be performed in AVL tree

See the below code and fill the appropriate answer for ? sign.
void fastInorder(TreeNode* p)
{
while((p=nexInorder(p)) != ? )
cout << p->getInfo();}
A. RTH
B. LTH
C. Dummy
D. RootNode

A Threaded Binary Tree is a binary tree in which every node that does
not have a right child has a THREAD (in actual sense, a link) to its
__________ successor.
A. Inorder
B. Preorder
C. Postorder
D. Levelorder

While building Huffman encoding tree the parent node is _________ of


left and right child nodes.
A. Addition

For More Help Contact What’s app 03224021365


B. Division
C. Subtraction
D. Multiplication

Which of the following statement is correct?


A. A Threaded Binary Tree is a binary tree in which every node that
does not have a left child has a THREAD (in actual sense, a link)
to its INORDER successor.
B. A Threaded Binary Tree is a binary tree in which every node that
does not have a right child has a THREAD (in actual sense, a link)
to its PREOREDR successor.
C. A Threaded Binary Tree is a binary tree in which every node
that does not have a right child has a THREAD (in actual
sense, a link) to its INORDER successor.
D. A Threaded Binary Tree is a binary tree in which every node that
does not have a right child has a THREAD (in actual sense, a link)
to its POSTORDER successor.

In a threaded binary tree which nodes have NULL child pointers,


A. Root Node
B. All leaf nodes
C. None of the nodes
D. Nodes other then leaf nodes

Consider a binary tree, represented by the following array:


10,7,9,5,2,1,6,3,4
This is a ________.
A. Min heap
B. Max heap
C. Binary Search tree
D. Threaded binary tree

For More Help Contact What’s app 03224021365


If there are N internal nodes in a binary tree then what will be the no. of
external nodes in this binary tree?
A. N
B. N-1
C. N+1 Page 303
D. N+2

Which of the following statement is true about dummy node of threaded


binary tree?
A. This dummy node never has a value
B. This dummy node has always some integer value.
C. This dummy node has always some dummy value
D. This dummy node has either no value or some dummy value.

If there are N external nodes in a binary tree then what will be the no. of
internal nodes in this binary tree?
A. N
B. N-1
C. N+1
D. N+2

In AVL tree during insertion, a single rotation can fix the balance in
cases _________ and 4.
A. 1 Page 239
B. 2
C. 3
D. 4

In Huffman tree, the process of combining the two nodes of lowest


frequency will be carried out until ________ node/nodes left.
A. One Page 293

For More Help Contact What’s app 03224021365


B. Two
C. Six
D. None

We are given N items to build a heap of items , this can be done with
_____ successive inserts.
A. N
B. N-1
C. N+1
D. N*2

There are ___________ cases of deletion of a node from an AVL tree.


A. One
B. Two
C. Five Page 278
D. Three

While building Huffman encoding tree the new node that is the result of
joining two nodes has the frequency.
A. Equal to the small frequency
B. Equal to the greater frequency
C. Equal to the sum of the two frequencies
D. Equal to the difference of the two frequencies

When a complete binary tree represented by an array then if right child


is at position 5 then left child will be at position _____
A. 2
B. 4
C. 6
D. 8

If there are __________ nodes in an AVL tree, its levels will be roughly
as Log2(10 million).

For More Help Contact What’s app 03224021365


A. 2 million
B. 5 million
C. 10 million Page 249
D. 100 million

We can build a heap in _____ time.


A. Linear Page 353
B. Exponential
C. Polynomial
D. None of the given options

What is a skip list?


a linked-list with size value in nodes
a tree which is in the form of linked list
a linked-list that allows faster search within an ordered sequence
a linked-list that allows slower search within an ordered sequence

The total number of nodes on 10th level of a perfect binary tree are :
256
512
1024
Can't be determined

The total number of nodes on 5th level of a perfect binary tree are :
15
16
31
32

If we want to find 3rd minimum element from an array of elements, then


after applying buildHeap method, how many times deleteMin method
will be called ?
1
2

For More Help Contact What’s app 03224021365


3
4

The percolateDown procedure will move the smaller value____ and


bigger value______.
Up,down

Suppose there is an image segmented into pixels. Each pixel has


_________ neighbour(s).
4

Which of the following method is helpful in creating the heap at once?


percolateDown

If the height of a perfect binary tree is 4. What will be the total number
of nodes in it?
15

The main reason of using heap in priority queue is


improve performance

Given the values are the array representation of heap;


12.23.26.31.34.44.56.64.78.100
If we perform 4 deleteMin operations, the last element deleted
is__________.
34

The array in binary search is sub divided ______________.


Until a sublist is no more divisible

If a tree has 50 nodes, then the total edges/links in the tree will be :
49

For More Help Contact What’s app 03224021365


11) Question No: 1 ( Marks: 1 ) - Please choose one

__________ only removes items in reverse order as they were entered.

► Stack

► Queue

► Both of these

► None of these

Question No: 2 ( Marks: 1 ) - Please choose one

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.

► x is now 1, but y is still 0.

► x is still 0, but y is now 2.

► x is now 1, and y is now 2.

Question No: 3 ( Marks: 1 ) - Please choose one

Select the one FALSE statement about binary trees:

► Every binary tree has at least one node.

► Every non-empty tree has exactly one root node.

► Every node has at most two children.

► Every non-root node has exactly one parent.

For More Help Contact What’s app 03224021365


Question No: 4 ( Marks: 1 ) - Please choose one

Every AVL is _________________

► Binary Tree

► Complete Binary Tree

► None of these

► Binary Search Tree

Question No: 5 ( Marks: 1 ) - Please choose one

Searching an element in an AVL tree take maximum _______ time (where n is no. of nodes in AVL tree),

► Log2(n+1)

► Log2(n+1) -1

► 1.44 Log2n

► 1.66 Log2n

Question No: 6 ( Marks: 1 ) - Please choose one

Suppose that we have implemented a priority queue by storing the items in a heap. We are now executing
a reheapification downward and the out-of-place node has priority of 42. The node’s parent has a priority
of 72, the left child has priority 52 and the node’s right child has priority 62. Which statement best describes
the status of the reheapification.

► The reheapification is done.

► The next step will interchange the two children of the out-of-place node.

► The next step will swap the out-of-place node with its parent.

► The next step will swap the out-of-place node with its left child.

Question No: 7 ( Marks: 1 ) - Please choose one

For More Help Contact What’s app 03224021365


Suppose you implement a heap (with the largest element on top) in an array. Consider the different
arrays below, determine the one that cannot possibly be a heap:

►7654321

►7362145

►7643521

►7364251

Question No: 10 ( Marks: 1 ) - Please choose one

Which one of the following is NOT the property of equivalence relation:

► Reflexive

► Symmetric

► Transitive

► Associative ok

Question No: 11 ( Marks: 1 ) - Please choose one

The definition of Transitivity 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

Question No: 12 ( Marks: 1 ) - Please choose one

Union is a _______ time operation.

► Constant

► Polynomial

► Exponential

► None of the given options

Question No: 13 ( Marks: 1 ) - Please choose one

For More Help Contact What’s app 03224021365


Which of the following is NOT a correct statement about Table ADT.

► In a table, the type of information in columns may be different.

► A table consists of several columns, known as entities.

► The row of a table is called a record.

► A major use of table is in databases where we build and use tables for keeping information.

Question No: 14 ( Marks: 1 ) - Please choose one

In the worst case of deletion in AVL tree requires _________.

► Only one rotation

► Rotation at each non-leaf node

► Rotation at each leaf node

► Rotations equal to log2 N

Question No: 15 ( Marks: 1 ) - Please choose one

Binary Search is an algorithm of searching, used with the ______ data.

► Sorted

► Unsorted

► Heterogeneous

► Random

Question No: 18 ( Marks: 1 ) - Please choose one

Which of the following statement is NOT true about threaded binary tree?

► Right thread of the right-most node points to the dummy node.

► Left thread of the left-most node points to the dummy node.

For More Help Contact What’s app 03224021365


► The left pointer of dummy node points to the root node of the tree.

► Left thread of the right-most node points to the dummy node.

Question No: 19 ( Marks: 1 ) - Please choose one

Consider a min heap, represented by the following array:


11,22,33,44,55
After inserting a node with value 66.Which of the following is the updated min heap?

► 11,22,33,44,55,66

► 11,22,33,44,66,55

► 11,22,33,66,44,55

► 11,22,66,33,44,55

Question No: 20 ( Marks: 1 ) - Please choose one

Consider a min heap, represented by the following array:


3,4,6,7,5
After calling the function deleteMin().Which of the following is the updated min heap?

► 4,6,7,5

► 6,7,5,4

► 4,5,6,7

► 4,6,5,7

Question No: 22 ( Marks: 1 ) - Please choose one

Suppose we are sorting an array of eight integers using quick sort, and we have just finished the first
partitioning with the array looking like this:

2 5 1 7 9 12 11 10
Which statement is correct?

► The pivot could be either the 7 or the 9.

For More Help Contact What’s app 03224021365


► The pivot could be the 7, but it is not the 9.

► The pivot is not the 7, but it could be the 9.

► Neither the 7 nor the 9 is the pivot.

Question No: 23 ( Marks: 1 ) - Please choose one

Which formula is the best approximation for the depth of a heap with n nodes?

► log (base 2) of n

► The number of digits in n (base 10), e.g., 145 has three digits

► The square root of n

►n

Question No: 24 ( Marks: 1 ) - Please choose one

Suppose you implement a Min heap (with the smallest element on top) in an array. Consider the different
arrays below; determine the one that cannot possibly be a heap:

► 16, 18, 20, 22, 24, 28, 30

► 16, 20, 18, 24, 22, 30, 28

► 16, 24, 18, 28, 30, 20, 22

► 16, 24, 20, 30, 28, 18, 22

Question No: 25 ( Marks: 1 ) - Please choose one

While joining nodes in the building of Huffman encoding tree if there are more nodes with same
frequency, we choose the nodes _______.

► Randomly

► That occur first in the text message

For More Help Contact What’s app 03224021365


► That are lexically smaller among others.

► That are lexically greater among others

Question No: 26 ( Marks: 1 ) - Please choose one

Consider the following paragraph with blanks.


A …….…….. is a linear list where …………… and ………… take place at the
same end . This end is called the …….……….

What would be the correct filling the above blank positions?

► (i) queue (ii) insertion (iii) removals (iv) top

► (i) stack (ii) insertion (iii) removals (iv) bottom

► (i) stack (ii) insertion (iii) removals (iv) top

► (i) tree (ii) insertion (iii) removals (iv) top

Question No: 27 ( Marks: 1 ) - Please choose one

A binary tree with 33 internal nodes has _______ links to internal nodes.

► 31

► 32

► 33

► 66

Question No: 28 ( Marks: 1 ) - Please choose one

Which traversal gives a decreasing order of elements in a heap where the max element is stored at the
top?

► post-order

For More Help Contact What’s app 03224021365


► level-order

► inorder

► None of the given options

Question No: 29 ( Marks: 1 ) - Please choose one

What requirement is placed on an array, so that binary search may be used to locate an entry?

► The array elements must form a heap.

► The array must have at least 2 entries.

► The array must be sorted.

► The array’s size must be a power of two.

Question No: 30 ( Marks: 1 ) - Please choose one

Which of the following is a non linear data structure?

► Linked List

► Stack

► Queue

► Tree

Question No: 1 ( Marks: 1 ) - Please choose one


The
data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should

► Use better data structures


► Increase the hard disk space
► Use the better algorithm

► Use as much data as we can store on the hard disk

Question No: 2 ( Marks: 1 ) - Please choose one


In
an array list the current element is

For More Help Contact What’s app 03224021365


► The first element
► The middle element
► The last element
► The element where the current pointer points to

Question No: 3 ( Marks: 1 ) - Please choose one


Whic
h one of the following is a valid postfix expression?

► ab+c*d-
► abc*+d-
► abc+*d-
► (abc*)+d-

Question No: 4 ( Marks: 1 ) - Please choose one


In
sequential access data structure, accessing any element in the data structure takes different amount of
time. Tell which one of the following is sequential access data structure, Linked list

► Arrays

► Lists

► Both of these

► None of these

Question No: 5 ( Marks: 1 ) - Please choose one


I
have implemented the queue with a circular array. If data is a circular array of CAPACITY elements, and
last is an index into that array, what is the formula for the index after last?
► (last % 1) + CAPACITY
► last % (1 + CAPACITY)
► (last + 1) % CAPACITY
► last + (1 % CAPACITY)

Question No: 7 ( Marks: 1 ) - Please choose one


Com
piler uses which one of the following to evaluate a mathematical equation,

► Binary Tree

► Binary Search Tree

► Parse Tree

► AVL Tree

Question No: 9 ( Marks: 1 ) - Please choose one


If a
max heap is

For More Help Contact What’s app 03224021365


implemented using a partially filled array called data, and the array contains n elements (n > 0), where is
the entry with the greatest value? Data[0]

► data[1]
► data[n-1]
► data[n]
► data[2*n+1]

Question No: 11 ( Marks: 1 ) - Please choose one


Whic
h of the following heap method increase the value of key at position ‘p’ by the amount ‘delta’?

► increaseKey(p,delta)
► decreaseKey(p,delta)
► preculateDown(p,delta)
► remove(p,delta)

Question No: 12 ( Marks: 1 ) - Please choose one


If we
have 1000 sets each containing a single different person. Which of the following relation will be true on
each set:
► Reflexive
► Symmetric
► Transitive
► Associative

Question No: 13 ( Marks: 1 ) - Please choose one


Whic
h one of the following is not an example of equivalence relation:

► Electrical connectivity
► Set of people
► <= relation
► Set of pixels

Question No: 14 ( Marks: 1 ) - Please choose one


A
binary tree of N nodes has _______.

► Log10 N levels
► Log2 N levels
► N / 2 levels
► N x 2 levels

Question No: 15 ( Marks: 1 ) - Please choose one


Binar
y Search is an algorithm of searching, used with the ______ data.
► Sorted
► Unsorted
► Heterogeneous
► Random

For More Help Contact What’s app 03224021365


Question No: 16 ( Marks: 1 ) - Please choose one
Cons
ider te following array
23 15 5 12 40 10 7
After the first pass of a particular algorithm, the array looks like
1. 5 12 23 10 7 40
Name the algorithm used

► Heap sort
► Selection sort
► Insertion sort
► Bubble sort

Question No: 17 ( Marks: 1 ) - Please choose one


Whic
h of the following statements is correct property of binary trees?
► A binary tree with N internal nodes has N+1 internal links.
► A binary tree with N external nodes has 2N internal nodes.
► A binary tree with N internal nodes has N+1 external nodes.
► None of above statement is a property of the binary tree.

Question No: 18 ( Marks: 1 ) - Please choose one


Whic
h of the following is a property of binary tree?
► A binary tree of N external nodes has N internal node.
► A binary tree of N internal nodes has N+ 1 external node.
► A binary tree of N external nodes has N+ 1 internal node.
► A binary tree of N internal nodes has N- 1 external node.

Question No: 21 ( Marks: 1 ) - Please choose one


In a
selection sort of n elements, how many times the swap function is called to complete the execution of the
algorithm?

► n-1
► n log n
► n2
►1

Question No: 22 ( Marks: 1 ) - Please choose one


Whic
h of the following statement is correct about find(x) operation:

► A find(x) on element x is performed by returning exactly the same node that is found.
► A find(x) on element x is performed by returning the root of the tree containing x.
► A find(x) on element x is performed by returning the whole tree itself containing x.
► A find(x) on element x is performed by returning TRUE.

Question No: 23 ( Marks: 1 ) - Please choose one


Whic
h of the following statement is NOT correct about find operation:

► It is not a requirement that a find operation returns any specific name, just that finds on two
elements return the same answer if and only if they are in the same set.

For More Help Contact What’s app 03224021365


► One idea might be to use a tree to represent each set, since each element in a tree has the same
root, thus the root can be used to name the set.

► Initially each set contains one element.


► Initially each set contains one element and it does not make sense to make a tree of one
node only.

Question No: 24 ( Marks: 1 ) - Please choose one


Cons
ider the following postfix expression S and the initial values of the variables.

S=AB-C+DEF-+^
Assume that A=3, B=2, C=1, D=1, E=2, F=3

What would be the final output of the stack?

►1
►2
►0
► -1

Question No: 25 ( Marks: 1 ) - Please choose one


The
maximum number of external nodes (leaves) for a binary tree of height H is _________
► 2H
► 2H +1
► 2H -1
► 2H +2

Question No: 26 ( Marks: 1 ) - Please choose one


In
threaded binary tree the NULL pointers are replaced by ,

► preorder successor or predecessor


► inorder successor or predecessor
► postorder successor or predecessor
► NULL pointers are not replaced

Question No: 27 ( Marks: 1 ) - Please choose one


In a
min heap , preculateDown procedure will move smaller value______ and bigger value______.
► left,right
► right,left
► up,down
► down,up

Question No: 28 ( Marks: 1 ) - Please choose one


Whic
h of the following statement is correct about union:
► To perform Union of two sets, we merge the two trees by making the root of one tree point
to the root of the other.
► To perform Union of two sets, we merge the two trees by making the leaf node of one tree point to
the root of the other.
► To perform Union of two sets, merging operation of trees in not required at all.

For More Help Contact What’s app 03224021365


► None of the given options.

Question No: 29 ( Marks: 1 ) - Please choose one


Supp
ose A is an array containing numbers in increasing order, but some numbers occur more than once when
using a binary search for a value, the binary search always finds ____________

► the first occurrence of a value.


► the second occurrence of a value.
► may find first or second occurrence of a value.
► None of the given options.

Question No: 30 ( Marks: 1 ) - Please choose one


Let
heap stored in an array as H = [50, 40, 37, 32, 28, 22, 36, 13]. In other words, the root of the heap
contains the maximum element. What is the result of deleting 40 from this heap
► [50,32, 37,13, 28, 22, 36]
► [37, 28, 32, 22, 36, 13]
► [37, 36, 32, 28, 13, 22]
► [37, 32, 36, 13, 28, 22]

Question No: 1 ( Marks: 1 ) - Please choose one


In an
array we can store data elements of different types.

► True
► False

Question No: 2 ( Marks: 1 ) - Please choose one


Whic
h one of the following statement is NOT correct .

► In linked list the elements are necessarily to be contiguous


► In linked list the elements may locate at far positions in the memory
► In linked list each element also has the address of the element next to it
► In an array the elements are contiguous

Question No: 3 ( Marks: 1 ) - Please choose one


Dou
bly Linked List always has one NULL pointer.

► True
► False

Question No: 4 ( Marks: 1 ) - Please choose one


A
queue is a data structure where elements are,

► inserted at the front and removed from the back.


► inserted and removed from the top.
► inserted at the back and removed from the front.
► inserted and removed from both ends.

Question No: 5 ( Marks: 1 ) - Please choose one

For More Help Contact What’s app 03224021365


Each
node in doubly link list has,

► 1 pointer

► 2 pointers

► 3 pointers

► 4 pointers

Question No: 6 ( Marks: 1 ) - Please choose one


I
have implemented the queue with a linked list, keeping track of a front pointer and a rear pointer. Which
of these pointers will change during an insertion into an EMPTY queue?

► Neither changes

► Only front pointer changes.

► Only rear pointer changes.

► Both change.

Question No: 7 ( Marks: 1 ) - Please choose one


Com
piler uses which one of the following to evaluate a mathematical equation,

► Binary Tree

► Binary Search Tree

► Parse Tree

► AVL Tree

Question No: 8 ( Marks: 1 ) - Please choose one


If a
complete binary tree has n number of nodes then its height will be,

► Log2 (n+1) -1

► 2n

► Log2 (n) - 1

► 2n - 1

Question No: 9 ( Marks: 1 ) - Please choose one

For More Help Contact What’s app 03224021365


If a
complete binary tree has height h then its no. of nodes will be,

► Log (h)

► 2h+1- 1

► Log (h) - 1

► 2h - 1

Question No: 10 ( Marks: 1 ) - Please choose one


A
binary relation R over S is called an equivalence relation if it has following property(s)

► Reflexivity
► Symmetry
► Transitivity
► All of the given options

Question No: 11 ( Marks: 1 ) - Please choose one


Binar
y Search is an algorithm of searching, used with the ______ data.
► Sorted
► Unsorted
► Heterogeneous
► Random

Question No: 12 ( Marks: 1 ) - Please choose one


If
there are N elements in an array then the number of maximum steps needed to find an element using
Binary Search is _______ .
►N
► N2
► Nlog2N
► log2N

Question No: 13 ( Marks: 1 ) - Please choose one


Use
of binary tree in compression of data is known as _______ .

► Traversal
► Heap
► Union
► Huffman encoding

Question No: 15 ( Marks: 1 ) - Please choose one


Whic
h of the following statements is correct property of binary trees?
► A binary tree with N internal nodes has N+1 internal links.
► A binary tree with N external nodes has 2N internal nodes.
► A binary tree with N internal nodes has N+1 external nodes.

For More Help Contact What’s app 03224021365


► None of above statement is a property of the binary tree.

Question No: 16 ( Marks: 1 ) - Please choose one


Whic
h of the following is a property of binary tree?
► A binary tree of N external nodes has N internal node.
► A binary tree of N internal nodes has N+ 1 external node.
► A binary tree of N external nodes has N+ 1 internal node.
► A binary tree of N internal nodes has N- 1 external node.

Question No: 21 ( Marks: 1 ) - Please choose one


A
complete binary tree is a tree that is _________ filled, with the possible exception of the bottom level.
► partially
► completely
► incompletely
► partly

Question No: 24 ( Marks: 1 ) - Please choose one


Supp
ose that a selection sort of 100 items has completed 42 iterations of the main loop. How many items are
now guaranteed to be in their final spot (never to be moved again)?

► 21
► 41
► 42
► 43

Question No: 25 ( Marks: 1 ) - Please choose one


Supp
ose you implement a Min heap (with the smallest element on top) in an array. Consider the different
arrays below; determine the one that cannot possibly be a heap:
► 16, 18, 20, 22, 24, 28, 30
► 16, 20, 18, 24, 22, 30, 28
► 16, 24, 18, 28, 30, 20, 22
► 16, 24, 20, 30, 28, 18, 22

Question No: 26 ( Marks: 1 ) - Please choose one


Whic
h of the following statement is NOT correct about find operation:

► It is not a requirement that a find operation returns any specific name, just that finds on two
elements return the same answer if and only if they are in the same set.
► One idea might be to use a tree to represent each set, since each element in a tree has the same
root, thus the root can be used to name the set.

► Initially each set contains one element.


► Initially each set contains one element and it does not make sense to make a tree of one
node only.

Question No: 27 ( Marks: 1 ) - Please choose one


Con
sider the following infix expression:

For More Help Contact What’s app 03224021365


x–y*a+b/c
Which of the following is a correct equivalent expression(s) for the above?

►x y -a * b +c /
►x *y a - b c / +
►x y a * - b c / +
►x y a * - b/ + c

Question No: 28 ( Marks: 1 ) - Please choose one


A
complete binary tree of height ____ has nodes between 16 to 31 .
►2
►3
►4
►5

Question No: 29 ( Marks: 1 ) - Please choose one


Here
is an array of ten integers:
5 3 8 9 1 7 0 2 6 4
The array after the FIRST iteration of the large loop in a selection sort (sorting from smallest to largest).

►0 3 8 9 1 7 5 2 6 4
►2 6 4 0 3 8 9 1 7 5
►2 6 4 9 1 7 0 3 8 5
►0 3 8 2 6 4 9 1 7 5

Question No: 30 ( Marks: 1 ) - Please choose one


What
requirement is placed on an array, so that binary search may be used to locate an entry?

► The array elements must form a heap.


► The array must have at least 2 entries.
► The array must be sorted.
► The array’s size must be a power of two.

Question No. 1 Marks : 02


Queue is the LIFO structure.
o True
o False
Question No. 2 Marks : 02
In binary search tree (BST) every node has two or zero node.
o True
o False
Question No. 3 Marks : 02
In Stack we can access elements from both ends
o True
o False
Question No. 4 Marks : 02

For More Help Contact What’s app 03224021365


Each node of linked list contains data element and pointer.
o True
o False
Question No. 5 Marks : 02
Every AVL is binary search tree (BST).
o True
o False
Question No: 1 ( Marks: 1 ) - Please choose one

The arguments passed to a function should match in number, type and order with the parameters in the
function definition.

► True

► False

Question No: 2 ( Marks: 1 ) - Please choose one

If numbers 5, 222, 4, 48 are inserted in a queue, which one will be removed first?

► 48

►4

► 222

►5

Question No: 4 ( Marks: 1 ) - Please choose one

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

For More Help Contact What’s app 03224021365


► LinkLists

► Binary Search Trees

► All of the given options

Question No: 5 ( Marks: 1 ) - Please choose one

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.

► x is now 1, but y is still 0.

► x is still 0, but y is now 2.

► x is now 1, and y is now 2.

Question No: 6 ( Marks: 1 ) - Please choose one

The difference between a 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

For More Help Contact What’s app 03224021365


Question No: 7 ( Marks: 1 ) - Please choose one

Compiler uses which one of the following to evaluate a mathematical equation,

► Binary Tree

► Binary Search Tree

► Parse Tree

► AVL Tree

Question No: 10 ( Marks: 1 ) - Please choose one

Which of the following method is helpful in creating the heap at once?

► insert

► add

► update

► preculateDown

Question No: 11 ( Marks: 1 ) - Please choose one

The definition of Transitivity 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

Question No: 12 ( Marks: 1 ) - Please choose one

For More Help Contact What’s app 03224021365


A binary tree of N nodes has _______.

► Log10 N levels

► Log2 N levels

► N / 2 levels

► N x 2 levels

Question No: 14 ( Marks: 1 ) - Please choose one

Consider te following array


23 15 5 12 40 10 7
After the first pass of a particular algorithm, the array looks like
15 5 12 23 10 7 40
Name the algorithm used

► Heap sort

► Selection sort

► Insertion sort

► Bubble sort

Question No: 19 ( Marks: 1 ) - Please choose one

Consider a min heap, represented by the following array:


10,30,20,70,40,50,80,60
After inserting a node with value 31.Which of the following is the updated min heap?

► 10,30,20,31,40,50,80,60,70

For More Help Contact What’s app 03224021365


► 10,30,20,70,40,50,80,60,31

► 10,31,20,30,40,50,80,60,31

► 31,10,30,20,70,40,50,80,60

Question No: 20 ( Marks: 1 ) - Please choose one

Which one of the following algorithms is most widely used due to its good average time,

► Bubble Sort

► Insertion Sort

► Quick Sort

► Merge Sort

Question No: 23 ( Marks: 1 ) - Please choose one

The following are statements related to queues.

(i) The last item to be added to a queue is the first item to be removed
(ii) A queue is a structure in which both ends are not used
(iii) The last element hasn’t to wait until all elements preceding it on the queue are removed
(iv) A queue is said to be a last-in-first-out list or LIFO data structure.
Which of the above is/are related to normal queues?

► (iii) and (ii) only

► (i), (ii) and (iv) only

► (ii) and (iv) only

► None of the given options

For More Help Contact What’s app 03224021365


Question No: 24 ( Marks: 1 ) - Please choose one

The maximum number of external nodes (leaves) for a binary tree of height H is _________

► 2H

► 2H +1

► 2H -1

► 2H +2
Question No: 26 ( Marks: 1 ) - Please choose one

We are given N items to build a heap , this can be done with _____ successive inserts.

► N-1

►N

► N+1

► N^2

Question No: 27 ( Marks: 1 ) - Please choose one

Suppose we had a hash table whose hash function is “n % 12”, if the number 35 is already in the hash
table, which of the following numbers would cause a collision?

► 144

► 145

► 143

► 148

Question No: 30 ( Marks: 1 ) - Please choose one

In case of deleting a node from AVL tree, rotation could be prolong to the root node.

For More Help Contact What’s app 03224021365


► Yes

Visit My YouTube Channel


For More Subjective
and Important Notes
Channel Name = #VuTopperRM

For More Help Contact What’s app 03224021365

You might also like