|
The data structure required to
evaluate a postfix expression is
|
||||||||||
|
||||||||||
|
|
Answer: Option B
|
|||||||||
|
2:
|
The postfix form of the expression
(A+B)∗(C∗D-E)∗F/G is |
|||||||||
|
||||||||||
|
| Answer: Option A Explanation : |
|||||||||
|
3:
|
What is the postfix form of the
following prefix expression -A/B*C$DE
|
|||||||
|
||||||||
|
|
Answer: Option A |
|
4:
|
The data structure required to
check whether an expression contains balanced parenthesis is
|
|||||||
|
||||||||
|
|
Answer: Option A |
|
5:
|
The postfix form of A*B+C/D is
|
|||||||
|
||||||||
|
|
Answer: Option B |
|
6:
|
Which of the following types of
expressions does not require precedence rule when evaluated?
|
|||||||
|
||||||||
|
| Answer: Option D |
|
7:
|
The five items:A,B,C,D, and E are
pushed in a stack, one after the other starting from A.The stack is popped
four times and each element is inserted in a queue.Then two elements are
deleted from the queue and pushed back on the stack.Now one item is popped
from the stack.
The popped item is |
|||||||
|
||||||||
|
|
Answer: Option D
In queue elements are deleted from
front (FIFO) and in stacks elements are popped from top (LIFO)
|
|
8:
|
If memory for the run-time stack
is only 150 cells(words), how big can N be in Factorial(N) before
encounterring stack overflow?
|
|||||||
|
||||||||
|
| Answer: Option C Explanation :
Given that, the size of a run time
stack is of 150 cells (words). The arguments to be evaluate the factorial are
placed on the stack. A function call is made to calculate the factorial.
Subroutine is executed for each time the function call is made. Each funcall
creates a stack frames of co words (Cells), 2 words for n, 2 words for
program counter (PC) and 2 words for some other information.
The value of n should be such that, the size of stack should not exceed 150 cells. If we consider the value of n to be 26, it executes 25 procedure calls each of it with 6-word stack frame. In this case totalnumber of words of stack space would be 150 (6 words × 25 procedure calls = 150) cells.
Therefore, value of n will be 26
is n! before encountering a stack overflow for the stack of size 150 cells
(words)
|
|
9:
|
A postfix expression is merely the
reverse of the prefix expression
|
|||||||
|
||||||||
|
|
Answer: Option A |
|
10:
|
Following sequence of operations
is performed on a stack push(1),push(2),pop,
push(1),push(2)pop,pop,pop,push(2),pop.The sequence of poped out values are
|
|||||||
|
||||||||
|
|
Answer: Option A Explanation : |
|
11:
|
In eveluating the arithmetic
expression 2*3-(4+5),using stacks to evaluate its equivalent postfix form,
which of the following stack configuration is not possible?
|
|||||||
|
||||||||
|
|
Answer: Option D Explanation : The postfix equivallent is 2 3 * 4 5 + -. For evaluating this using stack,starting from the left,we have to scan one by one, if it is an operand push. If it is an operator, pop it twice,apply operator on the poppedout entries and push the result onto the stack. If we follow this,we can find configuration in option(d)is not possible |
|
12:
|
Stack A has the entries a,b,c(with
a on top).
Stack B is empty.An entry popped out of stack A can be printed immediately or pushed to stack B.An entry popped out of the stack B can only be printed. In this arrangement, which of the following permutations of a,b,c are not possible? |
|||||||
|
||||||||
|
|
Answer: Option C
Explanation : |
|
13:
|
The expression which accesses the
(ij)th entry of am x n matrix stored in column majorform is
|
|||||||
|
||||||||
|
|
Answer: Option B |
|
14:
|
Stack can't be used to
|
|||||||
|
||||||||
|
|
Answer: Option D |
|
15:
|
Which of the following
permutations can be obtained in the output(in the same order),using a stack
assuming that the input is the sequence 1,2,3,4,5 in that order?
|
|||||||
|
||||||||
|
| Answer: Option B |
|
16:
|
Stack is useful for implementing
|
|||||||
|
||||||||
|
|
Answer: Option C |
|
17:
|
If the sequence of operations-
push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop,
are performed on a stack, the sequenceof popped out values are
|
|||||||
|
||||||||
|
|
Answer: Option A |
|
18:
|
Stack A has the eintries a, b, c
(with a on top), Stack B is empty. An entry popped out of stack A can be
printed immediately or pushed to stack B. An entry popped out of stack B can
only be printed. In the arrangement, which of the following permutations of
a, b, c is not possible?
|
|||||||
|
||||||||
|
|
Answer: Option C |
|
19:
|
The postfix equivalent of the
prefix * + a b - c d is
|
|||||||
|
||||||||
|
|
Answer: Option A Explanation :
The tree whose preorder traversal
yields * + A B – C D, is given in fig 6.18. Writer the post-order traversal
of the tree. That is the postfix form.
|
|
20:
|
Stacks cannot be used to
|
|||||||
|
||||||||
|
|
Answer: Option D Explanation : |
|
21:
|
The postifx expression for the
infix expression
A + B* (C+D) / F + D*E is
|
|||||||
|
||||||||
|
|
Answer: Option B |
|
22:
|
Stack is useful for implemeting
|
|||||||
|
||||||||
|
|
Answer: Option D Explanation :
Breadth first search needs
Queue for implementaion
|
|
23:
|
An item that is read as input can
be either pushed to a stack and later popped and printed, or printed directly.
Which of the following will be the output if the input is the sequence of
items 1, 2, 3, 4, 5?
|
|||||||
|
||||||||
|
| Answer: Option B Explanation : |
No comments:
Post a Comment