Define stack.
A linear data structure that follows the Last In First Out (LIFO) principle.
What is the primary operation of a queue?
To add elements at the back and remove elements from the front.
True or false: A stack allows insertion and deletion at both ends.
FALSE
A stack only allows operations at one end.
Fill in the blank: A queue is also known as a _______ data structure.
FIFO (First In First Out)
What does LIFO stand for?
Last In First Out, a principle of stack operations.
Define tuple.
An ordered collection of elements, which can be of different types.
True or false: Tuples are mutable in Python.
FALSE
Tuples cannot be changed after creation.
What is the main use of a stack?
To manage function calls and undo mechanisms in applications.
Fill in the blank: In a queue, the first element added is the first to be _______.
removed
What is a priority queue?
A type of queue where elements are removed based on priority rather than order.
Define enqueue.
The operation of adding an element to the back of a queue.
Define dequeue.
The operation of removing an element from the front of a queue.
True or false: Stacks can be implemented using arrays or linked lists.
TRUE
What is the top operation in a stack?
It retrieves the last element added without removing it.
Fill in the blank: A stack uses _______ to manage its elements.
push and pop operations
What is the length of a tuple?
The number of elements it contains.
True or false: A tuple can contain duplicate elements.
TRUE
What is the difference between a list and a tuple?
Lists are mutable, while tuples are immutable.
Define push.
The operation of adding an element to the top of a stack.
What does pop do in a stack?
Removes and returns the top element of the stack.
Fill in the blank: A deque is a double-ended _______.
queue
What is a circular queue?
A queue where the last position is connected back to the first.
True or false: Tuples can be nested within other tuples.
TRUE
What is the first operation in a queue?
Enqueue, which adds an element to the back.