Question Bank Unit-2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

R C Patel Institute of Technology, Shirpur

Department of Electronics and Telecommunication


Data structure and Algorithm using Java Programming
Question Bank for Unit-2
Prepared by: Prof N L Lokhande Sub Code: BTEXPE506C Date: 04/09/2019

Multiple choice questions (One mark Question)


Q1 Process of inserting an element in stack is called
A Create
B Push
C Evaluation
D Pop

Q2 Process of removing an element from stack is called


A Create
B Push
C Evaluation
D Pop

Q3 In a stack, if a user tries to remove an element from empty stack it is called


A Underflow
B Empty collection
C Overflow
D Garbage Collection

Q4 Pushing an element into stack already having five elements and stack size of 5 , then stack becomes
A Overflow
B Crash
C Underflow
D Userflow

Q5 Entries in a stack are “ordered”. What is the meaning of this statement?


A A collection of stacks is sortable
B Stack entries may be compared with the ‘<‘ operation
C The entries are stored in a linked list
D There is a Sequential entry that is one by one

Q6 Which of the following applications may use a stack?


A A parentheses balancing program
B Tracking of local variables at run time
C Compiler Syntax Analyzer
D All of the mentioned

Q7 The postfix form of the expression (A+ B)*(C*D- E)*F / G is?


A AB+ CD*E – FG /**
B AB + CD* E – F **G /
C AB + CD* E – *F *G /
D AB + CDE * – * F *G /

Q8 The postfix form of A*B+C/D is?


A *AB/CD+
B AB*CD/+
C A*BC+/D
D ABCD+/*
Q9 The prefix form of an infix expression p + q – r * t is?
A + pq – *rt
B – +pqr * t
C – +pq * rt
D – + * pqrt

Q10 If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the
order of removal?
A ABCD
B DCBA
C DCAB
D ABDC

Q11 A linear list of elements in which deletion can be done from one end (front) and insertion can take
place only at the other end (rear) is known as a ?
A Queue
B Stack
C Tree
D Linked list

Q12 The data structure required for Breadth First Traversal on a graph is?
A Stack
B Array
C Queue
D Tree

Q13 A Queue is a abstract data type


A True
B False

Q14 A queue follows


A FIFO (First In First Out) principle
B LIFO (Last In First Out) principle
C Ordered array
D Linear tree

Q15 Circular Queue is also known as


A Ring Buffer
B Square Buffer
C Rectangle Buffer
D Curve Buffer

Q16 If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what
order will they be removed?
A ABCD
B DCBA
C DCAB
D ABDC

Q17 A data structure in which elements can be inserted or deleted at/from both the ends but not in the
middle is?
A Queue
B Circular queue
C Dequeue
D Priority queue
Q18 A normal queue, if implemented using an array of size MAX_SIZE, gets full when
A Rear = MAX_SIZE – 1
B Front = (rear + 1)mod MAX_SIZE
C Front = rear + 1
D Rear = front

Q19 Queues serve major role in


A Simulation of recursion
B Simulation of arbitrary linked list
C Simulation of limited resource allocation
D Simulation of heap sort

Q20 Which of the following is not the type of queue?


A Ordinary queue
B Single ended queue
C Circular queue
D Priority queue

Short Answer Questions (Three marks questions.)


Q1 What is stack? How it is different from other linear data structures?
Q2 Explain various notations that are used for expressing arithmetic expressions
Q3 Write an algorithm to implement a stack using array.
Q4 Explain similarities and differences between stack and queue.
Q5 What is priority queue? Write down the applications of priority queue.

Long Answer Questions (Eight marks questions.)


Q1 Discuss any three applications of stack with suitable examples
Q2 Write an algorithm to convert
a) infix expression to postfix expression
b) infix expression to prefix expression
Q3 Write an algorithm to insert and delete a node from a queue

You might also like