NEW
Font size
WorksheetsBatch 3 - (09/01/2026)
Total questions: 35
Worksheet time: 19mins
What is the use of push operation in stack?
Insertion
Deletion
Display
Print the topmost element
What is the use of pop operation in a stack?
Insertion
Deletion
Display
Prints the topmost element in a stack
Only top element can be accessed in stack
TRUE
FALSE
Stacks have LIFO ordering
TRUE
FALSE
Which of them is an abstract data structure (ADT)?
A) Stacks
B) Queues
Both A and C
C) Functions
LIFO stands for
Last in First Out
First in Last Out
List of Outputs
None of them
Act of adding values into a stack is called
Popping
Pushing
Polling
None
Which of the following statement(s) about stack data structure is/are NOT correct?
Stack data structure can be implemented using linked list
New node can only be added at the top of the stack
The last node at the bottom of the stack has a NULL link
HIDE ANSWER
Stack is the FIFO data structure
If the elements “A”, “B”, “D” and “C” are placed in a stack and are deleted one at a time, in what order will they be removed?
ABCD
ABDC
CDBA
DCAB
Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the no of element present on stack are
1
3
2
4
In a stack, if a user tries to remove an element from empty stack it is called _________
Underflow
Empty collection
Overflow
Garbage Collection
Which one of the following is an application of Stack Data Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All of the above
List of data in which element can be inserted and removed at the same end is called as __________.
array
stack
linked list
queue
What is the time complexity of this code
int a = 0, i = N;
while (i > 0)
{
a += i;
i /= 2;
}
O(N)
O(Sqrt(N))
O(N / 2)
O(log N)
The complexity of Binary search algorithm is
O(n)
O(log n)
O(n2)
O(n log n)
What is the time complexity of following code:
int a = 0;
for (i = 0; i < N; i++) {
for (j = N; j > i; j--) {
a = a + i + j;
}
}
O(N)
O(N*log(N))
O(N * Sqrt(N))
O(N*N)
What is the time complexity of following code:
int i, j, k = 0;
for (i = n / 2; i <= n; i++) {
for (j = 2; j <= n; j = j * 2) {
k = k + n / 2;
}
}
O(n)
O(nLogn)
O(n^2)
O(n^2Logn)
2. How does a binary search algorithm works?
Dividing the list into halves until the item is matched with one in the list.
Starts with the first element and checks the next element consecutively until a match is found.
None of the above
3. An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?
32
8
16
5
4. An array with 32 elements is input to a linear search algorithm. How many maximum number of comparisons are performed?
32
8
16
5
5. How is the midpoint of the list calculated in binary search?
midpoint= round ((first_element+last_element)/2)
midpoint= round ((lower_bound+upper_bound)/2)
midpoint=(lower_bound+upper_bound)/2
midpoint= round ((lower_bound+upper_bound))
6. Complete the sentence: In binary search, the lower half of the list is discarded if the value at midpoint is …………………….. item searched.
less than
equal to
greater than
7. True or False: In binary search, the upper half of the list is discarded if the value at midpoint is greater than item searched.
true
false
What is the other name for a postfix expression?
a) Normal polish Notation
b) Reverse polish Notation
c) Warsaw notation
d) Infix notation
What is the result of the given postfix expression? abc*+ where a=1, b=2, c=3.
a) 4
b) 5
c) 6
d) 7
What is the result of the following postfix expression?
ab*cd*+ where a=2,b=2,c=3,d=4.
a) 16
b) 12
c) 14
d) 10
Consider the stack
| 5 |
| 4 |
| 3 |
| 2 |.
At this point, ‘*’ is encountered. What has to be done?
a) 5*4=20 is pushed into the stack
b) * is pushed into the stack
c) 2*3=6 is pushed into the stack
d) * is ignored
Evaluate the postfix expression ab + cd/- where a=5, b=4, c=9, d=3.
a) 23
b) 15
c) 6
d) 10
A node in a doubly linked list has at least _____ fields
4
2
3
5
What does it mean when we say that an algorithm X is asymptotically more efficient than Y?
X will always be a better choice for small inputs
X will always be a better choice for large inputs
Y will always be a better choice for small inputs
X will always be a better choice for all inputs
If for an algorithm time complexity is given by O(n) then complexity of it is:
constant
linear
exponential
none of the mentioned
Which of the following case does not exist in complexity theory?
Best case
•Worst case
•Average case
Null case
•The worst case complexity for insertion sort is _________
•
O(n)
•
O(log n)
•O(n2)
•O(n log n)
•If for an algorithm time complexity is given by O(1) then complexity of it is:
•constant
•polynomial
•exponential
•none of the mentioned
