0% found this document useful (0 votes)
5 views

cs17201-ds-assignment-unit-i-q

This document is an assignment for the Data Structures course at Rajalakshmi Engineering College, focusing on stacks and queues. It includes multiple-choice questions, matching exercises, and fill-in-the-blank tasks related to data structure concepts. The assignment aims to assess students' understanding of stack and queue operations, applications, and related terminologies.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

cs17201-ds-assignment-unit-i-q

This document is an assignment for the Data Structures course at Rajalakshmi Engineering College, focusing on stacks and queues. It includes multiple-choice questions, matching exercises, and fill-in-the-blank tasks related to data structure concepts. The assignment aims to assess students' understanding of stack and queue operations, applications, and related terminologies.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

RAJALAKSHMI ENGINEERING COLLEGE

Thandalam, Chennai – 602 105


Department of Computer Science and Engineering
CS17201–DATA STRUCTURES
Unit-I-Assignment

Reg. No. : Name :

Year : Branch: Section:

I. Choose the best answer:

1. Which of the following is not true for stacks?


(a)It is a linear data structure.
(b)It allows insertion/deletion of elements only at one end
(c)It is widely used by systems processes, such as compilation and program control
(d)It is based on First-In-First-Out principle

2. Which of the following is not an example of a stack?


(a)Collection of tiles one over another
(b)A set of bangles worn by a lady on her arm
(c)A line up of people waiting for the bus at the bus stop
(d)A pileup of boxes in a warehouse one over another

3. Tower of Hanoi can be regarded as a problem of which of the following data structures?
(a)Stack
(b)Queue
(c)Graph
(d)Tree

4. Recursive function calls are executed using which of the following data structures?
(a)Stack
(b)Queue
(c)Graph
(d)Tree

5. If 2, 1, 5, 8 are the stack contents with element 2 being at the top of the stack, then what will
be the stack contents after following operations:
Push (11)
Pop ( )
Pop ( )
Pop ( )
Push(7)
(a)11, 2, 1
(b)8, 11, 7
(c)7, 5, 8
(d)5, 8, 7
6. Which of the following is best suitable for storing a simple collection of employee records?
(a)Stack
(b)Queue
(c)Array
(d)None of the above

7. If ‘top’ points at the top of the stack and ‘stack []’ is the array containing stack elements, then
which of the following statements correctly reflect the Push Operation for inserting ‘item’ into
the stack?
(a)top = top + 1; stack [top] = item;
(b)stack [top] = item; top = top + 1;
(c)stack [top++] = item;
(d)Both (a) and (c) are correct

8. If ‘top’ points at the top of the stack and ‘stack []’ is the array containing stack elements, then
which of the following statements correctly reflect the pop operation?
(a)top = top – 1; item = stack [top];
(b)item = stack [top]; top = top – 1;
(c)item = stack [--top];
(d)Both (b) and (c) are correct

9. If a pop operation is performed on an empty stack, then which of the following situations will
occur?
(a)Overflow
(b)Underflow
(c)Array out of bound
(d)None of the above

10. Which of the following is not a stack application?


(a)Recursion control
(b)Expression evaluation
(c)Message queuing
(d)All of the above are stack applications

11. Which of the following statements is not true for queues?


(a)It is a linear data structure.
(b)It allows insertion/deletion of elements only at one end.
(c)It has two ends front and rear.
(d)It is based on First-In-First-Out principle.

12. Which of the following statements is not an example of a queue?


(a)Collection of tiles one over another.
(b)A queue of print jobs.
(c)A line up of people waiting for the bus at the bus stop.
(d)All of the above are queue examples.

2 B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai


13. CPU scheduler can be implemented by which of the following data structures?
(a)Stack
(b)Queue
(c)Graph
(d)Tree

14. Which of the following is a type of a queue?


(a)Circular queue
(b)Priority queue
(c)Double-ended queue
(d)All of the above

15. If 1, 2, 3, 4 are the queue contents with element 1 at the front and 4 at the rear, then what will
be the queue contents after following operations:
Insert (5)
Delete ( )
Delete ( )
Delete ( )
Insert (6)
Insert (–1)
Delete ( )
(a)5, 6, –1
(b)4, 5, 6, –1
(c)1, 2, 6
(d)1, 2, 6, –1

16. Which of the following is best suitable for implementing a print scheduler?
(a)Stack
(b)Queue
(c)Array
(d)None of the above

17. If ‘front’ points at the front end of the queue, ‘rear’ points at the rear end of the queue and
‘queue []’ is the array containing queue elements, then which of the following statements
correctly reflects the insert operation for inserting ‘item’ into the queue?
(a)rear = rear + 1; queue [rear] = item;
(b)front = front + 1; queue [front] = item;
(c)queue [rear++] = item;
(d)Both (a) and (c) are correct

18. If ‘front’ points at the front end of the queue, ‘rear’ points at the rear end of the queue and
‘queue []’ is the array containing queue elements, then which of the following statements
correctly reflects the delete operation for deleting an element from the queue?
(a)item = queue [rear]; rear = rear + 1;
(b)item = queue [front]; front = front + 1;
(c)item = queue [++front];
(d)Both (b) and (c) are correct

B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai 3


19. If a delete operation is performed on an empty queue, then which of the following situations
will occur?
(a)Overflow
(b)Underflow
(c)Array out of bound
(d)None of the above

20. Which of the following is not a queue application?


(a)Recursion control
(b)CPU scheduling
(c)Message queuing
(d)All of the above are queue applications

ANSWERS

1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

II. Place me in the basket:

Stack Queue Double Notations


Ended Queue

Following words are to be placed in the relevant basket:

Push Enqueue Infix EnqueueFront


Pop Dequeue DequeueRear Prefix
Peek DequeueFront EnqueueRear Postfix

III. Match me:

Column A Column B
Infix +/ABC
Prefix AB/C+
Postfix A/B+C

4 B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai


IV. Balance me:

(a+b)

Stack is __________ 

((a+b)

Stack is __________ 

(a+b))

Stack is __________ 

(a+b]

Not corresponding to the _________________________ 

B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai 5


V. Complete me:

Classification of Data Structures

VI. Match me:

Column A Column B

Queue Overflow

Queue Underflow

Stack Overflow

Stack Underflow

6 B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai


VII. Complete me:

Push(50) Enqueue(50) Enqueue(50)

VIII. Complete me:

Pop() Dequeue() Dequeue()

IX. Evaluate me:

7 8 + 3 2 + /

B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai 7


X. Fill me:

8 B.BHUVANESWARAN | AP (SG) | CSE | Rajalakshmi Engineering College | Chennai

You might also like