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

Data Structure and Algorithm Question Format

The document is a 50 mark question paper for a data structure and algorithm lab exam containing various types of questions including match the pair, true/false, fill in the blanks, and multiple choice questions. It tests concepts related to data structures like arrays, stacks, queues, linked lists, trees, and graphs as well as algorithms like searching, sorting, and traversal techniques.

Uploaded by

Anuj Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Data Structure and Algorithm Question Format

The document is a 50 mark question paper for a data structure and algorithm lab exam containing various types of questions including match the pair, true/false, fill in the blanks, and multiple choice questions. It tests concepts related to data structures like arrays, stacks, queues, linked lists, trees, and graphs as well as algorithms like searching, sorting, and traversal techniques.

Uploaded by

Anuj Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

Data Structure and Algorithm Lab

Question Paper (50 Marks)

Match the Pair: (2 Questions X 3 Marks each = 6 Marks)

1)

Column A Column B
A) Depth first Search i. Heap
B) Breadth first Search ii. Stack
C) Sorting iii. Queue
iv. Array
Solution: A-iii, B-ii, C-i

2) Match the properties of an array with their description

Column A Column B
D) Homogeneous v. there is a first and last
element 
E) Finite vi. the list size is constant
F) Fixed length vii. every element is the
same.
viii.
Solution: D-vii, E-v, F-vi

True or False: (6 Questions X 1 Mark each = 6 Marks)

1) Conversion from infix to postfix is an application of Queue?


Solution: False
2) A graph with no cycle is tree?
Solution: True
3) An empty tree is also a binary tree
Solution: True
4) Every graph has only one minimum spanning tree.
Solution: False
5) Each node of a singly linked list has at least three components.
Solution: False
6) In general, there are three types of linked lists and they are: sorted, unsorted and mixed.
Solution: False

Page 1 of 8
Fill in the blanks: (8 Questions X 1 Mark each = 8 Marks)

1) Any one application of stacks ____________


Solution: Recursion, Evaluation of postfix
2) One Application of Circular Queue __________
Solution: Round Robin.
3) A graph with no cycle is called ________ Graph.
Solution: Acyclic
4) Depth First Search (DFS) is implemented using data structure _________
Solution: stack
5) In trees, Nodes whose outdegree is 0 are called as ____________ nodes
Solution: leaf
6) The function that calls itself is called ____________ Function
Solution: Recursive
7) For a binary search algorithm, it is necessary that the array (list) must be _________
Solution: sorted
8) _____ refers to a situation when one tries to enqueue an item in a queue that is full.
Solution: Overflow

Multiple Choice Questions: (30 Questions X 1 Mark each = 30 Marks)


Question 1 The data structure required For Breadth First Traversal on a graph is?

Option (A) Stack

Option (B) Queue

Option (C) Array

Option (D) Tree

Correct Answer/Solution: b.

Question 2 The condition FRONT==NULL represent that the queue is


Option (A) Empty
Option (B) Full
Option (C) overflow
Option (D) None of the above
Correct Answer/Solution: a.

A data structure in which elements can be inserted or deleted


Question 3 at/from both the ends but not in the middle is?
Option (A) Queue
Option (B) Dequeue

Page 2 of 8
Option (C) Circular Queue
Option (D) Priority Queue
Correct Answer/Solution: c.

Question 4 Which of the following is not a internal sort?


Option (A) Insertion Sort
Option (B) Bubble Sort
Option (C) Merge Sort
Option (D) Selection Sort
Correct Answer/Solution: c.

Question 5 Which of the following is not a user defined DS?


Option (A) Array
Option (B) Linklist
Option (C) Stack
Option (D) Queue
Correct Answer/Solution: a.

Given an int array A[3:7] having base address 726 find the
Question 6
address of A[5] (consider int is of 2 bytes)
Option (A) 728
Option (B) 729
Option (C) 730
Option (D) 731
Correct Answer/Solution: c.

Which of the following data structure is more


Question 7
appropriate to represent a heap?
Option (A) Two-dimensional array
Option (B) Doubly linked list
Option (C) Linked list
Option (D) Linear Array
Correct Answer/Solution: d.

Question 8 Which is best sorting algorithm when the list is already sorted?
Option (A) Bubble
Option (B) Insertion
Option (C) Heap
Option (D) Quick

Page 3 of 8
Correct Answer/Solution: b.

Question 9 In Queue, items are deleted from


Option (A) Front
Option (B) Rear
Option (C) Top
Option (D) None
Correct Answer/Solution: b.

Question 10 Direct or random access of elements is not possible in


Option (A) Link List
Option (B) Array
Option (C) String
Option (D) None
Correct Answer/Solution: a.

Question 11 Push() and Pop() functions are found in


Option (A) Queue
Option (B) List
Option (C) Stack
Option (D) Trees
Correct Answer/Solution: c.

Question 12 What is the advantage of Array over link list data structure?
Option (A) Element of an array cannot be sorted
Option (B) Size can be changed
Option (C) Elements of mixed data types can be stored
Option (D) Elements can be easily accessed
Correct Answer/Solution: d.

Question 13 Which of the following is method of graph traversal?


Option (A) Breadth First Search
Option (B) Depth First Search
Option (C) Both
Option (D) None
Correct Answer/Solution: c.

Question 14 The elements of a linked list are stored

Page 4 of 8
Option (A) In conti guous memory locati ons
Option (B) In an array
Option (C) In a structure
Option (D) Anywhere the computer has space for them
Correct Answer/Solution: c.

Question 15 Graph traversal is different from a tree traversal, because


Option (A) Trees are not connected
Option (B) Graphs may have loops
Option (C) Trees have root
Option (D) None
Correct Answer/Solution: c.

Question 16 An array can be ________ type


Option (A) Single Dimension
Option (B) Two-Dimensional
Option (C) Three- Dimensional
Option (D) All of the above
Correct Answer/Solution: d.

how matrix is stored in memory using column order: a b c


Question 17 d e f
g h i
Option (A) abcdefghi
Option (B) cfibehadg
Option (C) gdabehfc
Option (D) adgbehcfi
Correct Answer/Solution: d.

Question 18 Visiting root node after visiting left and right sub-trees is called
Option (A) In-order traversal
Option (B) Pre-order traversal
Option (C) Post- order traversal
Option (D) None
Correct Answer/Solution: c

A parentheses checker program would be best


Question 19
implemented using
Option (A) List

Page 5 of 8
Option (B) Queue
Option (C) Stack
Option (D) Any of the above
Correct Answer/Solution: c.

Question 20 Which of the following is the non-linear data structure?


Option (A) Stack
Option (B) List
Option (C) Array
Option (D) Trees
Correct Answer/Solution: d.

Question 21 Which of the following is a collection of similar data types?


Option (A) Strings
Option (B) Array
Option (C) Both
Option (D) None
Correct Answer/Solution: b.

Question 22 The conditions to detect, queue is full and queue is empty will be:
Option (A) Full: (REAR+1) mod n == FRONT, Empty: REAR == FRONT
Option (B) Full: (REAR+1) mod n == FRONT, Empty: (FRONT+1) mod n ==
REAR
Option (C) Full: (FRONT+1) mod n == REAR, Empty: REAR == FRONT
Option (D) Full: REAR == FRONT, Empty: (REAR+1) mod n == FRONT
Correct Answer/Solution: a.

Question 23 What will be the value of top, if the size of stack is 7


Option (A) 7
Option (B) 8
Option (C) 6
Option (D) None
Correct Answer/Solution: c.

Which of the following sorting algorithm is of divide and conquer


Question 24 type?
Option (A) Bubble sort
Option (B) Insertion sort
Option (C) Merge sort

Page 6 of 8
Option (D) Selection sort
Correct Answer/Solution: c.

Question 25 On which principle stack works


Option (A) FILO
Option (B) FIFO
Option (C) LIFO
Option (D) Both A and C
Correct Answer/Solution: a

A 2-D Array is represented as A[3:5 , 5:7] , The total number of


Question 26
elements in it are
Option (A) 12
Option (B) 35
Option (C) 4
Option (D) 9
Correct Answer/Solution: d.

Question 27 Binary search algorithm cannot be applied to


Option (A) sorted linked list
Option (B) sorted binary trees
Option (C) sorted linear array
Option (D) pointer array
Correct Answer/Solution: c.

Question 28 Finding the location of the element with a given value is

Option (A) Traversal


Option (B) Search
Option (C) Sort
Option (D) None of the above
Correct Answer/Solution: b.

Suppose the numbers 7,5,1,3,6,0,4,2 are inserted in this order to


Question 29 an initially empty binary search tree. What is the inorder traversal
of the tree
Option (A) 75103246
Option (B) 02431657

Page 7 of 8
Option (C) 01234567
Option (D) 64230157
Correct Answer/Solution: c.

Question 30 In linked lists, there are no null links in


Option (A) Single linked list
Option (B) Linear doubly linked list
Option (C) circular linked list
Option (D) None of the above
Correct Answer/Solution: c.

Page 8 of 8

You might also like