0% found this document useful (0 votes)
14 views

Infix Prefix Postfix

Uploaded by

foodbucket02013
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Infix Prefix Postfix

Uploaded by

foodbucket02013
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Infix Prefix Postfix

1. 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 /

2. The postfix form of A*B+C/D is?

a) *AB/CD+

b) AB*CD/+

c) A*BC+/D

d) ABCD+/*

3. Which data structure is needed to convert infix notation to postfix notation?

a) Branch

b) Tree

c) Queue

d) Stack
4. The prefix form of A-B/ (C * D ⋀ E) is?

a) -/*⋀ACBDE

b) -ABCD*⋀DE

c) -A/B*C⋀DE

d) -A/BC*⋀DE

5. What is the result of the following operation

Top (Push (S, X))

a) X

b) Null

c) S

d) None

ANSWER: a) X

6. The prefix form of an infix expression


p + q - r * t is?

a) + pq - *rt

b) - +pqr * t

c) - +pq * rt

d) - + * pqrt
7. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?

a) 600

b) 350

c) 650

d) 588

8. Convert the following infix expressions into its equivalent postfix expressions

(A + B ⋀D)/(E - F)+G

a) (A B D ⋀ + E F - / G +)

b) (A B D +⋀ E F - / G +)

c) (A B D ⋀ + E F/- G +)

d) None

9. Convert the following Infix expression to Postfix form using a stack

x + y * z + (p * q + r) * s

Follow usual precedence rule and assume that the expression is legal.

a) xyz*+pq*r+s*+

b) xyz*+pq*r+s+*

c) xyz+*pq*r+s*+

d) none

10. What is the postfix expression for the corresponding infix expression? a+b*c+(d*e)

a) abc*+de*+

b) abc+*de*+

c) a+bc*de+*

d) abc*+(de)*+
11. What is the postfix expression for the following infix expression? a/b^c-d

a) abc^/d-

b) ab/cd^-

c) ab/^cd-

d) abcd^/-

12. What is the corresponding postfix expression for the given infix expression? a*(b+c)/d

a) ab*+cd/

b) ab+*cd/

c) abc*+/d

d) abc+*d/

13. What is the corresponding postfix expression for the given infix expression? a+(b*c(d/e^f)*g)*h)

a) ab*cdef/^*g-h+

b) abcdef^/*g*h*+

c) abcd*^ed/g*-h*+

d) abc*de^fg/*-*h+

14. What is the correct postfix expression for the following expression?
a+b*(c^d-e)^(f+g*h)-i

a) abc^de-fg+*^*+i-

b) abcde^-fg*+*^h*+i-

c) abcd^e-fgh*+^*+i-

d) ab^-dc*+ef^gh*+i-
15. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal

a. ABFCDE

b. ADBFEC

c. ABDECF

d. ABDCEF

16. Which data structure is needed to convert infix notation to postfix notation?

a) Branch

b) Tree

c) Queue

d) Stack

17. Which of the following is an infix expression?

a) (a+b)*(c+d)

b) ab+c*

c) +ab

d) abc+*

18. What is the time complexity of an infix to postfix conversion algorithm?

a) O(N log N)

b) O(N)

c) O(N2)

d) O(M log N)

You might also like