Quick Revision

GK One-Line Question & Answer

15541+ short questions with short answers, covering every category and sub-category on the site — no long articles to scroll through. Good for a fast recap before an exam, or a few minutes of daily practice.

Data Structures and Algorithms → Sorting Algorithms 1

In insertion sort, what does pos=pos-1 do?
Moves position left to find insertion spot
click to copy

Data Structures and Algorithms → Stack 10

Stack follows which principle?
LIFO
click to copy
Stack is used in compilers for?
Syntax parsing
click to copy
Stack is used for undo/redo in?
Text editors and IDEs
click to copy
In stack using linked list, new node is added at?
Tail (last node)
click to copy
Which notation does stack evaluate naturally?
Postfix (Reverse Polish)
click to copy
Stack Underflow in linked list stack returns:
-1000
click to copy
Maximum elements in stack of size n after n pushes?
n
click to copy
In push(s,n) when stack empty: S.head=n and S.top=?
n
click to copy
Which application uses stack for backtracking?
Browser back/forward navigation
click to copy
Stack type — linear or non-linear?
Linear
click to copy

Data Structures and Algorithms → Introduction to DSA 19

Operation to add element to stack?
Push
click to copy
Operation to remove element from stack?
Pop
click to copy
Python list method to push onto stack?
append()
click to copy
Python list method to pop from stack?
pop()
click to copy
Error when popping from empty stack?
Stack Underflow
click to copy
Error when pushing to full array-based stack?
Stack Overflow
click to copy
What does peek() do on a stack?
Returns top without removing
click to copy
Time complexity of push and pop on a stack?
O(1)
click to copy
Real-world example of a stack?
Pile of plates
click to copy
Evaluate postfix '2 3 + 4 *':
20
click to copy
Minimum stacks needed to implement a queue?
2
click to copy
Infix A+B*C in postfix is?
ABC*+
click to copy
Evaluate postfix '5 1 2 + 4 * + 3 -':
14
click to copy
When top==null in stack?
Stack is empty
click to copy
What does IS_EMPTY check in a stack?
S.top==null
click to copy
Activation record of a function is stored in?
Stack memory (call stack)
click to copy
After push(10),push(20),push(30),pop() — top is?
20
click to copy
Operation to add element to queue?
Enqueue
click to copy
Operation to remove element from queue?
Dequeue
click to copy

Data Structures and Algorithms → Recursion 1

In recursion, each recursive call:
Adds frame to call stack
click to copy

Data Structures and Algorithms → Graphs 1

DFS uses which data structure?
Stack
click to copy

Data Structures and Algorithms → Linked List 1

In linked list stack, when list empty after pop, top and head are:
Both set to NULL
click to copy

Data Structures and Algorithms → Queue 7

Queue follows which principle?
FIFO
click to copy
New elements in queue are inserted at?
Rear (tail)
click to copy
Elements removed from queue from?
Front (head)
click to copy
Queue Overflow means?
Add to full queue
click to copy
Queue Underflow means?
Dequeue from empty queue
click to copy
In circular queue, when tail reaches last position, it wraps to?
1 (beginning)
click to copy
Array-based queue is empty when?
Q.tail==Q.head
click to copy