ONLINE SUMMER TRAINING Online Courses Free Tutorials 
 Placement Preparation 
Artificial Intelligence(AI) & Machine Learning(ML) Training in Jaipur
0 like 0 dislike
in Technical Questions by Goeduhub's Expert (5.8k points)

MCQ's Questions on Data Structures along with answers

Goeduhub's Online Courses @Udemy

For Indian Students- INR 570/- || For International Students- $12.99/-


Course Name

Apply Coupon


Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon


Computer Vision with OpenCV | Deep Learning CNN Projects

Apply Coupon


Complete Machine Learning & Data Science with Python Apply Coupon


Natural Language Processing-NLP with Deep Learning in Python Apply Coupon


Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon


Complete Python Programming from scratch with Projects Apply Coupon

1 Answer

0 like 0 dislike
by Goeduhub's Expert (5.8k points)
Best answer

 Data Structures MCQ's Questions Set 2

Q.1. With what data structure can a priority queue be implemented?

  1. Array
  2. List
  3. Heap
  4. Tree

Answer:- (4)

Q.2. What is the time complexity to insert a node based on position in a priority queue?

  1. O(nlogn)
  2. O(logn)
  3. O(n)
  4. O(n2)

Answer:- (3)

Q.3. What is a dequeue?

  1. A queue with insert/delete defined for both front and rear ends of the queue
  2. A queue implemented with a doubly linked list
  3. A queue implemented with both singly and doubly linked lists
  4. A queue with insert/delete defined for front side of the queue

Answer:- (1)

Q.4. What is the functionality of the following piece of code?

public void function(Object item)
Node temp=new Node(item,trail);
  Node cur=head.getNext();
  1. Insert at the front end of the dequeue
  2. Insert at the rear end of the dequeue
  3. Fetch the element at the rear end of the dequeue
  4. Fetch the element at the front end of the dequeue

Answer:- (2)

Q.5.  What is the functionality of the following piece of code?

public void fun(int x)
  1. Perform push() with push as the costlier operation
  2. Perform push() with pop as the costlier operation
  3. Perform pop() with push as the costlier operation
  4. Perform pop() with pop as the costlier operation

Answer:- (2)

Q.6. How many stacks are required for evaluation of prefix expression?

  1. one
  2. two
  3. three
  4. four

Answer:- (2)

Q.7.  In the given C snippet, find the statement number that has error.

//C code to push an element into a stack

 1.void push( struct stack *s, int x)
2. {
3.           if(s->top==MAX-1)
4.          {
5.               printf(“stack overflow”);
6.          }
7.          else
8.          {
9.                  s->items[++s->top]=x;
10.                 s++;
11.         }   

  1. 1
  2. 9
  3. 10
  4. 11

Answer:- (3)

Q.8. What is the other name for a postfix expression?

  1. Normal polish Notation
  2. Reverse polish Notation
  3. Warsaw notation
  4. Infix notation

Answer:- (2)

Q.9. While evaluating a postfix expression, when an operator is encountered, what is the correct operation to be performed?

  1. push it directly on to the stack
  2. pop 2 operands, evaluate them and push the result on to the stack
  3. pop the entire stack
  4. ignore the operator

Answer:- (2)

Q.10. In infix to postfix conversion algorithm, the operators are associated from?

  1. right to left
  2. left to right
  3. centre to left
  4. centre to right

Answer:- (2)

Q.11. The time complexity of converting a prefix notation to infix notation is _________

  1. O(n) where n is the length of the equation
  2. O(n) where n is number of operands
  3. O(1)
  4. O(logn) where n is length of the equation

Answer:- (1)

Q.12. The result of the postfix expression 5 3 * 9 + 6 / 8 4 / + is _____________

  1. 8
  2. 6
  3. 10
  4. 9

Answer:- (2)

Q.13. What is the time complexity of reversing a word using stack algorithm?

  1. O (N log N)
  2. O (N2)
  3. O (N)
  4. O (M log N)

Answer:- (3)

Q.14. Find the error (if any) in the following code snippet for pop operation.

void pop() //removing an element from a stack
     printf(“%s”, stack[top++]);
  1. run time error
  2. compile time error
  3. pop operation is performed, but top moved in wrong direction
  4. pop operation is performed properly

Answer:- (3)

Q.15. How will you implement dynamic arrays in Java?

  1. Set
  2. Map
  3. HashMap
  4. List

Answer:- (4)

Q.16. Which of the following is a disadvantage of dynamic arrays?

  1. Locality of reference
  2. Data cache utilization
  3. Random access
  4. Memory leak

Answer:- (4)

Q.17. In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree with n internal nodes is:

  1. nk
  2. (n-1)k + 1
  3. n(k-1) + 1
  4. n(k-1)

Answer:- (3)

Q.18. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?

  1. Insertion Sort
  2. Quick Sort
  3. Heap Sort
  4. Merge Sort

Answer:- (4)

Q.19. The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:

  1. 2- 1
  2. 2h-1 - 1
  3. 2h+1 - 1
  4. 2*(h+1)

Answer:- (3)

Q.20. The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is:

  1. n/2
  2. (n-1)/3
  3. (n-1)/2
  4. (2n+1)/3

Answer:- (4)

Data Structures Interview Questions Set 1 Click here

For more Technical MCQ's and Interview Questions Click here

Our Mentors(For AI-ML)

Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune


Ms. Nisha

An alumna of IIT-BHU


About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © Social::   |  |