CS301 Data Structure Online Solved MCQ's Quizzes File 4





In specialization we can, 
Replace child class with its base class 
Replace base class with its child class (Not Sure) 
Replace both child and base classes interchangeably 
None of the given options
Consider the code below, class class1{ public: void func1(); }; class class2 : public class1 { }; Function func1 of class1 is ____ in class2, 
public 
protected
private 
none of the given options
It is illegal to make objects of one class members of another class.
True 
False
An abstract class is useful when 
no classes should be derived from it. 
there are multiple paths from one derived class to another. 
no objects should be instantiated from its. 
you want to defer the declaration of the class.
In resolution order compiler search firstly _______.
Generic Template 
Partial Specialization 
Complete Specialization 
Ordinary function


The main reason of using heap in priority queue is
improve performance
code is readable
less code
heap can’t be used in priority queues
We implement the heap by ____________ 
Threaded Tree
AVL tree
Complete binary tree
Expression
A simple sorting algorithm like selection sort or bubble sort has a worst-case of
O(1) time because all lists take the same amount of time to sort
O(n) time because it has to perform n swaps to order the list.
O(n3) time, because the worst case has really random input which takes longer to.
If we want to find median of 50 elements, then after applying buildHeap methodhow many times deleteMinmethod will be called ?

Select correct option:5
25
35
50

User can make virtual table explicitly.
True 

False
Binding means that target function for a call is selected at compile time.
Static 
Dynamic 
Automatic 
None of given
Target of a _____ function call is determined at run time.
instance 
virtual 
operator 
none of given
Which line will produce error. Class phone: private Transmit, private Receiver { } 1. int main() 2. { 3. phone obj; 4. Tranmit* obj1 = &obj; 5. Received obj2 = &obj; 6. }.
3rd line will produce error 
4th line will produce error 
3rd and 4th line will produce error. 
5th line will produce error
Which of the following heap method increase the value of key at position ‘p’ by the amount ‘delta’?
Select correct option:
increaseKey(p,delta) 
decreaseKey(p,delta)
preculateDown(p,delta)
remove(p,delta)

Which one of the following is NOT true regarding the skip list?
Each list Si contains the special keys + infinity and – infinity.
List S0 contains the keys of S in non-decreasing order.
Each list is a subsequence of the previous one.
List Sh contains only the n special keys.

Sender of the message does not need to know the exact class of receiver in________.
Abstraction
Polymorphism
Inheritance
none of the given


Question # 1 of 10
Information hiding can be achieved through__________.
1.    Encapsulation, Inheritance
2.    Encapsulation, Polymorphism
3.    Encapsulation, Abstraction
4.    Overloading
Question # 2 of 10 ( Start time: 01:11:21 AM ) Total M - 1
A good model is ................ related to a real life problem.
Select correct option:
1.    Loosely
2.    Openly
3.    Closely
Question # 3 of 10 ( Start time: 01:12:33 AM ) Total M - 1
Which of the following features of OOP is used to derive a class from another?
Select correct option:
1.    Encapsulation
2.    Polymorphism
3.    Data hiding
4.    Inheritance

Which of the following is not true regarding the maze generation?
 Randomly remove walls until the entrance and exit cells are in the same set.
 Removing a wall is the same as doing a union operation.
 Do not remove a randomly chosen wall if the cells it separates are already in the same set.

Which property of equivalence relation is satisfied if we say: Ahmad R(is related to) Ahmad
Reflexivity
Symmetry
Transitivity


Threaded Tree
AVL tree
Complete binary tree
Expression
Which of the following statement concerning heaps is NOT true?
Traversing a heap in order provides access to the data in numeric or alphabetical order.
Removing the item at the top provides immediate access to the key value with highest (or lowest) priority.
Inserting an item is always done at the end of the array, but requires maintaining the heap property.
A heap may be stored in an array.

 Vukwl- Virtual Education Solution

Heap can be use to implement
Stack
Link list
Queue
Priority Queue

The preculateDown procedure will move the smaller value____ and bigger value______.
Select correct option:
left,right
right,left
up,down
down,up 
Which one of the following is not true regarding skip list.
Each list Si contain the special key + infinity and –infinity
List SO contain the key of S is non-decreasing order
List Sh contain only the n special keys

Each list in a sub sequence of previous list one
If Ahmad is cousin of Ali and Ali is cousin of Asad then Ahmad is also cousin of Asad the statement has the following property.
Reflexivity
Symmetry
Transitivity
All of the above

 Vukwl- Virtual Education Solution

The expression of (! heap-> is full() ) check
Heap is empty
Heap is full
Heap is not empty
Heap is not full(not conferm)
Which one of the following is not the property of equivalence relation
Reflexive
Symmetric
Transitive
Associative
Which of the following is not and implementation of table ADT
Sorted sequentially array
Stack
Link list

Skip list 


Function overriding is done in context of, 
Single class 
Single derived class 
Single base class 
Derived and base classes

Consider the code below, class class1{ public: void func1(); }; class class2 : protected class1 { }; Function func1 of class1 is ____ in class2, 
public 
protected 
private 
none of the given options

Which one of the following is not an open addressing technique to resolve collection

Quadratic probing
Double hashing

Cubic probing
Liner probing
Sorted sequentially array 
Stack 
Link list 
Skip list 

In which of the following tree, parent nodes has a key greater than or equal to its both children?
Max heap
Binary search tree
Threaded Binary three
Complete Binary tree 

In Complete binary tree the bottom level is filled from _______.
Right to left
Not filled at all
None of the given options

If the bottom level of a binary tree is NOT completely filled, depicts that the tree is NOT a ________
Threaded Binary Tree
Expression tree
Perfectly compete Binary tree 

If an expression tree is correct then its root should have,
()an operand
In threaded binary tree, the NULL pointers are replaced by the.
Preorder successor or predecessor
Inorder successor or predecessor
Postorder successor or predecessor
NULL pointer are not replaced 

A complete binary tree is a tree that is ________ filled, with the possible exception of the bottom level.
Partially
Incompletely
Partly 

If the bottom level of a binary tree is not completely filled, depicts that the tree is not a _________.
Expression tree
Threaded binary tree
Perfectly complete binary tree 



Which 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 external nodes has N+1 internal nodeA Binary tree of N internal has N-1 external node 

In a threaded binary tree which nodes have NULL child pointers,
All leaf nodes
Nodes other then leaf nodes
Root Node
None of the nodes

In threaded binary tree, the NULL pointers are replaced by the
preorder successor or predecessor
inorder successor or predecessor
postorder successor or predecessor
NULL pointers are not replaced

A complete binary tree is a tree that is _______ filled, with the possible exception of the bottom level.
partially
completely
incompletely
partly
Which one of the following is TRUE about iteration?
Iterative function calls consumes a lot of memory
Threaded Binary Trees use the concept of iteration
Iteration extensively uses stack memory
Recursion is more efficient than iteration

We implement the heap by ____________ .
Threaded Tree
AVL tree
Complete binary tree
Expression

Which of the following statement concerning heaps is NOT true?
Traversing a heap in order provides access to the data in numeric or alphabetical order.
Removing the item at the top provides immediate access to the key value with highest (or lowest) priority.
Inserting an item is always done at the end of the array, but requires maintaining the heap property.
A heap may be stored in an array.

A binary tree with N internal nodes has _____ links, _______ links to internal nodes and ________ links to external nodes.
N-1, 2N, N+1
N+1, 2N, N-1
N+1, N-1, 2N 

The expression of (! heap-> is full() ) check
Heap is empty 
Heap is full 
Heap is not empty
Heap is not full(not conferm)

Which of the following statement concerning heaps is NOT true?
A heap can be stored in a binary search tree.
A heap can be stored in an array.
A heap can be used to implement a priority queue.
A heap can be used to sort data.



By using __________we avoid the recursive method of traversing a Tree, which makes use of stacks and consumes a lot of memory and time.
Binary tree only
Heap data structure
Huffman encoding 



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

When a complete binary tree represented by an array then if right child is at position 5 then left child will be at position _____
2
3
4

If a binary tree has N + 1 external nodes then,It has N internal nodes.
It has N-1 internal nodes.
It has N/2 internal nodes
.It has N+2 internal nodes. 

A binary tree with 45 internal nodes has _______links to external nodes.
44
45
46
90

Which of the following may not be integral part of an object?
·       State
·       Behavior
·       Protected data members
·       All of given
·        
·       Suppose there is an object of type Person, which of the following can be considered as on of its attributes.
·       Name
·       Age
·       Work()
·       Both Name and Age
·        
·        
·       If we have an overloaded constrictor in our class, then compiler construct the default constructor.
·       True
·       False
·        
·       Advantages(s) of information hiding
·       Simplifies the model
·       Restriction to change
·       Both of above
·       None of the above
·        
·       If some of objects exhibit identical characteristics, then they belong to:
·       Different classes
·       Multiple classes
·       Same class
·       None of the given
·        
·       Which of the following is the way to extract common behaviour and attributes from the given and make a separate class of those common behaviours and attributes?
·       Generalization
·       Sub-typing
·       Specification
·       Extension

We are given N items to build a heap of items , this can be done with _____ successive inserts.
Select correct option:
N-1
N 
N+1
N^2


A complete binary tree is a tree that is _________ filled, with the possible exception of the bottom level.
partially
incompletely
partly
Consider a binary tree, represented by the following array: 10,7,9,5,2,1,6,3,4 This is a ________.
Min heapMax heap 
(Not Sure)
Threaded binary tree
Binary Search tree
Consider a binary tree, represented by the following array: A,B,C,D,E,F,G,I Is it a strictly binary tree ?  
Yes

In threaded binary tree the NULL pointers are replaced by the
preorder successor or predecessor
inorder successor or predecessor
NULL pointers are not replaced 

Consider a binary tree, represented by the following array: A,B,C,D,E,F,G,H,I,J,K,L Is it a strictly binary tree?
Yes

We implement the heap by ______________ .
Threaded Tree
AVL tree
Expression 

If there are 56 internal nodes in a binary tree then how many external nodes this binary tree will have?

54       
55       
56       


Which 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. 




Which of the following statement is correct?       
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.       
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.       
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.



Which of the following statement is true about dummy node of threaded binary tree?       
The left pointer of dummy node points to the itself while the right pointer points to the root of tree. 
The left pointer of dummy node points to the root node of the tree while the right pointer is always NULL.       
The right pointer of dummy node points to the itself while the left pointer is always NULL. 

If the bottom level of a binary tree is NOT completely filled, depicts that the tree is NOT a
Expression tree       
Threaded binary tree       
Perfectly complete Binary tree


If there are 23 external nodes in a binary tree then what will be the no. of internal nodes in this binary tree?
 23       
 2       
 21      

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


Which 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.        
 None of above statement is a property of the binary tree.  
What is the best definition of a collision on a hash table?Two entries are identical except for their keys.
Two entries with different data have the exact same key.
Two entries with different keys have the exact has value
Two entries with the exact same keys have different hash value.

By using __________we avoid the recursive method of traversing a Tree, which makes use of stacks and consumes a lot of memory and time.
Binary tree only       
Heap data structure      
Huffman encoding


Which one of the following is not an open addressing technique to resolve collection
Quadratic probing
Double hashing
Cubic probing
Liner probing

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?
Select correct option:
3,4,6,7,5,10,1
3,4,6,7,5,1,10
1,4,6,7,5,10,3
1,4,3,7,5,10,6 

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    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

In complete binary tree the bottom level is filled from ________.
Right to left       
Not filled at all       
None of the given options



Which of the following is NOT true regarding the maze generation?
Select correct option:
Randomly remove walls until the entrance and exit cells are in the same set
Removing a wall is the same as doing a union operation
Do not remove a randomly chosen wall if the cells it separates are already in the same set
None of the given 


 Vukwl- Virtual Education Solution


The main reason of using heap in priority queue is
Select correct option:
improve performance 
code is readable
less code
heap can't be used in priority queues


When an array of object is created dynamically then there is no way to provide parameterized constructors for array of objects.
Flase


The expression if ( ! heap->isEmpty() ) checks
Select correct option:
Heap is empty
Heap is full
Heap is not empty 
Not a valid expression

Which property of relation is satisdied if we say: Ahmad R(is related to)Ahmad
Reflexivity
Symmetry
Transitvity
All of the given

Which of the following statement is NOT correct regarding Table ADT?
Select correct option:
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.





 Vukwl- Virtual Education Solution


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?
Select correct option:
11,22,33,44,55,66 
11,22,33,44,66,55
11,22,33,66,44,55
11,22,66,33,44,55


Which property of equivalence relation is satisfied if we say: Ahmad R(is related to) Ahmad
Select correct option:
Reflexivity 
Symmetry
Transitivity
All of the above


Which of the following is NOT an implementation of Table ADT?
Select correct option:
Sorted Sequential Array
Stack
Linked List
Skip List   


The expression if ( ! heap->isFull() ) check
Select correct option:
Heap is empty
Heap is full
Heap is not empty
Heap is not full 


 Vukwl- Virtual Education Solution


The main reason of using heap in priority queue is
improve performance
code is readable
less code
heap can't be used in priority queues



We implement the heap by ____________ 
Threaded Tree
AVL tree
Complete binary tree
Expression



A simple sorting algorithm like selection sort or bubble sort has a worst-case of
O(1) time because all lists take the same amount of time to sort
O(n) time because it has to perform n swaps to order the list.
O(n2) time because sorting 1 element takes O(n) time - After 1 pass through the list,
either of these algorithms can guarantee that 1 element is sorted.

O(n3) time, because the worst case has really random input which takes longer to.


If we want to find median of 50 elements, then after applying buildHeap method, how many times deleteMin method will be called ?
Select correct option:
5

25
35
50



 Vukwl- Virtual Education Solution




Which one of the following is NOT true regarding the skip list?
Each list Si contains the special keys + infinity and - infinity.
List S0 contains the keys of S in non-decreasing order. 
Each list is a subsequence of the previous one.
List Sh contains only the n special keys.


Which of the following is not true regarding the maze generation?
 Randomly remove walls until the entrance and exit cells are in the same set. 
 Removing a wall is the same as doing a union operation. 
 Remove a randomly chosen wall if the cells it separates are already in the same set. 
 Do not remove a randomly chosen wall if the cells it separates are already in the same set. 


Which property of equivalence relation is satisfied if we say: Ahmad R(is related to) Ahmad
Reflexivity
Symmetry
Transitivity



The expression if ( ! heap->isEmpty() ) checks
Heap is empty
Heap is full
Heap is not empty
Not a valid expression (not confirm)



A complete binary tree is a tree that is _________ filled, with the possible exception of the bottom level.partiallycompletelyincompletelypartly

By using __________we avoid the recursive method of traversing a Tree, which makes use of stacks and consumes a lot of memory and time.Binary tree onlyHeap data structureHuffman encoding 
Which of the following statement is true about dummy node of threaded binary tree?The left pointer of dummy node points to the itself while the right pointer points to the root of tree.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.The left pointer of dummy node points to the root node of the tree while the right pointer is always NULL.The right pointer of dummy node points to the itself while the left pointer is always NULL. 
Threaded binary tree
When a complete binary tree, represented by an array then for any array element at position i, the parent is at position ______ .2i-12i2i+1floor(i/2) 
When a complete binary tree represented by an array then if right child is at position 5 then left child will be at position _____2346 
A binary tree with N internal nodes has _____ links, _______ links to internal nodes and ________ links to external nodes.2N, N-1, N+1N-1, 2N, N+1N+1, 2N, N-1N+1, N-1, 2N 
If a binary tree has N + 1 external nodes then,It has N internal nodes.It has N-1 internal nodes.It has N/2 internal nodes.It has N+2 internal nodes. 
A binary tree with 45 internal nodes has _______links to external nodes.44454690 

If a tree has 50 nodes, then the total edges/links in the tree will be :
Select correct option:
55
51
50
49 
Consider a binary tree, represented by the following array: 10,7,9,5,2,1,6,3,4 This is a ________.Min heapMax heap (Not Sure)Threaded binary treeBinary Search tree Consider a binary tree, represented by the following array: A,B,C,D,E,F,G,I Is it a strictly binary tree ?  Yes No 


We implement the heap by
Threaded Tree
AVL tree
Complete binary tree
Expression


Which of the following statement concerning heaps is NOT true?
Traversing a heap in order provides access to the data in numeric or alphabetical order.
Removing the item at the top provides immediate access to the key value with highest (or lowest) priority.
Inserting an item is always done at the end of the array, but requires maintaining the heap property.
A heap may be stored in an array.


Which property of relation is satisdied if we say: Ahmad R(is related to)Ahmad

 Vukwl- Virtual Education Solution


Reflexivity
Symmetry
Transitvity
All of the given

Which of the following statement is true about dummy node of threaded binary tree?
The left pointer of dummy node points to the itself while the right pointer points to the root of tree.
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.
The left pointer of dummy node points to the root node of the tree while the right pointer is always NULL.The right pointer of dummy node points to the itself while the left pointer is always NULL. 


Heap can be use to implement

Stack
Link list
Queue
Priority Queue




If Ahmad is cousin of Ali and Ali is cousin of Asad then Ahmad is also cousin of Asad
the statement has the following property.


Reflexivity
Symmetry
Transitivity
All of the above






Which one of the following is not the property of equivalence relation


Reflexive
Symmetric
Transitive
Associative

 Vukwl- Virtual Education Solution


Which of the following is not and implementation of table ADT
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__________.
Select correct option:
31 
34
44
56

The worst case of building a heap of N keys is _______ .
Select correct option:
N
N^2
NlogN 
2^N

What is the best definition of a collision on a hash table?

 Vukwl- Virtual Education Solution


Two entries are identical except for their keys.

Two entries with different data have the exact same key.


Two entries with different keys have the exact has value

Two entries with the exact same keys have different hash value.


Question No: 17    ( M - 1 )
In which of traversal method, recursion can not be applied.?

Question No: 18    ( M - 1 )
What is meant by an empty stack?

Question No: 19    ( M - 2 )
Is the following statement correct? If your answer is No, then correct it.
“A tree is an AVL tree if at least half of the nodes fulfill the AVL condition”


Question No: 20    ( M - 3 )
The following function is performing some operation on the elements of a singly link list please tell what this functions is doing,
void LinkList::mystery(){
Node * temp = headNode;
int result = 0;
while( temp->getNext() != NULL ){
temp = temp->getNext();
int value = temp->get();
if(value % 2 == 0)
{                 value ++;
temp->set(value);
}
}
}


1. Whatever is the size of the tree, the search is performed after traversing up to ………………. Maximum level. (log2n)

Which one of the following is NOT the property of equivalence relation?
► Reflexive
► Symmetric
► Transitive
► Associative
Binary Search is an algorithm of searching, used with the ______ data.
► Sorted
► Unsorted
► Heterogeneous
► Random

Question No: 21    ( M - 5 )
See the code below , give comments against each line and identify which line will result in error?
1.     void main(void)
2.     {
3.        int actual = 123;
4.        int &other = actual;
5.
6.       int natural = 456;
7.      other = ♮
8.     }


For a perfect binary tree of height h, having N nodes, the sum of heights of nodes is _____________.
Select correct option:
N – (h – 1)
N – (h + 1) 
N – 1
N – 1 + h


If a tree has 50 nodes, then the total edges/links in the tree will be :
Select correct option:
55
51
50
49 


 Vukwl- Virtual Education Solution


given the values are the array representation of heap; 12 23 26 31 34 44 56 64 78 100 What is the 5th smallest element in the given heap?
Select correct option:
31
34 
44
56


We can build a heap in _____ time.
Select correct option:
Linear 
Exponential
Polynomial
None of the given options


If there are 100 elements in an equivalence class then we will have _________ sets initially.
Select correct option:
50
100 
1000
80


If the height of a perfect binary tree is 4. What will be the total number of nodes in it?
Select correct option:
15
16 
31
32


 Vukwl- Virtual Education Solution


Heap can be used to implement
Select correct option:
Stack
Linked list
Queue
Priority Queue 

Which 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 external nodes has N+ 1 internal node.       
A binary tree of N internal nodes has N- 1 external node.



 Vukwl- Virtual Education Solution


Which property of equivalence relation is satisfied if we say: Ahmad R(is related to) Ahmad
Select correct option:
Reflexivity 
Symmetry
Transitivity
All of the above


The preculateDown procedure will move the smallervalue____ and bigger value______.
Select correct option:

left,right
right,left
up,down
down,up

There are _________cases of Rotation in AVLtree.

Select correct option:

2
3
4
5
If a max heap is 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[1]
data[n-1]
data[n]
data[2*n+1]
Union is a _______ time operation.
► Constant
► Polynomial
► Exponential
► None of the given options
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.
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


In case of insertion of right inner node in BST,
Select correct option:
we need to apply single left rotation to make it AVL tree.
we need to apply single right rotationto make it AVL tree.
single left rotation first and then single right rotation tomake it AVL tree.
single right rotation first and then single left

Binary Search Tree voilates the condition of AVL tree when anynode has balance equal to
Select correct option:
2 or -2
1 or -1
0
None of the options.

Suppose we have the following values to be inserted inconstructing AVL tree, 20,23,25,10,12,13 Tell when first rotationwill take place,
Select correct option:
after inserting node 25
after inserting node 23
after inserting node 10
after inserting node 12

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

In which of the following tree, parent nodes has key greater than or equal to its both children?

Max heapBinary search treeThreaded Binary treeComplete Binary tree 

Post a Comment

Previous Post Next Post