Dharma Previous Years Solved Sample Placement Papers
-
Postfix Expression is (6*(3-(2+4))) which results -18 as output. What is the maximum number of symbols that will appear on the stack at one time during the conversion of this infix expression?
(a) 1
(b) 2
(c) 3
(d) 4
Answer: (d)
Explanation: During the conversion process, symbols such as+, *, (, *
are placed inside the stack. At one point, a maximum of 4 symbols are stored. -
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
(a) AB+ CD*E – FG /**
(b) AB + CD* E – F **G /
(c) AB + CD* E – *F *G /
(d) AB + CDE * – * F *G /
Answer: (c)
Explanation: (((A+ B)*(C*D- E)*F) / G) converts to postfix as AB+CD*E-*F*G/. -
The data structure required to check whether an expression contains a balanced parenthesis is?
(a) Stack
(b) Queue
(c) Array
(d) Tree
Answer: (a)
Explanation: The stack is used to store open parentheses and match them with closed ones. If the stack is empty at the end, the parenthesis is balanced. -
What data structure would you most likely see in a non-recursive implementation of a recursive algorithm?
(a) Linked List
(b) Stack
(c) Queue
(d) Tree
Answer: (b)
Explanation: Recursive algorithms use a stack to store variables and return addresses during function calls. -
The process of accessing data stored in a serial access memory is similar to manipulating data on a?
(a) Heap
(b) Binary Tree
(c) Array
(d) Stack
Answer: (d)
Explanation: Serial access memory operates on a last-in, first-out principle, similar to how stacks work. -
The postfix form of A*B+C/D is?
(a) *AB/CD+
(b) AB*CD/+
(c) A*BC+/D
(d) ABCD+/*
Answer: (b)
Explanation: Infix expression (A*B)+(C/D) converts to AB*CD/+ in postfix notation. -
Which data structure is needed to convert infix notation to postfix notation?
(a) Branch
(b) Tree
(c) Queue
(d) Stack
Answer: (d)
Explanation: Stacks are used to manage operator precedence and reverse their order for postfix notation. -
The prefix form of A-B/ (C * D ^ E) is?
(a) -/*^ACBDE
(b) -ABCD*^DE
(c) -A/B*C^DE
(d) -A/BC*^DE
Answer: (c)
Explanation: The infix expression (A-B)/(C*D^E) converts to prefix as -A/B*C^DE. -
What is the result of the following operation?
Top (Push (S, X))
(a) X
(b) X+S
(c) S
(d) XS
Answer: (a)
Explanation: After pushing X onto the stack, theTop
operation retrieves the top element, which is X.