WorksheetsEmployability Skills-II
Total questions: 30
Worksheet time: 17mins
What is a stack in data structure?
A stack is a linear data structure that follows the Last In, First Out (LIFO) principle.
A stack is a non-linear data structure.
A stack is a data structure that allows random access to elements.
A stack is a data structure that follows the First In, First Out (FIFO) principle.
Explain the concept of LIFO in the context of stacks.
LIFO in stacks means Last In, Last Out.
LIFO in stacks means Last In, First Out.
FIFO in stacks means First In, First Out.
LIFO in stacks means First In, Last Out.
What are the two primary operations that can be performed on a stack?
insert and delete
push and pop
add and remove
push and peek
What does the push operation do in a stack?
Reverses the order of elements in the stack.
Multiplies two elements in the stack.
Removes an element from the bottom of the stack.
Adds a new element to the top of the stack.
Explain the pop operation in a stack.
The pop operation in a stack removes the top element from the stack.
The pop operation in a stack rearranges the elements in the stack.
The pop operation in a stack removes the bottom element from the stack.
The pop operation in a stack adds an element to the top of the stack.
How is the top element of a stack accessed?
By using the remove() method
By using the peek() method
By pushing a new element
By popping the element
What happens when you try to pop from an empty stack?
An error indicating the stack is empty
The stack grows infinitely
The popped element is set to null
The stack is automatically resized
Can a stack be implemented using arrays? If yes, how?
Yes, a stack can be implemented using arrays.
No, a stack cannot be implemented using arrays.
Yes, a stack can be implemented using trees.
Yes, a stack can only be implemented using linked lists.
Discuss the importance of stacks in computer science.
Stacks are crucial in computer science due to their LIFO nature, aiding in various applications like function calls, expression evaluation, backtracking, and undo functionalities.
Stacks are rarely used in computer science
Stacks are primarily used for sorting algorithms in computer science
Stacks are only applicable in specific niche areas of computer science
Give an example of a real-life scenario where a stack data structure can be used.
Organizing a to-do list
Managing browser history
Tracking inventory in a warehouse
Storing user login information
A Queue is a Non - linear structure .
True
False
In ____ structure the First In First Out order is followed.
Stack
Queue
Linked List
Graph
In queue addition will take place in the ____
Top
Front
Rear
None
•The process to add an element into queue is called ____
Enqueue
Dequeue
Listing
None
______ is also called Ring Buffer
Queue
Stack
Array
Circular Queue
What is the time complexity to access an element in an
array using an index?
O(1)
O(n)
O(log n)
O(n log n)
Which of the following correctly describes the way arrays
are stored in memory?
Randomly
Contiguously
Non-contiguously
None of the above
Given an array int arr[5] = {1, 2, 3, 4, 5};, what will be the
value of arr[2]?
1
2
3
4
What is the main advantage of a linked list over an array?
Fixed size
Easier access to elements using an index
Dynamic size
Faster access to elements
Which of the following is not a type of linked list?
Singly linked list
Doubly linked list
Circular linked list
Triply linked list
What does each node in a singly linked list contain?
Data only
Data and a reference to the next node
Data and references to both the next and previous nodes
Data and a reference to the previous node
In a circular linked list, the last node points to:
The first node
The middle node
A null value
The previous node
Which of the following statements is true about a doubly
linked list?
Each node has only one link field.
The list can only be traversed in one direction.
Each node contains a link to the previous node and the next node.
The last node points to the head node.
In ____________ data structure, the data items are arranged in a linear sequence.
linear
non linear
both a and b
all of above
In ___________ data structure data items are not in sequence.
non linear
linear
non-homogeneous
all of above
____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.
linear
homogeneous
static
dynamic
Every stack has a variable _________ associated with it.
TOP
BOT
POT
none of the above
_________ operation adds an element to the top of the stack.
pop
push
peep
all of the above
A function calls itself is called ___________.
queue
recursion
function
none of above
A queue is a _________ data structure in which each element that was inserted first is the first one to be taken out.
FITO
FIFO
FISO
FIVO
