Data Structure MCQ (Multiple Choice Questions) || 20 MCQ QUESTIONS
Question 1: Consider the following singly linked list wherein each node of the linked list contains a data (integer) and a link pointing to the next node:
What would be the outputs of the following if the initial call is func(head):
void func(node* root)
{
if(!root)
return;
printf("%d, ",root->data);
func(root->link);
}
Select one:
a. 20, 5, 15, 10
b. 20
c. None of these
d. 10, 15, 5, 20
The correct answer is: 10, 15, 5, 20
Question 2: How many maximum pointers will get updated in removal of a term from a polynomial stored in a doubly circular linked list?
a. 3
b. 2
c. 4
d. 1
The correct answer is: 2
Question 3: How many minimum pointers will get updated in removal of a term from a polynomial stored in a doubly linked list?
a. 3
b. 4
c. 1
d. 2
The correct answer is: 1
Question 4
Consider the following keys to be stored in a hash table of size 13 (location 0 to location 12) using division method and linear probing is used as the collision resolution technique. At which place, 71 would be stored? 10, 100, 32, 45, 58, 71
a. None of these
b. 6
c. 7
d. 8
The correct answer is: None of these
Question 5
How many collisions occur when the following keys are first folded by adding their individual digits and then stored to a hash table of size 13 (location 0 to location 12) using division method? 10, 100, 32, 45, 58, 126, 3, 29, 200, 400, 0
a. 0
b. 3
c. 2
d. 1
The correct answer is: 3
Question 6 : How many maximum pointers will get updated in removal of a term from a polynomial stored in singly circular linked list?
a. 3
b. 1
c. 4
d. 2
The correct answer is: 1
Question 7: Consider the following singly linked list wherein each node of the linked list contains a data (integer) and a link pointing to the next node:
What would be the outputs of the following if the initial call is func(head->link):
void func(node* root)
{
if(root=NULL)
return;
printf("%d, ",root->data);
func(root->link);
}
Select one:
a. None of these
b. 20, 5, 15, 10
c. 20
d. 10, 15, 5, 20
The correct answer is: None of these
Question 8: Consider the following singly linked list wherein each node of the linked list contains a data (integer) and a link pointing to the next node:
What would be the outputs of the following if the initial call is func(head):
void func(node* root)
{
if(!root)
return;
func(root->link);
printf("%d, ",root->data);
}
Select one:
a. None of these
b. 10, 15, 5, 20
c. 20
d. 20, 5, 15, 10
The correct answer is: 20, 5, 15, 10
Question 9
Consider the following singly linked list wherein each node of the linked list contains a data (integer) and a link pointing to the next node:
how many function calls will be there including the initial call if the initial call is func(head):
void func(node* root)
{
if(!root)
return;
printf("%d, ",root->data);
func(root->link);
}
Select one:
a. 3
b. 4
c. 2
d. 5
The correct answer is: 5
Question 10: Consider the following singly linked list wherein each node of the linked list contains a data (integer) and a link pointing to the next node:
What would be the outputs of the following if the initial call is func(head):
void func(node* root)
{
if(!root->link)
return;
printf("%d, ",root->data);
func(root->link);
}
Select one:
a. 20, 5, 15, 10
b. 10, 15, 5, 20
c. None of these
d. 20
The correct answer is: None of these
Question 11: If a and b are the number of black and red nodes respectively in a RB tree then which of the following statement is true:
a. none of these
b. a may be larger than 2b
c. a can not exceeds b+non_leaf_nodes
d. a can not exceeds 2b
The correct answer is: a may be larger than 2b
Question 12
Insertion of data into B-tree may cause
a. Increase in height
b. No change in height and no change in numbers of node
c. Split the node
d. Any of the above
The correct answer is: Any of the above
Question 13
What is the best case height of a B-tree of order n and which has k keys?
a. logn (k+1) – 1
b. nk
c. logk (n+1) – 1
d. klog n
The correct answer is: logn (k+1) – 1
Question 14
How many maximum number of keys are possible with a B Tree having minimum degree 4 when number of levels are 3:
a. 210
b. None of these
c. 220
d. 215
The correct answer is: None of these
Question 15
Consider the following BST:
What will be the value of the following expression:
InOrder Successor (25) + Preorder Predecessor (25) + postorder successor (25)
a. 70
b. 75
c. 73
d. None of these
The correct answer is: None of these
Question 16
Consider the following BST:
What will be the value of the following expression:
InOrder Successor (20) + Preorder Predecessor (25) + postorder successor (39)
a. 75
b. 70
c. None of these
d. 73
The correct answer is: None of these
Question 17
The height of the AVL tree when we insert the followings keys successively:
AVLTREISOK
a. 3
b. 5
c. 4
d. None of these
The correct answer is: 4
Question 18
When path length is defined as the number of edges on that path, the relationship between maximum path length (a) and minimum path length (b) of RB tree will be:
a. a<=2b+1
b. a+1<=2b
c. None of these
d. a+1<2b
The correct answer is: a<=2b+1
Question 19
When path length is defined as the number of levels, the largest difference between maximum path length and minimum path length of an AVL tree will be:
a. May be greater than 1
b. Zero
c. None of these
d. Always 1
The correct answer is: May be greater than 1
Question 20
Which of the following sequence is not possible in RB_delete_fixup algorithm?
If x is a left child:
Case 1: x’s sibling w is red
Case 2: x’s sibling w is black, and both of w’s children are black
Case 3: x’s sibling w is black, w’s left child is red, and w’s right child is black
Case 4: x’s sibling w is black, and w’s right child is red
a. case 1, case 2, case 4
b. case 1, case 2
c. case 1, case 3, case 4
d. case 1, case 4
The correct answer is: case 1, case 2, case 4
Comments
Post a Comment