Professional Documents
Culture Documents
Ds Question Bank
Ds Question Bank
1. Define data structures? How they are classified? Explain its various operations?
2. What is a structure in C? How is it different from an array? Explain with example
how a structure is declared and initialized? (06 M, June 2009, Jan 2012)
3.Write a C program with an appropriate structure definition and variable declaration
To read an display information about 5 employees using nested structures.
Consider the following fields like Ename, Empid, DOJ (Date, Month, Year) and
Salary (basic, DA, HRA). (12 M, June 2012,Jan 2015,July 17)
4.How does a structure differ from a union? Mention any 2 uses of structure. What
is a bit field? Why are bit fields used with structures?
( 0 6 M,Dec 2010, June 2012)
5.Write a C program to read ten integers and store them in an array using pointers.
6. Write a note on static and dynamic memory allocation and explain with examples.
7..With a suitable example, explain dynamic memory allocation for 2-d arrays.
(04 M,June 2014)
8.What is the difference between int*a and int a[5] and int*[5]?
(06M, Jan 2013)
9.Write a C program using pointers to swap two (numbers) characters.
(06M,June2008, 2012)
10. What is a pointer variable? How do you declare and initialize the pointers? How
11.Write a C program to find the smallest element in the array (using pointer and
12.What do you mean by casting pointers? Give example. (04 M, June 2012)
or
20. write a fast transpose algorithm to transpose the given sparse marix. Express the
above given (Fig Q2(c)) sparse matrix as triplets and find its transpose.
(08 M,Jan 2017)
21.Describe briefly the various types of structures used for storing strings?
(model questions)
22.Write a program that reads a character string and finds the number of vowels and
consonents in it?
23.Write a program to determine whether the given string STR is palindrome or not?
24. write a function to sort integers using selection sort algorithm.
(04 M, Jan 2017)
25.Consider the two polynomials,A(x)=4x15+3x4+5 and B(x)=x4+10x2+1.show
diagrammatically how these two polynomials can be stored in an 1D array.Also
give its C representation (04 M,Jan 2017)
26. Give ADT of sparse matrix and show with suitable example sparse matrix
representation storing triples.Give sample transpose function to transpose function
to transpose sparse matrix. (08M,july 2017)
27. write the Knuth morris pratt pattern matching algorithm and apply the same to
2. Write a C program to implement the two primitive operations on stack using dynamic
3.Write a C program to convert a valid infix expression to prefix expression and infix
i. A$B*C-D+E/F/(G+H)
ii. A-B/(C*D$E) (04 M, June 2012)
i) (a+b)*d+e/(f+a*d)+c
ii) ((a/(b-c+d))*(e-a)*c)
iii) a/b-c+d*e-a*c. (06 Marks, Jan 2014,Jan 2017)
8.Write a C function to evaluate a postfix expression and apply the same to evaluate
operations. i)insert ii) delete iii) display (08 Marks, Jan 2010)
12. Implement addq and deletq functions for the circular queue using dynamically
14. Explain with an example advantages of circular queue over a linear queue.
15. How multiple stacks implemented using one dimensional array? Explain with a
16. write the algorithm to implement a stack using dynamic array whose initial capacity
17. list the disadvantages of linear queue and explain how it is solved in linear queue.
1. What is a linked list? Compare static and dynamic implementation of linked list ?
(10 Marks, June 2012)
2. Write routines in C to perform the following operations in dynamic single linked
list; i)To insert X into its proper position within the list; ii) To delete all nodes whose
into field contains the value of X. (10 Marks, June 2012)
3. What is a doubly linked list? What are advantages of doubly linked list over single
linked list? Illustrate with an example. Write C routines to perform the following
operations on doubly linked list; i)To delete node pointed to by P; ii)To insert node
to the right of P. (10 Marks, June 2012 July 2011,June 2015,jan17)
4. Write a C program to implement stack as a circular list. (10 Marks, June 2012)
5. Write a C program to implement the inset and delete operations on a queue using
linked list. (10 Marks, June 2012, Dec 2010)
6. Write a C function to add 2 polynomials using linked list representation. Explain
with suitable example. (10 Marks, June 2012)
7. Write a C program to implement the inset and delete a node in Doubly Linked List
with respect to given position. (10 Marks, July 2011)
8. What is dynamic memory allocation? Write a function to delete a node from a
circular linked list. Proper error message should be displayed.
(10 Marks, July 2011)
9. What are the advantages and disadvantages of representing a stack or queue by a
linked list? (04 Marks, Jan 2010)
10. Write a C program to implement stack operations using singly linked list.
(10 Marks, Jan 2010)
11. Write a C program to implement the inset a node to the list at the front and delete a
node from front end of doubly linked list. Assume that first and last are external
pointers to the first and last nodes of a doubly linked list
(10 Marks, Jan 2010, July 2009)
12. What is linked list? Explain the different types of linked list with diagrams?
(10 Marks, Jan 2013,Jan 2015)
13. Write a function to insert a node at front and rear end in a circular linked list. Write
down sequence of steps to be followed? (10 Marks, Jan 2013, June 2015)
14. For the given sparse matrix write the diagrammatic linked list representation?
(06 Marks, Jan 14,jan17)
15. Define equivalence class. Write the linked list representation for the twelve
polygons numbered 0 through 11 using the following pairs overlap?
0=4, 3=1, 6=10, 8=9, 7=4, 6=8, 3=5, 2=11, 11=0. . (08 Marks, Jan 2014)
16. Write the node structure for linked representation of polynomial. Explain the
algorithm to add two polynomials represented using linked lists.
(08 Marks, June 2014)
17. Write a C function to
i)reverse the given singly linked list
ii)concatenate two singly linked list. (10 Marks, June 2014, jan2015)
18. write the functions for singly linked list with integer data to search an element in the
list. (08M,Jan 17)
MODULE 4:TREES
1. Define binary trees? Mention the properties of binary tree? For the given tree find the
following: (08 Marks, June 2012)
i. Siblings
ii. Leaf nodes
iii. Non leaf nodes
iv. Ancestors
v. level of trees
A
B C
D E F
2. What is a binary tree? How it is represented using array and linked list? Give example?
(09 Marks, Jan 2013, Jan
2014)
What is a binary tree? Show the array representation and linked representation for the
following binary tree. (05 Marks, June 2015)
A
E F
17.Write an expression tree for the expression A/B*C*D+E. Give the C function for
inorder,preorder,postorder traversals and apply the traversal methods to the expression tree
and give the result of traversals. (05 Marks, June 2015)
18.What is binary search tree? Draw the binary search tree for the following inputs:
i)14, 5, 6, 2, 18, 20, 16, 18,-1, 21 (10 Marks, Jan 2013)
ii) 14,15,4,9,7,18,3,5,16,4,20,17,9
19.Write the following functions for binary search tree:
i. inserting a new node
ii. for display (10 Marks, June2012)
20.Describe the binary search tree, with an example. Write a recursive function to search for
a key value in a binary search tree. (08 Marks, Jan 2014)
21.Construct the binary tree from the given traversals:
Preorder:ABDGCEHIF
Inorder:DGBAHEICF (05 Marks, June 2015)
MODULE 5. GRAPHS,HASHING,FILES AND THEIR ORGANISATION
(New scheme-model questions)
1. Define graphs? Explain with example ,the various methods available for representing
a graph?
2. Explain with example various operations on graphs?
3. Explain with a c code how to traverse a graph?
4. What is hasing? How is it useful. Explain in detail.?
7. what is a graph? Give the matrix and adjacency list representation of graph?
(08 M,Jan17)
. ( 08M,Jan17)
9. what are the methods for traversing a graph? Explain in detail with an example?
( 08M,June17)
10 Write the difference between graphs and trees? For the given graph show the
adjacency matrix and adjacency list representation? ( 08M,June 17)
12 What is collision? What are the methods to resolve collision?explain linear probing
14. Explain open addressing and chain used to handle overflows in hashing? (08M,Jan17)