My Report (&Account)

Prefix Expression Test


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)

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. }

2. An error is thrown if the character ‘\n’ is pushed in to the character stack.

3. The associativity of an exponentiation operator ^ is right side.

4. How many stacks are required for evaluation of prefix expression?

5. Using the evaluation of prefix algorithm, evaluate +-9 2 7.

6. Find the output of the following prefix expression.

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

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

8. What determines the order of evaluation of a prefix expression?

9. How many types of input characters are accepted by this algorithm?

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


 

Start practicing “1000 MCQs on Data Structure”, and once you are ready, you can take tests on all topics by attempting our “Data Structure Test Series”.

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.