Vidyalelo
Data Structure · all questions

Stacks in Data Structures
practice.

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

159

Questions

8/8

Page

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

Which of the following statement is incorrect?

Select an option to see the answer and solution.

What is the postfix expression for the following infix expression?
a/b^c-d

Select an option to see the answer and solution.

What is the other name for a postfix expression?

Select an option to see the answer and solution.

Given a prefix and a postfix notation what are the difference between them?

Select an option to see the answer and solution.

What is the result of the following postfix expression?
ab*cd*+ where a=2,b=2,c=3,d=4.

Select an option to see the answer and solution.

From the given Expression tree, identify the correct postfix expression from the list of options.
Stacks in Data Structures mcq question image

Select an option to see the answer and solution.

What would be the Prefix notation for the given equation?
A+(B*C)

Select an option to see the answer and solution.

What is the result of the given postfix expression? abc*+ where a=1, b=2, c=3.

Select an option to see the answer and solution.

What will be output if the following sequence of operations are executed?
Push(a,s);
Push(b,s);
Pop(b);
Push(c,s);

Select an option to see the answer and solution.

What is the time complexity of evaluation of postfix expression algorithm?

Select an option to see the answer and solution.

Which application of stack is used to ensure that the pair of parentheses is properly nested?

Select an option to see the answer and solution.

What are the set of functions that are to be executed to get the following output?
cat

Select an option to see the answer and solution.

What will be result if the given stack is popped?
Stacks in Data Structures mcq question image

Select an option to see the answer and solution.

What is the time complexity of the following code?
public boolean isBalanced(String exp)
{
	int len = exp.length();
	Stack<Integer> stk = new Stack<Integer>();
	for(int i = 0; i < len; i++)
        {
		char ch = exp.charAt(i);
                if (ch == '(')
                stk.push(i);
                else if (ch == ')')
                {
			if(stk.peek() == null)
                        {
				return false;
			}
			stk.pop();
		}
	}
	return true;
}

Select an option to see the answer and solution.

What data structure is used when converting an infix notation to prefix notation?

Select an option to see the answer and solution.

If the corresponding end bracket/braces/parentheses is encountered, which of the following is done?

Select an option to see the answer and solution.

Which is the most appropriate data structure for applying balancing of symbols algorithm?

Select an option to see the answer and solution.

What would be the Prefix notation for the given equation?
a|b&c

Select an option to see the answer and solution.

Out of the following operators (|, *, +, &, $), the one having lowest priority is . . . . . . . .

Select an option to see the answer and solution.