Contents

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

a

Explanation: The infix expression is a*b+c*d. Evaluating it, we get, 2*2+3*4=16.


What data structure is used when converting an infix notation to prefix notation?
a) Stack                                
b) Queue
c) B-Trees                             
d) Linked-list

a

Explanation: First you reverse the given equation and carry out the algorithm of infix to postfix expression. Here, the data structure used is stacks.


What would be the Prefix notation for the given equation?
A+(B*C)
a) +A*CB                             
b) *B+AC
c) +A*BC                             
d) *A+CB

c

What would be the Prefix notation for the given equation?
A+B*C^D                            
a) +A*B^CD                       
b) +A^B*CD        
c) *A+B^CD                        
d) ^A*B+CD

a

Out of the following operators (^, *, +, &, $), the one having highest priority is
a) +                        
b) $                        
c) ^                        
d) &

c

Explanation: According to the algorithm (infix-prefix), it follows that the exponentiation will have the highest priority.


Out of the following operators (|, *, +, &, $), the one having lowest priority is…….
a) +                        
b) $                        
c) |                          
d) &

c

Explanation: According to the algorithm (infix-prefix), it follows that the logical OR will have the lowest priority.