# Evaluation of a Prefix Expression Question with FREE PDF

We have the best collection of the evaluation of a Prefix Expression question and answer with FREE PDF. These questions and Answers will help you to prepare for any competitive exams like: BCA, MCA, GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.

## Evaluation of a Prefix Expression Question

##### 1. In the given C snippet, find the statement number that has error.
``````//C code to push an element into a stack
1. void push( struct stack *s, int x)
2. {
3.     if(s->top==MAX-1)
4.     {
5.         printf(“stack overflow”);
6.     }
7.     else
8.     {
9.         s->items[++s->top]=x;
10.        s++;
11.    }
12. }
``````

a) 1

b) 9

c) 10

d) 11

##### 2. While evaluating a prefix expression, the string is read from?

a) left to right

b) right to left

c) center to right

d) center to left to right

Answer: right to left

a) True

b) False

a) one

b) two

c) three

d) four

##### 5. What determines the order of evaluation of a prefix expression?

a) precedence and associativity

b) precedence only

c) associativity only

d) depends on the parser

Answer: precedence and associativity

##### 6. Find the output of the following prefix expression.

*+2-2 1/-4 2+-5 3 1

a) 2

b) 12

c) 10

d) 4

a) true

b) false

a) 10

b) 4

c) 17

d) 14

##### 9. If -*+abcd = 11, find a, b, c, d using evaluation of prefix algorithm.

a) a=2, b=3, c=5, d=4

b) a=1, b=2, c=5, d=4

c) a=5, b=4, c=7,d=5

d) a=1, b=2, c=3, d=4

Answer: a=1, b=2, c=5, d=4

a) one

b) two

c) three

d) four