Ch. 5 -- Stacks and Queues

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

the operation for adding an item to a stack is called a push (T / F)

true

the top operation does not modify the contents of a stack (T / F)

true

When using a linked implementation of a queue, where should insertions be done? a- at the front (head) of the linked list b- at the end (tail) of the linked list c- in the middle of the list d- either a) or b) will work

b

Which of the following is not an operation of the queue ADT? a- enqueue b- requeue c- front d- dequeue

b

What is the correct postfix form for 3 + 4 * 5? a- 3 4 * 5 + b- 3 4 + 5 * c- 3 4 5 * + d- 3 4 5 + *

c

Which implementation of a queue cannot guaranteed Θ(1) behavior for all operations a- a circular list/array implementation b- a linked implementation with front and back references c- a Python list implementation using insert and pop d- All of the above yield Θ(1) operations

c

Which of the following is not a stack operation? a- push b- top c- unstack d- pop

c

What is the result of evaluating the postfix expression 5 4 3 + 2 * -? a) -2 b) 3 c) 15 D) None of the above

d

Which of the following is not an application of a stack? a- Keeping track of command history for an "undo" feature b- Keeping track of function calls in running a program c- Checking for proper nesting of parentheses. d- All of the above

d

A queue allows for the inspection of items at either end (T / F)

false

a python list is not a very good choice for implementing a stack (T / F)

false

a queue implemented using the insert and pop operations on a python list will have 0(1) efficiency for all operations (T / F)

false

the operation to remove an item from the front of a queue is called front (T / F)

false

By definition, a queue must be a(n) a- LIFO structure b- FIFO structure c- linked structure d- array-based structure

b

Items come out of a stack in the same order they go in (T / F)

False

an expression has balanced parentheses if it contains an equal number of opening and closing parentheses (T / F)

False

By definition, a stack must be a(n) a- LIFO structure b- FIFO structure c- array-based structure d- linked structure

a

"Racecar" is a palindrome (T / F)

true

Items come out of a queue in the same order they go in (T / F)

true


Kaugnay na mga set ng pag-aaral

Test 3 Phys1310 Holtz Chapter 15

View Set

Chapter 24 Section 24.2-24.5 The Silk Road

View Set

Distractions and Deterrents of Educational Success End of Lesson Test

View Set

Business Communications: Ch. 1-6

View Set

Numerical Programming for Engineers

View Set