Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which of the following is not a valid postfix expression? 5 4 + 6 5 4 + - 4 +

ID: 3805083 • Letter: 1

Question

1. Which of the following is not a valid postfix expression?

5 4 +

6 5 4 + -

4 + 5

8 2 + 2 /

all of the above are valid postfix expressions

2.

What is the result of evaluating the following postfix expression: 4 8 + 2 *

40

24

64

20

none of the above are correct

3.

What exception is thrown if the pop method is called on an empty stack?

EmptyStackException

NoSuchElementException

ArrayOutOfBoundsException

EmptyCollectionException

none of the above

4.

Which of the following methods removes an element from a queue?

enqueue

dequeue

first

pop

push

5.

Which of the following methods inserts an element into a stack data structure?

enqueue

dequeue

push

pop

peek

6.

A queue is helpful in implementing a __________________ sort.

insertion

selection

quick

radix

merge

5 4 +

6 5 4 + -

4 + 5

8 2 + 2 /

all of the above are valid postfix expressions

2.

What is the result of evaluating the following postfix expression: 4 8 + 2 *

40

24

64

20

none of the above are correct

Explanation / Answer

1) (c) 4+ 5 [because its an Infix expression]

2) 4 8 + 2 * . => 12 *2 = 24

3) EmptyStackException

4) dequeue removes element from queue . and enqueue adds elements into queue

5) push does the insertion and pop does the removal

6) We can say selection sort . Priority queue helps in implementing Heap Sort