(Module-2) (Basic Programming Using Data Structure) Qbank
(Module-2) (Basic Programming Using Data Structure) Qbank
Questions Marks CO BT By
1 Section-A L
1. What is a stack? 2 2 1 A
CP
2. What is a queue? 2 2 1 A
CP
3. What is a priority queue? 2 2 1 A
CP
4. What is a linear queue? 2 2 1 A
CP
5. What is a circular queue? 2 2 1 A
CP
6. Define ADT. 2 2 1 A
CP
7. Differentiate STACK and QUEUE. 2 2 1 A
CP
8. Differentiate LIFO and FIFO. 2 2 1 A
CP
9. Differentiate Linear Queue and Circular Queue. 2 2 1 A
CP
10. Differentiate Queue and Priority Queue. 2 2 1 A
CP
11. List out at least 4 applications of Stack. 2 2 1 A
CP
12. List out at least 4 applications of Queue. 2 2 1 A
CP
13. What are infix, prefix and postfix notations? 2 2 1 A
CP
14. Convert the Following infix expression to postfix notation step by step 2 2 1 A
CP
((A+B*(C-D))/E+F)*G
15. Convert the Following infix expression to prefix notation step by step 2 2 1 A
CP
((A+B*(C-D))/E+F)*G
16. Differentiate prefix notation and postfix notation. 2 2 1 A
CP
17. Write algorithm for push () function of stack. 2 2 1 A
CP
18. Write algorithm for pop () function of stack. 2 2 1 A
CP
19. Write algorithm for peak ()/getTop () function of stack. 2 2 1 A
CP
20. How to know that a stack is either full or empty? 2 2 1 A
CP
21. Evaluate the following postfix expression: 2 2 1 A
ABC*D/+E- CP
Where A= 1, B= 2, C= 8, D= 4, E= 7
Basic Programming Using Data Structure (Module – 2, Stacks and Queues) Page 1
22. Suppose stack content is: 3 4 (from top to bottom) 2 2 1 A
CP
Then, what output pop( ) - pop( ) will generate?
23. W.r.t. a stack with max size 4: push(12), push(34), push(56), push(78), 2 2 1 A
push(90), pop(), pop(), peak(), push(100) CP
What shall be the stack status after the above specified operations?
24. What is “stack overflow” and “stack underflow”? 2 2 1 A
CP
25. Write a C code to insert all the characters of a string into a stack. 2 2 1 A
CP
26. What is Print Queue? 2 2 1 A
CP
27. What is a double ended queue (deque)? 2 2 1 A
CP
28. Perform the operations Enqueue(10), enqueue(20), enqueue(15), dequeue(), 2 2 1 A
enqueue(22), dequeue(), enqueue(13), enqueue(16), dequeue() w.r.t. priority CP
queue. At last display the queue status from front to rear.
29. Perform the operations Enqueue(10, ‘f’), enqueue(20, ‘r’), enqueue(15, ‘r’), 2 2 1 A
dequeue(‘f’), enqueue(22,’f’), dequeue(‘r’), enqueue(13, ‘r’), enqueue(16, CP
‘f’), dequeue(‘r’) w.r.t. a deque. At last display the queue status from front
to rear.
Basic Programming Using Data Structure (Module – 2, Stacks and Queues) Page 2
41. What is the operator found in infix expression but not found in 2 2 1 A
postfix/prefix expression? Explain. CP
42. A
CP
2 BT
Section B L
1. Write an algorithms for push, pop and peak operations for a stack. 6 2 2 A
CP
2. Write algorithms for enqueue and dequeue operations in stack. 6 2 2 A
CP
3. Briefly discuss all the types of Queues. 6 2 2 A
CP
4. List out at least 6 applications of stack with minimal descriptions. 6 2 2 A
CP
5. List out at least 6 applications of queue with minimal descriptions. 6 2 2 A
CP
6. Write an algorithm for enqueue() operation of a priority queue. 6 2 2 A
CP
7. Write a C program for parenthesis matching. 6 2 2 A
CP
8. Write algorithm for enqueue and dequeue operation in a priority queue. 6 2 2 A
CP
9. Write an algorithm for parenthesis matching. 6 2 2 A
CP
10. Define push() and pop() functions of a stack using C. 6 2 2 A
CP
11. Define enqueue() and dequeue() functions of a queue using C. 6 2 2 A
CP
12. Define enqueue() and dequeue() function of a priority queue using C. 6 2 2 A
CP
13. Write an algorithm reverse a string using stack. 6 2 2 A
CP
14. Write a C program to enqueue an element into a deque. 6 2 2 A
CP
15. Write a C program to dequeue an element into a deque. 6 2 2 A
CP
16. Demonstrate the few push and pop operations w.r.t. a stack 6 2 2 A
diagrammatically.(Show the status of top at every step) CP
17. Demonstrate the few enqueue and dequeue operations w.r.t. a linear queue 6 2 2 A
diagrammatically. (Show the status of rear and front counter at every step) CP
18. Demonstrate the 6 enqueue and 3 dequeue operations w.r.t. a circular queue 6 2 2 A
(with maximum capacity of 5 elements) diagrammatically. (Show the status CP
of rear and front counter at every step)
Basic Programming Using Data Structure (Module – 2, Stacks and Queues) Page 3
3 Section C
8. Write a C program to create a main stack and divide the main stack into 8 2 3 A
two stacks such that one stack should contain only odd numbers and CP
another stack should contain only even numbers of the numbers pushed
into main stack.
9. Write a C program to create a stack and move the stack content to a queue. 8 2 3 A
CP
10. Design algorithms for different operations in deque. 8 2 3 A
CP
11. Write an algorithm and a C program to evaluate a postfix expression. 8 2 3 A
CP
12 Write a stack application with all basic functionalities, where the stack 8 2 3 A
contains set of floating point values. CP
13 Write a stack program to store all the digits of a number in the stack. 8 A
CP
14. Write a C program to add all the numbers present in a stack. (Make 8 A
sure that stack content should not be changed.) CP
15 Write a C program to find binary equivalent of an integer values 8 A
using stack. CP
4 Section D 4,5,
6
1. Write algorithm for converting an infix expression to postfix expression 10 2 4 A
CP
2. Write a C program to convert an infix expression to postfix equivalent. 10 2 4 A
an array.
3. 2 4 A
CP
Basic Programming Using Data Structure (Module – 2, Stacks and Queues) Page 4
demonstrate the status of postfix string and stack at every step.
Basic Programming Using Data Structure (Module – 2, Stacks and Queues) Page 5