MCS-021__merged

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

No.

of Printed Pages : 3 MCS–021


M. C. A. (REVISED)/B. C. A. (REVISED)
(MCA/BCA)
Term-End Examination
December, 2023
MCS-021 : DATA AND FILE STRUCTURES

Time : 3 Hours Maximum Marks : 100


Weightage : 75%

Note : (i) Question No. 1 is compulsory.


(ii) Attempt any three questions from the
rest.
(iii) All algorithms should be written near to
‘C’ language.

1. (a) What is an algorithm ? What is complexity


of an algorithm ? Explain trade off between
space and time complexity with the help of
an example. 8
(b) Write an algorithm for the following : 10
(i) Insert an element at the end of a
linked list
(ii) Delete an element from linked list
P. T. O.
[2] MCS–021

(c) What is a circular queue ? Explain how it


can be implemented using arrays. 10
(d) Write and explain Prim’s algorithm for
finding Minimum Cost Spanning Tree
(MCST). 12
2. (a) Write an algorithm for insertion sort.
Write step by step working of this
algorithm for sorting the following list of
data : 10
8, 10, 25, 8, 16, 27, 2, 45
(b) Draw AVL tree by inserting the following
elements one by one : 10
8, 13, 27, 9, 12, 15, 10, 35, 25
3. (a) Write an algorithm for adding two
polynomials. 10
(b) Explain indexed sequential file
organization with the help of an example.
10
4. (a) Traverse the following binary tree in pre-
order and post-order : 10
[3]

(b) What is a Red-Black tree ? Explain the


properties of Red-Black tree. Explain how
a node is inserted in a Red-Black tree. 10

5. (a) Write and explain algorithm for binary


search. Also, explain applications of binary
search. 10

(b) What is Breadth First Search (BFS) ?


Explain difference between BFS and Depth
First Search (DFS). 10

MCS–021
No. of Printed Pages : 3 MCS-021

M. C. A. (REVISED)/B. C. A. (REVISED)
(MCA/BCA)

Term-End Examination
June, 2023
MCS-021 : DATA AND FILE STRUCTURES

Time : 3 Hours Maximum Marks : 100

Weightage : 75%

Note : (i) Question No. 1 is compulsory.


(ii) Attempt any three questions from the
rest.
(iii) All algorithms should be written near to
‘C’ language.

1. (a) Write an algorithm for multiplication of


two n × n matrices. Calculate both time
and space complexity for this algorithm. 10

(b) What is a sparse matrix ? Write an


algorithm that accepts a 6 × 5 sparse
matrix and output 3-tuple representation,
of the matrix. 10

P. T. O.
[2] MCS-021

(c) Write an algorithm for array imple-


mentation of linked list. 10
(d) What is a binary search ? Write an
algorithm for binary search and find its
complexity. 10

2. (a) What is a Splay Tree ? Explain how is it


different from a binary tree. 10
(b) Traverse the following binary tree in Pre-
order and In-order : 10

3. (a) Explain Quick sort algorithm. Sort the


following set of data using this algorithm.
Show intermediate steps of sorting : 10
20, 6, 8, 19, 36, 4, 28, 50
(b) What is an Indexed Sequential File
Organization ? How is it different from
direct file organisation ? Explain. 10
[3]

4. (a) What is a spanning tree ? What are its


applications ? Write Kruskal’s algorithm to
find minimum cost spanning tree and
explain it in terms of its complexity. 10
(b) Define AVL tree. Write any two
applications of AVL tree. 10

5. (a) Write algorithms for the following : 10


(i) To create doubly linked list.
(ii) To delete an element from a doubly
linked list.
(b) What is a stack ? Explain PUSH and POP
operations of stack with the help of
algorithms for each operation. 10

MCS–021
No. of Printed Pages : 3 MCS-021

MCA (Revised) / BCA (Revised)


Term-End Examination
June, 2022

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written near to ‘C’ language.

1. (a) What is an Algorithm ? Explain properties


of an algorithm. Explain time complexity
and space complexity of an algorithm, with
the help of a suitable example. 10
(b) Write Kruskal’s algorithm. For the graph
given below, show the various steps
involved in construction of Minimum Cost
Spanning Tree using Kruskal’s algorithm. 10

MCS-021 1 P.T.O.
(c) Write a ‘C’ program for insertion and
deletion of node in a link list. 10

(d) Write Preorder and Postorder traversal of


the tree given below : 10

2. (a) What is Circular Queue ? Write an


algorithm to add an element and delete an
element in a circular queue. 10

(b) Write Breadth-first search algorithm. 5

(c) Explain Direct File Organisation. 5

3. (a) Write an algorithm to check whether stack


is empty or not. 5

(b) Describe Big ‘O’ and ‘’ notations. 5

(c) What is Red-Black Tree ? Explain the


properties of Red-Black Tree. 10

4. (a) Define AVL Tree. Write the algorithm to


insert a node into an AVL tree and delete a
node from an AVL tree. 10

MCS-021 2
(b) Write Pseudo code for Bubble Sort
Algorithm. Sort the following list using
bubble sort in ascending order :
35, 39, 10, 8, 78, 92, 20, 50
Also, write the steps involved. 10

5. (a) Write a program that accepts a matrix as


input and prints the 3-tuple representation
of it. 6

(b) Explain the Index sequential file


organization. 4

(c) What is Hashing ? Explain its use. Also,


explain the concept of hashing functions,
with an example. 10

MCS-021 3 P.T.O.
No. of Printed Pages : 4 MCS-021

MCA (Revised) / BCA (Revised)

Term-End Examination

December, 2022

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written near to ‘C’ language.

1. (a) Write an algorithm of 2-way Merge Sort.


Also discuss the advantage and
disadvantage of 2-way Merge Sort. Also
calculate its time complexity. 10

(b) Traverse the following Binary tree in


Pre-order and Post-order : 10

MCS-021 1 P.T.O.
(c) Write the steps involved to find the
shortest path from Vertex ‘1’ of the graph
given below by using Dijkstra’s algorithm : 10

(d) Write an algorithm to implement Depth


First Search (DFS) method. Use the DFS
method to traverse the following graph, with
Vertex V1 as the source vertex : 10

2. (a) Write short notes on the following : 10

(i) Sequential File Organization

(ii) Indexed Sequential File Organization

MCS-021 2
1
(b) Differentiate between the following : 42 =10
2
(i) Heap and Tree

(ii) B-Tree and Binary Tree


+
(iii) B-Tree and B -Tree

(iv) Binary Tree and Binary Search Tree

3. (a) What is a Red-Black tree ? Explain its


properties. 5

(b) Write an algorithm of Binary Search. 5

(c) Write Selection Sort algorithm. Sort the


following list using Selection Sort in
descending order : 5

25, 10, 50, 21, 65, 18, 45

(d) Let ‘E’ denote the following algebraic


expression :

[a + (b – c)] * [(d – e) / (f + g – h)]

Draw the Binary tree for ‘E’. 5

4. (a) Compute the time complexity of Bubble


Sort and Quick Sort algorithm. Verify the
statement “Best case for Bubble Sort is
worst case for Quick Sort”. 10
MCS-021 3 P.T.O.
(b) Write algorithm and Pseudo code for the
following : 10

(i) Inserting an element in a doubly linked


list.

(ii) Deleting an element from a


doubly linked list.

5. (a) Write Kruskal’s algorithm. Find the


Minimum Cost Spanning Tree of the graph
given below using Kruskal’s algorithm : 10

(b) What is AVL Tree ? Discuss the


mechanism of the following rotations used
in AVL tree : 10

(i) LL

(ii) LR

(iii) RR

(iv) RL

MCS-021 4
No. of Printed Pages : 3 MCS-021

MCA (Revised) / BCA (Revised)

Term-End Examination

December, 2021

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written near to ‘C’ language.

1. (a) What is sparse matrix ? Explain 3-tuple


representation of sparse matrix with the
help of a suitable example. 10

(b) Write the process for converting the following


infix expression into postfix expression using
stack : 10
X * Y * (Z|P – Q) * T + R

MCS-021 1 P.T.O.
(c) Find the Adjacency Matrix for the
following graph : 5

(d) Write an algorithm to create a doubly-linked


list and addition of elements to it. 5

(e) Find the minimum cost spanning tree for


the following graph using Prim’s algorithm :

Show all the intermediate steps of the


process. 10

MCS-021 2
2. (a) Write the Depth First Search (DFS)
algorithm and travel the following graph
using DFS algorithm : 10

(b) Explain Indexed Sequential File


organization with the help of an example.
Also write its advantages. 10

3. (a) Write an algorithm for addition of two


polynomials. 10
(b) What is Heap Sort ? What is its complexity ?
Explain how a heap is created using an
example. 10

4. (a) Explain how Static memory allocation is


different from Dynamic memory allocation.
In which situation is Static memory
allocation a better choice ? Explain briefly. 10
(b) Briefly explain AA-Trees. 10

5. (a) Write an algorithm to add two matrices


using arrays. Also find the time complexity
of this algorithm. 10
(b) Write short notes on the following : 25=10
(i) Forest
(ii) Priority Queue

MCS-021 3 P.T.O.
[2] MCS-021

(b) What is circular queue ? Write algorithms


No. of Printed Pages : 4 MCS-021
for adding element to and deleting element
M. C. A. (REVISED)/B. C. A. (REVISED)
from circular queue. 10
(MCA/BCA)
(c) Describe Big O and Ω notations in detail.
Term-End Examination
June, 2021 10

MCS-021 : DATA AND FILE STRUCTURES


(d) Find minimum cost spanning tree for the
Time : 3 Hours Maximum Marks : 100
graph given below using Kruskal’s

Weightage : 75% algorithm : 10

Note : (i) Question No. 1 is compulsory.

(ii) Attempt any three questions from the


rest.

(iii) All algorithms should be written near to


‘C’ language.

1. (a) Write algorithm for push and pop operations 2. (a) What is AVL tree ? Explain how a node is

of a stack. Also write algorithm to check inserted into an AVL tree and how a node

whether stack is empty or not. 10 is deleted from an AVL tree. 10

P. T. O.
[3] MCS-021 [4] MCS-021

(b) Write any five differences between arrays (b) Write an algorithm to implement singly

and pointers in ‘C’ Programing Language. 5 linked list using pointers. 10

(c) Write linear search algorithm and find its 5. (a) Explain the difference between row-major
time complexity. 5
representation of an array and column
3. (a) What is a Red-Black Tree ? Explain its
major representation of an array with the
properties. 6
help of a suitable example. 10
(b) Explain Direct-File organisation. 6
(c) Sort the following list using bubble sort in (b) Write short notes on the following : 5 each

ascending order : 8 (i) Adjecency matrix representation of


graph
25, 29, 8, 68, 92, 30, 40
(ii) Binary search
Show intermediate steps of the process.
4. (a) Traverse the following Binary tree in : 10
(i) Pre-order
(ii) Post-order

MCS-021

P. T. O.
No. of Printed Pages : 3 MCS-021

MCA (Revised) / BCA (Revised)

Term-End Examination

February, 2021

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written nearer to ‘C’ language.

1. (a) Write ‘C’ program to implement queue


using array. 10

(b) Write binary search algorithm. Find its time


complexity. Explain the process of finding 10
in the following list using binary search. 10
2 6 8 10 12 15

(c) Write quick sort algorithm and sort the


following list using quick sort algorithm.
Show intermediate steps of sorting. 10
16, 8, 12, 9, 6, 2, 5

MCS-021 1 P.T.O.
(d) Traverse the following tree in Preorder and
Postorder. 10

2. (a) Write Dijkstra’s Algorithm for finding


shortest path. 10

(b) Write push and pop functions for stack


data structure using linked list. 10

3. (a) Write an algorithm to add two polynomials. 10

(b) Convert the following infix expression into


postfix expression : 10
(A + B)  (C / D) – E

4. (a) Find Minimum cost spanning tree for the


following graph using Prim’s Algorithm. 10

MCS-021 2
(b) What is sequential file organization ? What
are its disadvantages ? Explain how
indexed sequential file organization is
better than sequential file organization. 10

5. (a) Write an algorithm for inserting a node in a


Red-Black tree and explain it with the help
of an example. 10
(b) Explain the structure of a binary tree.
Write an algorithm for implementation of a
binary tree. 10

MCS-021 3 P.T.O.
No. of Printed Pages : 4 MCS-021
M.C.A. (REVISED)B.C.A. (REVISED)
(MCA/BCA)
Term-End Examination
June, 2020
MCS-021 : DATA AND FILE STRUCTURES

Time : 3 Hours Maximum Marks : 100

Weightage : 75%

Note :(i) Question No 1 is compulsory.

(ii) Attempt any three questions from the


rest.

(iii) All algorithms should be written near to


. 'C' language.

1. (a) Write linear/sequential search algorithm

and calculate time and space complexity

of it. 10
121 MCS-021

(b) Write an algorithm for linked list to : 10

(i) insert an element after a given

element.

(ii) delete an element after searching it in

the list.

(c) What is splay tree ? How is it different

from a tree ? Explain. 10

(d) Explain any two rotations performed on an

AVL tree with the he* of example. 10

2. (a) Write algorithm which take a matrix as

input and display 3-tuple representation of

the matrix. 10

(b) What is binary tree ? Write non-recursive

pre-order binary tree traversal algorithm.

10
13 ] MCS-021

3. (a) Write adjacency list and adjacency matrix

representation of the following graph : 10

(b) What is the need of file organization ?

Explain division-remainder hashing with

the help of an example. 10

4. (a) Sort the following list using bubble sort

algorithm. Show intermediate steps of

sorting : 10

5, 18, 29, 6, 22, 8, 1

P. T. O.
[4] MCS-021

(b) Explain. Depth First Search (DFS) with the

help of algorithm. Also tell the time

complexity of DFS. 10

5. (a) What is B-Tree ? Explain the structure of

B-Tree. Write B-Tree search algorithm. 1.0

(b) What is circular queue ? List any two

applications of circular queue. Write

algorithm to delete a given element from a

circular queue. 10

2493 0
MCS-021
1364424
No. of Printed Pages : 6 MCS-021
MASTER OF COMPUTER
APPLICATION (MCA)
Term-End Examination
December, 2019
MCS-021 : DATA AND FILE STRUCTURES

Time : 3 Hours Maximum Marks : 100


Weightage : 75%

Note : Question No. 1 is compulsory Attempt any


three questions from the rest. All algorithms
should be written nearer to C-language.

1. (a) Order the following functions by their


complexity in increasing order : 3
(i) n log n

(ii) (log n)2

2 + 7n
3n

(iv) 4"

615 (B-28) P. T. 0.
[2] MCS-021

(b) Given the function f(x) = 3x 3 2x2 + 1,

show that f(x) = 0 (x3 ) using the

definition of 0 (big oh). 4

(c) A recursive function is given below : 6

f(int x)

if (x < 2) return 1

else
return f (x — 1) + f (x -- 2)

What is the value of f (5?! Show a complete


recursion tree.

(d) Evaluate the postfix expression : 3

623 + — 382 I + * 2 * * 3 +

(e) How do you define balance of a subtree ?


Construct an AVL-tree (height
balanced tree) for the following sequences of
input : 8

jadnosmfjkl
MCS-021
I3I
(f) Apply the Bubble sort algorithm to sort the
following list. What is the time complexity
of bubble. sort ? 8

35 30 10 40 25 28 15 9

(g) Apply Dijkstra's single source shortest


path algorithm to find out the shortest
path from a vertex a to every other vertex
of the following graph : 8

2. (a) Write an algorithm for Greatest Common


1Divisor (GCD) of the two integers m and n.
Also calculate best case and the worst case
time complexity of the algorithm. 10

(b) Write an algorithm to implement a stack


through a linked list and delete an item
from it. 10
[4] MCS-021

3. (a) Write an algorithm to implement a Depth


First Search method. Write the order of
node sequences it will visit in the following
graph * using this technique : 10

* using Vi as the source vertex.


(b) Make a 3-tuple representation of non-,zero
elements of the following 6 x 5 sparse
matrix : 3

0 1 2 3 4

0 0 0 4 0 0

1 0 3 0 0 1

2 0 0 0 5 0

3 0 0 2 1 0

4 0 0 6 0 0

5 0 0 5 4 0
• 5 MCS-021

(c) Write an algorithm to implement a circular


array and explain the logic. 7
4. (a) What is a minimum spanning tree ?
Apply Prim's algorithm to find
minimum spanning tree of the following
graph : 10

(b) What is a min-heap ? Build a min-heap of

the following sequences using top-down

approach : 10

INTERNATIONAL

5. (a) What are the properties of a RBT (Red-

Black Tree) ? Explain the process of

inserting a node into RBT through an

example. 10

P. T. O.
[6] MCS-021

(b) Given the following BST (Binary Search


Tree). Write down its preorder and
postorder traversal schemes : 6

(c) Explain the following terms : 4

(i) Asymptotic Analysis


(ii) Indexed Sequential File

MCS-021 12,000
No. of Printed Pages : 4 MCS-021

MCA (Revised) / BCA (Revised)

Term-End Examination

C1.-11. 52 June, 2019

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written nearer to 'C' language.

1. (a) Order the following functions by their


complexity in increasing order : 3
(i) n!
(ii) 311

(iv) loge (n!)

(b) For the function defined by f i x) = 2x3 + 4x + 1,


show that f(x) = 0 (x 3) using the definition of
0 (big Oh). 4
MCS-021 1 P.T.O.
(c) Convert the following prefix notation into
infix notation :
+—***ABCD/E/F+ GH

(d) Write an algorithm to reverse a string


using a stack. Illustrate all the
intermediate steps of your algorithm on the
string "IGNOU".

(e) Use Kruskal's algorithm to construct a


minimum cost spanning tree of the
following graph :
10

(f) Apply 2-way mergesort for sorting the


following numbers and show all the
intermediate steps :
4 6 3 7 1 9 2 8 5

(g) Insert the following data items into a


B-Tree of order 5 :
ab ehpckdmlnutxy

MCS-021 2
(h) Explain how a polynomial can be
represented using an array. Write an
algorithm to add two polynomials.

2. (a) Write an algorithm to do insertion sort and


analyze its run-time complexity. 10
(b) Write a program that accepts a set of
integers and creates a singly linked list of
these integers. Then it should prompt for
input of an integer and delete the node
consisting of that integer from the singly
linked list. 10

3. (a) Write a recursive algorithm of preorder and


inorder traversal of a binary tree and
explain it. 10
(b) What is a strongly connected component of
a graph ? Write an algorithm for finding
strongly connected components of a graph. 10

4. (a) Explain Floyd-Warshall's all pair shortest


path algorithm. How is it different from
single source shortest path ? 10

(b) Given the input file


(5, 10, 15, 8, 20, 16, 28, 35, 55, 40, 30),
construct
(i) A binary tree 3
(ii) Heap 4

MCS-021 3 P.T.O.
(c) Draw the graph corresponding to the
following adjacency matrix : 3
a
a 0 1 1 0
b 1 0 0 1
c 1 0 0 1
d 0 1 1 0

5. (a) Construct an AA-tree using the following


numbers (nodes). Show all the intermediate
steps and balancing of tree. 10
7 14 21 80 4 50 30 40

(b) Write important properties of : 10

(i) Binary search tree

(ii) Red black tree

MCS-021 4 8,000
No. of Printed Pages : 3 MCS 021
- I
MCA (Revised) / BCA (Revised)
Term-End Examination
December, 2018
C.19 e,3 :FA

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written nearer to 'C' language.

1. (a) Describe big 0 notation and S2 notation. 10

(b) Explain the process of converting a tree


into a binary tree. 10

(c) Write an algorithm to implement stack,


using array. 10

(d) What is linear search ? Write linear search


algorithm and find its time complexity. 10
MCS-021 1 P.T.O.
2. (a) What is sparse matrix ? Explain 3-tuple
representation of a sparse matrix with the
help of an example. 10

(b) Explain Indexed Sequential File


Organization. 10

3. (a) Write an algorithm for creation of a


circular queue and deletion of an element
from a circular queue. 10

(b) Traverse the following binary tree in


Pre-order and Post-order. 10

4. (a) Explain inserting an element into a heap


with the following numbers : 10

4, 5, 21, 18, 16, 64, 2

MCS-021 2
(b) Find Minimum Cost, Spanning Tree
(MCST) of the following graph using Prim's
algorithm. Show all the intermediate steps. 10
10

12

5. (a) Sort the following set of data using


Insertion sort : 10
25, 15, 10, 18, 12, 4, 17
(b) Write algorithms for the following : 10
(i) Inserting element in a doubly linked
list
(ii) Deleting element from a doubly linked
list

MCS-021 3 11,000
No. of Printed Pages : 3 I MCS-021 I
MCA (Revised) / BCA (Revised)
Term-End Examination
n June, 2018

MCS-021 : DATA AND FILE STRUCTURES

Time : 3 hours Maximum Marks : 100


(Weightage 75%)

Note : Question number 1 is compulsory. Attempt any


three questions from the rest. All algorithms
should be written nearer to 'C' language.

1. (a) What is data structure ? Explain different


types of data structures with examples. 10
(b) Write an algorithm for adding an element
to a circular queue and removing an
element from a circular queue using
arrays. 10
(c) Write an algorithm for converting the
following infix expression into postfix
expression using a stack : 10
A+(B*C—(D/E F)*G)*H
(d) (i) What is asymptotic notation ? Explain
the' big '0' notation.
(ii) Explain three different applications of
stacks with the help of examples. 5
MCS-021 1 P.T.O.
2. Write the function to implement recursive version
of pre-order, in-order and post-order traversals of
Binary trees. 20

3. (a) Draw Binary search tree that results from


inserting into an initially empty tree record
with keys given below in order :
E, A, S, Y, Q, U, E, S, T, I, 0, N and then
deleting Q. 10
(b) Write a program in 'C' to insert and delete
elements from a circular queue using a
linked list. 10

4. (a) (i) Compare any two different sorting


techniques. 5
(ii) . How does static allocation differ from
dynamic allocation of memory ? 5

(b) (i) Find the incidence matrix of the


following graph : 5
v1 e5 v4

ei e4

v2 e3 v3

Figure
(ii) Draw all non-similar trees with
exactly six nodes. 5

MCS-021 2
5. Write short notes on the following : 4x5=20

(a) AVL Tree

(b) Priority Queue

(c) Operation on Stack

(d) Hash Function

MCS-021 3 10,000

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy