TUTORIALS

Data Structures Multiple Choice Questions (MCQs)

2 .
Topic:  Queue
Question:
A queue data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?
A
Linear Queue
B
Circular queue
C
Double ended queue
D
Priority queue
Answer: C
3 .
Topic:  Queue
Question:
Following is C like pseudo code of a function that takes a Queue as an argument, and uses a stack S to do processing.
void fun(Queue *Q)
{
    Stack S;  // Say it creates an empty stack S
 
    // Run while Q is not empty
    while (!isEmpty(Q))
    {
        // deQueue an item from Q and push the dequeued item to S
        push(&S, deQueue(Q));
    }
 
    // Run while Stack S is not empty
    while (!isEmpty(&S))
    {
      // Pop an item from S and enqueue the poppped item to Q
      enQueue(Q, pop(&S));
    }
}
A
Removes the last from Q
B
Keeps the Q same as it was before the call
C
Makes Q empty
D
Reverses the Q
Answer: D
4 .
Topic:  Stacks
Question:
Consider linked list is used to implement the Stack, then which of the following node is considered as Top of the Stack
A
Middle Node
B
Last Node
C
Any Node
D
First Node
Answer: D
5 .
Topic:  Stacks
Question:
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
A
AB+ CD*E - FG /**
B
AB + CD* E - F **G /
C
AB + CD* E - *F *G /
D
AB + CDE * - * F *G /
Answer: A
6 .
Topic:  Stacks
Question:
Which data structure is used for implementing recursion?
A
Queue
B
Stack
C
Array
D
List
Answer: B
7 .
Topic:  Stacks
Question:
Consider the following operation performed on a stack of size 5. Push(1); Pop(); Push(2); Push(3); Pop(); Push(4); Pop(); Pop(); Push(5); After the completion of all operation, the no of element present on stack are
A
1
B
2
C
3
D
4
Answer: A
8 .
Topic:  Stacks
Question:
Consider the following array implementation of stack: #define MAX 10 Struct STACK { Int arr [MAX]; Int top = -1; } If the array index starts with 0, the maximum value of top which does not cause stack overflow is?
A
8
B
9
C
10
D
11
Answer: A
9 .
Topic:  Stacks
Question:
What’s happen if base condition is not defined in recursion ?
A
Executes the program
B
Runtime error
C
Compile Time error
D
Infinite loop
Answer: D
10 .
Topic:  Stacks
Question:
Which of the following is an application of stack?
A
finding factorial
B
tower of Hanoi
C
infix to postfix
D
all the above
Answer: D
11 .
Topic:  Trees
Question:
Which of the following ways below is a pre order traversal?
A
Root->left sub tree->right sub tree
B
Root-> right sub tree ->left sub tree
C
right sub tree->left sub tree->Root
D
left sub tree->right sub tree->Root
Answer: A
12 .
Topic:  Binary Tree
Question:
A terminal node in a binary tree is called
A
Root
B
Leaf
C
Child
D
Branch
Answer: B
13 .
Topic:  Trees
Question:
The number of nodes at level d in a complete binary tree
A
equal to 2^(d-1)
B
greater than 2^d
C
less than 2^d
D
equal to 2^d
Answer: D
14 .
Topic:  Binary Tree
Question:
The post order traversal of binary tree is DEBFCA. Find out the pre order traversal.
A
ABFCDE
B
ADBFEC
C
ABDECF
D
ABDCEF
Answer: C
15 .
Topic:  Binary Tree
Question:
A binary tree whose every node has either zero or two children is called
A
Complete binary tree
B
Binary search tree
C
Extended binary tree
D
None of above
Answer: B
16 .
Topic:  Linked List
Question:
In Linked List implementation, a node carries:
A
Data and Link
B
Link
C
Data
D
None of the above
Answer: A
17 .
Topic:  Linked List
Question:
Each Node contain minimum two fields one field called data field to store data. Another field is of type
A
Pointer to an Integer
B
Pointer to Class
C
Pointer to Node
D
Pointer to Character
Answer: C
18 .
Topic:  Linked List
Question:
The situation when in a linked list FIRST=NULL is
A
Underflow
B
Overflow
C
Houseful
D
Saturated
Answer: A
19 .
Topic:  Linked List
Question:
A linear list in which the last node points to the first node is?
A
singly linked list
B
circular linked list
C
doubly linked list
D
none of the above
Answer: B
20 .
Topic:  Queue
Question:
Queue in Data Structure is?
A
LIFO
B
FIFO
C
LILO
D
Both b and c
Answer: D