Vidyalelo
Data Structure · all questions

Introduction to Data Structures
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

210

Questions

10/11

Page

Pick an option on a question to see the right answer and solution.

Consider the usual algorithm for determining whether a sequence of parentheses is balanced. The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?

Select an option to see the answer and solution.

A queue follows . . . . . . . .

Select an option to see the answer and solution.

Consider you have an array of some random size. You need to perform dequeue operation. You can perform it using stack operation (push and pop) or using queue operations itself (enQueue and Dequeue). The output is guaranteed to be same. Find some differences?

Select an option to see the answer and solution.

Why is implementation of stack operations on queues not feasible for a large dataset (Asssume the number of elements in the stack to be n)?

Select an option to see the answer and solution.

Which of the following statements are not correct with respect to Singly Linked List(SLL) and Doubly Linked List(DLL)?

Select an option to see the answer and solution.

In a circular queue, how do you increment the rear end of the queue?

Select an option to see the answer and solution.

Select the code snippet which returns the top of the stack.

Options are not available for this question.

Select an option to see the answer and solution.

Given below is the Node class to perform basic list operations and a Stack class with a no arg constructor. Select from the options the appropriate push() operation that can be included in the Stack class. Also 'first' is the top-of-the-stack.
class Node
{
	protected Node next;
	protected Object ele;
	Node()
	{
		this(null,null);
	}
	Node(Object e,Node n)
	{
		ele=e;
		next=n;
	}
	public void setNext(Node n)
	{
		next=n;
	}
	public void setEle(Object e)
	{
		ele=e;
	}
	public Node getNext()
	{
		return next;
	}
	public Object getEle()
	{
		return ele;
	}
}
 
class Stack
{
	Node first;
	int size=0;
	Stack()
	{
		first=null;
	}
}

Options are not available for this question.

Select an option to see the answer and solution.

The process of accessing data stored in a serial access memory is similar to manipulating data on a . . . . . . . .

Select an option to see the answer and solution.

Linked list is considered as an example of . . . . . . . . type of memory allocation.

Select an option to see the answer and solution.

How do you insert an element at the beginning of the list?

Options are not available for this question.

Select an option to see the answer and solution.

What would be the asymptotic time complexity to find an element in the linked list?

Select an option to see the answer and solution.

What is the worst case time complexity of inserting a node in a doubly linked list?

Select an option to see the answer and solution.

What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?

Select an option to see the answer and solution.

What does 'stack underflow' refer to?

Select an option to see the answer and solution.

In linked list implementation of queue, if only front pointer is maintained, which of the following operation take worst case linear time?

Select an option to see the answer and solution.

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]);
	}
}

Select an option to see the answer and solution.

Which of the following is not a disadvantage to the usage of array?

Select an option to see the answer and solution.

Convert the following infix expressions into its equivalent postfix expressions.
(A + B ⋀D)/(E – F)+G

Select an option to see the answer and solution.

What is the output of following function for start pointing to first node of following linked list?
1->2->3->4->5->6
void fun(struct node* start)
{
    if(start == NULL)
    return;
    printf("%d  ", start->data); 
    if(start->next != NULL )
    fun(start->next->next);
    printf("%d  ", start->data);
}

Select an option to see the answer and solution.