The data structure required to check whether an expression contains a balanced parenthesis is?

Data Structure MCQ

The data structure required to check whether an expression contains a balanced parenthesis is?
a) Queue
b) Stack
c) Tree
d) Array

1. What is a data structure?
a) A programming language
b) A collection of algorithms
c) A way to store and organize data
d) A type of computer hardware

2. What are the disadvantages of arrays?
a) Index value of an array can be negative
b) Elements are sequentially accessed
c) Data structure like queue or stack cannot be implemented
d) There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

3. Which data structure is used for implementing recursion?
a) Stack
b) Queue
c) List
d) Array

4. The data structure required to check whether an expression contains a balanced parenthesis is?
a) Queue
b) Stack
c) Tree
d) Array

5. Which of the following is not the application of stack?
a) Data Transfer between two asynchronous process
b) Compiler Syntax Analyzer
c) Tracking of local variables at run time
d) A parentheses balancing program

6. Which data structure is needed to convert infix notation to postfix notation?
a) Tree
b) Branch
c) Stack
d) Queue

7. What is the value of the postfix expression 6 3 2 4 + – *?
a) 74
b) -18
c) 22
d) 40

8. What data structure would you mostly likely see in non recursive implementation of a recursive algorithm?
a) Stack
b) Linked List
c) Tree
d) Queue

9. Which of the following statement(s) about stack data structure is/are NOT correct?
a) Top of the Stack always contain the new node
b) Stack is the FIFO data structure
c) Null link is present in the last node at the bottom of the stack
d) Linked List are used for implementing Stacks

10. The data structure required for Breadth First Traversal on a graph is?
a) Array
b) Stack
c) Tree
d) Queue

11. The prefix form of A-B/ (C * D ^ E) is?
a) -A/B*C^DE
b) -A/BC*^DE
c) -ABCD*^DE
d) -/*^ACBDE

12. Which of the following points is/are not true about Linked List data structure when it is compared with an array?
a) Random access is not allowed in a typical implementation of Linked Lists
b) Access of elements in linked list takes less time than compared to arrays
c) Arrays have better cache locality that can make them better in terms of performance
d) It is easy to insert and delete elements in Linked List

13. Which data structure is based on the Last In First Out (LIFO) principle?
a) Tree
b) Linked List
c) Stack
d) Queue

14. Which of the following application makes use of a circular linked list?
a) Recursive function calls
b) Undo operation in a text editor
c) Implement Hash Tables
d) Allocating CPU to resources

15. What is a bit array?
a) Data structure that compactly stores bits
b) Data structure for representing arrays of records
c) Array in which elements are not present in continuous locations
d) An array in which most of the elements have the same value

16. Which of the following tree data structures is not a balanced binary tree?
a) Splay tree
b) B-tree
c) AVL tree
d) Red-black tree

17. Which of the following is not the type of queue?
a) Priority queue
b) Circular queue
c) Single ended queue
d) Ordinary queue

18. Which of the following data structures can be used for parentheses matching?
a) n-ary tree
b) queue
c) priority queue
d) stack

19. Which algorithm is used in the top tree data structure?
a) Backtracking
b) Divide and Conquer
c) Branch
d) Greedy

20. What is the need for a circular queue?
a) easier computations
b) implement LIFO principle in queues
c) effective usage of memory
d) to delete elements based on priority

21. Which of the following is the most widely used external memory data structure?
a) B-tree
b) Red-black tree
c) AVL tree
d) Both AVL tree and Red-black tree

22. Which of the following is also known as Rope data structure?
a) Linked List
b) Array
c) String
d) Cord

23. The data structure required to check whether an expression contains a balanced parenthesis is?
a) Queue
b) Stack
c) Tree
d) Array

24. Which of the following data structure can provide efficient searching of the elements?
a) binary search tree
b) unordered lists
c) 2-3 tree
d) treap

25. What is an AVL tree?
a) a tree which is unbalanced and is a height balanced tree
b) a tree which is balanced and is a height balanced tree
c) a tree with atmost 3 children
d) a tree with three children

26. What is the time complexity for searching a key or integer in Van Emde Boas data structure?
a) O (M!)
b) O (log M!)
c) O (log (log M))
d) O (M2)

27. The optimal data structure used to solve Tower of Hanoi is _________
a) Tree
b) Heap
c) Priority queue
d) Stack

28. What is the use of the bin data structure?
a) to have efficient traversal
b) to have efficient region query
c) to have efficient deletion
d) to have efficient insertion

29. Which is the most appropriate data structure for reversing a word?
a) stack
b) queue
c) graph
d) tree

30. What is the functionality of the following piece of code?

public void display() 
{
	if(size == 0)
		System.out.println("underflow");
	else
	{
		Node current = first;
		while(current != null)
		{
			System.out.println(current.getEle());
			current = current.getNext();
		}
	}
}

a) display the list
b) reverse the list
c) reverse the list excluding top-of-the-stack-element
d) display the list excluding top-of-the-stack-element

31. Which of the following is the simplest data structure that supports range searching?
a) AA-trees
b) K-d trees
c) Heaps
d) binary search trees

32. What is the advantage of a hash table as a data structure?
a) easy to implement
b) faster access of data
c) exhibit good locality of reference
d) very efficient for less number of entries

33. Which type of data structure is a ternary heap?
a) Hash
b) Array
c) Priority Stack
d) Priority Queue

34. What is a dequeue?
a) A queue implemented with both singly and doubly linked lists
b) A queue with insert/delete defined for front side of the queue
c) A queue with insert/delete defined for both front and rear ends of the queue
d) A queue implemented with a doubly linked list

35. A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?
a) Priority queue
b) Dequeue
c) Circular queue
d) Queue

36. What is the output of the following Java code?

public class array
{
	public static void main(String args[])
	{
		int []arr = {1,2,3,4,5};
		System.out.println(arr[2]);
		System.out.println(arr[4]);
	}
}

a) 4 and 2
b) 2 and 4
c) 5 and 3
d) 3 and 5

37. In simple chaining, what data structure is appropriate?
a) Doubly linked list
b) Circular linked list
c) Singly linked list
d) Binary trees

Access Array and Array Operations

Scroll to Top