# V T U 3rd Semester B.E Data Structures Question Bank

**Visvesvaraya Technological University Third Semester B.E Computer Science and Information Science, Data Structures Question Bank**

**Subject: Data Structures Sub Code: CS 35**

**Part- I**

1. With examples, explain different storage classes used in C.

2. Write a note on enumeration data type.

3. Write the prefix & postfix form of the following .

1. (( A + B ) * C – ( D – E ) $ ( F+a)

2. (A + B) * (C + D -E) * F

4. Show that the detailed contents of the stack for given postfix examples. 623 + - 382 / + * 2 $ 3 +

5. Write a note on Preprocessor directives.

6. Why MACROS are needed. Explain with examples.

7. Differentiate between Structure & Unions members.

8. What is the significance of dynamic memory allocation.Explain C function that support Dynamic allocation.

10. Write the dynamic representation of stack? For such a representations. Write the Push & Pop routines.

11. Write the algorithm to find the maximum & minimum values singly linked list.

12. Write the algorithm to delete all the occurrences of a given value from the list.

13. List the different types of linked list & give their definitions in C.

14. Write an algorithm to count the number of nodes in a singly linked list.

15. Write an algorithm to reverse the linked list without creating new nodes.

16. Write an algorithm to append an element to the end of a list.

17.What is the advantage of Queue representing as List? For such representation write the insertion and deletion procedure.

18.Show that output of the following assuming a = 4, b = 3, c = 10

1. d = a & b

2. d = a / b

3. d = a ^ b

4. d = a >>2

5. d = a<< 2

**Part-B**

1. What is Priority Queue? Explain the different methods of implementing Priority queue & comment on the efficiency on each method.

2. What are the advantages of a doubly linked list over a singly linked list? Write a program that inserts a given value in to an ordered doubly linked list in to its proper positions.

3. Write a C programme to implement Circular singly linked list.

4. Write a C programme using dynamic variables & pointers to construct a singly linked list, consisting of following information.

1. Student ID.

2. Student Name.

3. Semester.

The operations to be supported are

1. Inserting at the front

2. At the end.

3. At any position.

4. Display all the nodes in the list.

5. Write a C programme using dynamic variables & pointers to construct a singly linked list, consisting of following information.

1. Student ID.

2. Student Name.

3. Semester.

The operations to be supported are Deleting a node based on student ID.If the specified node is not present in the list; an error message should be displayed. Both options should be demonstrated.

6. Write a C programme using dynamic variables & pointers to construct a singly linked list,consisting of following information.

1. Student ID.

2. Student Name.

3. Semester.

The operations to be supported are 1. Searching a node based on student ID & updates the information content. If the specified node is not present in the list an error message should be displayed. Both options should be displayed.

7. Write a C programme using dynamic variables & pointers to construct

8. What is a Linked list? Compare static & dynamic implementation of linked list in C.

9. How can an ordinary Queue is represented using a singly linked list ? Give algorithms for insertions as well as deleting elements in to a singly linked list ?

10. What are different methods to represent a binary tree and compare them?

11. Given a binary tree implement the following.

1. To compute its maximum depth.

2. To Print the nodes in ascending order assuming that the tree is a BST.

3. To count the number of nodes in a binary tree.

12. Give an algorithm for constructing a binary search tree. While constructing the tree take care that duplicate values are not added. Trace the algorithm on 8,13,10,12,6,9,5,2.

13. Wrtie an algorithms for implementing the following:

1. To concatinate two linked list.

2. Delete the first occurrence of value X from a doubly linked list.

3. Delete all the occurrence of given value from DLL.

14. What are the advantages & disadvantages of a doubly linked list over a singly linked list .

15. What is meant by tree traversal. Explain the different traversal techniques.

16. What are different schemes of representing a binary tree.

17. Define the following terms.

1. Strictly binary tree.

2. Complete binary tree.

3. Depth of a tree.

4. Binary search tree.

5. Almost complete binary tree.

18. What is meant by threaded binary tree? Explain the impact of such a representation on the tree traversal procedure.

19. Write a program to insert a given value into an ordered singly linked list into its proper position.

20. What is header node? Write a program to implement the circular singly linked list. Perform insertion, deletion and display routines.

21. Construct a binary search tree for the following

1. 80,40,75,30,20,90,50

2. 100,50,200,25,90,80,150,300,180.

22. Construct the binary tree given the following traversals.

Pre-order : A B D G H C E I F

In-order: G D H B A E I C F

23. What is Structure? How is it different from an array? Expain the methods of initiating the structre members with an illustrative example.

24. Distinguish between the following:

1. (*m) [5] and * m[5]

2. int ( * ptr ) and int * ptr( )

25. Develop a C program to write data of employees into a file. Each employee is a structure with the following members: Char name[10], float salary, int id, char desig [10]. Further read from the file and display it on the console.

26. What is stack? Indicate how stack is represented in C.

27. Write an algorithm for converting fix expression for postfix expression. Further trace the above algorithm clearly indicating the contents of the stack for the following expressions:

(( A – ( B + C )) * D ) $ ( E + F )

28. What is recursion? Comment on the efficiency of recursive routines.

29. Write a recursive C function to find the sum of all the elements in an array with N integer values.

30. With an illustrative example, show a queue can be structured as a circular list.

31. Explain the working of radix sort on a suitable data set and comment on its efficiency.

32. What is hashing? Explain various methods for resolving hash collisions.

33. What are bit fields? Summarize the rules for defining and using bit fields with suitable examples. Consider the following:

Struct

{

int count;

float *p;

s [20], *ptr = s;

write the impact of the following statements.

1. ++ ptr -> count;

2. *ptr -> p ++;

3. ( * ptr -> p ))++;

4. *ptr ++ ->;

5. ( ++ptr ) -> count;

34. What is a circular Queue ? Write the implementation of circular queues using arrays,& also write the routines to perform insertion,deletion & display on it.

35. What is a Union ? With an example explain the declartion & accessing of union members.

36. Write a syntax & purpose of the following library functions:

1. fopen

2. fseek

3. ftell

4. rewind

5. fscanf