1. Which one of the following is an invalid postfix expression? a. ab + c * d - b. abc * + d - c. abc + * d - d. ( a b c * ) + d - x 2. Consider the following postfix expression S and the initial values of the variables. S = A B - C + D E F - + ^ Assume that A=3, B=2, C=1, D=1, E=2, F=3, What would be the final output of the stack? a. 1 b. 2 c. 0 d. -1 3. What is the value of the postfix expression 6 3 2 4 + - * a. Something between -15 and -100 b. Something between -5 and -15 c. Something between 5 and 15 d. Something between 15 and 100 4. Which of the following is a nonlinear data structure? a. Linked List b. Stack c. Queue d. Tree 5. If numbers 5, 222, 4, and 48 are inserted in a queue, which one will be removed first? a. 48 b. 4 c. 222 d. 5
Added by Rhonda G.
Close
Step 1
The invalid postfix expression is option A (-p+qee) because it has an invalid operator (e) and an operand (-p) without an operator. Show more…
Show all steps
Your feedback will help us improve your experience
Madhur L and 56 other Physics 102 Electricity and Magnetism educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Each question contains Statement-1 and Statement-2 and has the following choices (a), (b), (c) and (d), out of which ONLY ONE is correct. (a) Statement- 1 is True, Statement- 2 is True; Statement- 2 is a correct explanation for Statement-1 (b) Statement- 1 is True, Statement- 2 is True; Statement- 2 is NOT a correct explanation for Statement-1 (c) Statement- 1 is True, Statement- 2 is False (d) Statement- 1 is False, Statement- 2 is True Statement 1 The lines $3 x+5 y+7=0,5 x+y-3=0$ and $x+3 y+4=0$ are concurrent. and Statement 2 If the lines $a_{1} x+b_{1} y+c_{1}=0, a_{2} x+b_{2} y+c_{2}=0$ and $a_{3} x+b_{3} y+c_{3}=0$ are concurrent, then $a_{3} x+b_{3} y+c_{3}=a_{1} x+b_{1} y$ $+c_{1}+\lambda\left(a_{2} x+b_{2} y+c_{2}\right)$ for a unique value of $\lambda$
Select the correct alternative from the given choices. Stacks cannot be used to (A) Evaluate postfix expression (B) Implement recursion (C) Convert infix to postfix (D) Allocate resource like CPU by the operating system
Programming and Data Structures
Linked Lists, Stacks and Queues
Q3 (10 points) Consider the statement Every integer is either even or odd. The English phrase "either ... or" means it is an exclusive or; so one or the other is true, but not both. (a) Define two open sentences E(x) and O(x) as appropriate and write the statement above in symbolic form. Be sure to take the exclusive or part into account. (b) Write the negation of the statement in symbolic form, simplifying until all the ~ symbols are right next to the E(x)s and O(x)s. (c) Write this negation as an English sentence. Q4 (10 points) Consider the statement If an integer x is even, then x + 1 is odd. (a) Write this symbolically, using the same E(x) and O(x) open sentences as in the previous problem. (b) Write a negation of the statement, simplifying until no ~ remain (recall how if an integer is not even, then it is odd, and vice versa). (c) Write this negated statement as an English sentence.
Sri K.
Recommended Textbooks
University Physics with Modern Physics
Physics: Principles with Applications
Fundamentals of Physics
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD