What should be done when an opening parentheses is read in a balancing symbols algorithm?
A. push it on to the stack
B. throw an error
C. ignore the parentheses
D. pop the stack
Select an option to see the answer and solution.
What is the value of the postfix expression 2 3 + 4 5 6 - - *
Select an option to see the answer and solution.
Evaluation of infix expression is done based on precedence of operators.
Select an option to see the answer and solution.
Which of the following statement is incorrect with respect to evaluation of infix expression algorithm?
A. Operand is pushed on to the stack
B. If the precedence of operator is higher, pop two operands and evaluate
C. If the precedence of operator is lower, pop two operands and evaluate
D. The result is pushed on to the operand stack
Select an option to see the answer and solution.
Reverse Polish Notation is the reverse of a Polish Notation.
Select an option to see the answer and solution.
Using the evaluation of prefix algorithm, evaluate +-9 2 7.
Select an option to see the answer and solution.
Which of the following statement is incorrect with respect to balancing symbols algorithm?
A. {[()]}
B. ([ )]
C. {( )}
D. { [ ] }
Select an option to see the answer and solution.
An error is reported when the stack is not empty at the end.
Select an option to see the answer and solution.
How many stacks are required for reversing a word algorithm?
Select an option to see the answer and solution.
Evaluate the following infix expression using algorithm and choose the correct answer. a+b*c-d/e^f where a=1, b=2, c=3, d=4, e=2, f=2.
Select an option to see the answer and solution.
The time complexity of converting a prefix notation to infix notation is . . . . . . . .
A. O(n) where n is the length of the equation
B. O(n) where n is number of operands
C. O(1)
D. O(logn) where n is length of the equation
Select an option to see the answer and solution.
What will be the output of the following program?
main()
{
char str[]="hello india";
int len = strlen(str);
int i;
for(i=0;i<len;i++)
push(str[i]); // pushes an element into stack
for(i=0;i<len;i++)
pop(); //pops an element from the stack
}A. helloindia
B. hello india
C. aidni olleh
D. india hello
Select an option to see the answer and solution.
Which is the most appropriate data structure for reversing a word?
A. queue
B. stack
C. tree
D. graph
Select an option to see the answer and solution.
What is the number of moves required to solve Tower of Hanoi problem for k disks?
A. 2k - 1
B. 2k + 1
C. 2k + 1
D. 2k - 1
Select an option to see the answer and solution.
The postfix expression abc+de/*- is equivalent to which of the following infix expression?
A. abc+-de*/
B. (a+b)-d/e*c
C. a-(b+c)*(d/e)
D. abc+*-(d/e)
Select an option to see the answer and solution.
An error is thrown if the character '\n' is pushed in to the character stack.
Select an option to see the answer and solution.
Which of the following is valid reverse polish expression?
A. a op b
B. op a b
C. a b op
D. both op a b and a b op
Select an option to see the answer and solution.
The prefix expression of the postfix expression AB+CD-* is . . . . . . . .
A. (A+B)*(C-D)
B. +AB*-CD
C. A+*BCD-
D. *+AB-CD
Select an option to see the answer and solution.
Which of these operators have the highest order of precedence?
A. '(' and ')'
B. '*' and '/'
C. '~' and '^'
D. '+' and '-'
Select an option to see the answer and solution.
From the given expression tree, identify the infix expression, evaluate it and choose the correct result.
Select an option to see the answer and solution.