# DATA STRUCTURE QUESTIONS

DATA STRUCTURE QUESTIONS

1. What is a data structure?

2. What does abstract data type means?

3. Evaluate the following prefix expression ” ++ 26 + – 1324″ (Similar types can be asked)

4. Convert the following infix expression to post fix notation ((a+2)*(b+4)) -1 (Similar types can be asked)

5. How is it possible to insert different type of elements in stack?

6. Stack can be described as a pointer. Explain.

7. Write a Binary Search program

8. Write programs for Bubble Sort, Quick sort

9. Explain about the types of linked lists

10. How would you sort a linked list?

11. Write the programs for Linked List (Insertion and Deletion) operations

12. What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?

13. What do you mean by Base case, Recursive case, Binding Time, Run-Time Stack and Tail Recursion?

14. Explain quick sort and merge sort algorithms and derive the time-constraint relation for these.

15. Explain binary searching, Fibinocci search.

16. What is the maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)

17. How many different binary trees and binary search trees can be made from three nodes that contain the key values 1, 2 & 3?

18. A list is ordered from smaller to largest when a sort is called. Which sort would take the longest time to execute?

19. A list is ordered from smaller to largest when a sort is called. Which sort would take the shortest time to execute?

20. When will you sort an array of pointers to list elements, rather than sorting the elements themselves?

21. The element being searched for is not found in an array of 100 elements. What is the average number of comparisons needed in a sequential search to determine that the element is not there, if the elements are completely unordered?

22. What is the average number of comparisons needed in a sequential search to determine the position of an element in an array of 100 elements, if the elements are ordered from largest to smallest?

23. Which sort show the best average behavior?

24. What is the average number of comparisons in a sequential search?

25. Which data structure is needed to convert infix notations to post fix notations?

26. What do you mean by:

o Syntax Error

o Logical Error

o Runtime Error

How can you correct these errors?

27. In which data structure, elements can be added or removed at either end, but not in the middle?

28. How will inorder, preorder and postorder traversals print the elements of a tree?

29. Parenthesis are never needed in prefix or postfix expressions. Why?

30. Which one is faster? A binary search of an orderd set of elements in an array or a sequential search of the elements.

more data structure questions and answers

Q. You have to sort a list L consisting of a sorted list followed by a few “random” elements.

Which of the following sorting methods would be especially suitable for such a task?

(A) Bubble sort (B) Selection sort

(C) Quick sort (D) Insertion sort

Ans:D

Q. B Trees are generally

(A) very deep and narrow (B) very wide and shallow

(C) very deep and very wide (D) cannot say

Ans:D

Q.7 A technique for direct search is

(A) Binary Search (B) Linear Search

(C) Tree Search (D) Hashing

Ans:D

Q. If a node having two children is deleted from a binary tree, it is replaced by its

(A) Inorder predecessor (B) Inorder successor

(C) Preorder predecessor (D) None of the above

Ans:B

Q. The searching technique that takes O (1) time to find a data is

(A) Linear Search (B) Binary Search

(C) Hashing (D) Tree Search

Ans:C

Q. A mathematical-model with a collection of operations defined on that model is called

(A) Data Structure (B) Abstract Data Type

(C) Primitive Data Type (D) Algorithm

Ans:B

Q. The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort

is

(A) 6 (B) 5

(C) 7 (D) 8

Ans:B

more data structure questions and answers

Q. You have to sort a list L consisting of a sorted list followed by a few “random” elements.

Which of the following sorting methods would be especially suitable for such a task?

(A) Bubble sort (B) Selection sort

(C) Quick sort (D) Insertion sort

Ans:D

Q. B Trees are generally

(A) very deep and narrow (B) very wide and shallow

(C) very deep and very wide (D) cannot say

Ans:D

Q.7 A technique for direct search is

(A) Binary Search (B) Linear Search

(C) Tree Search (D) Hashing

Ans:D

Q. If a node having two children is deleted from a binary tree, it is replaced by its

(A) Inorder predecessor (B) Inorder successor

(C) Preorder predecessor (D) None of the above

Ans:B

Q. The searching technique that takes O (1) time to find a data is

(A) Linear Search (B) Binary Search

(C) Hashing (D) Tree Search

Ans:C

Q. A mathematical-model with a collection of operations defined on that model is called

(A) Data Structure (B) Abstract Data Type

(C) Primitive Data Type (D) Algorithm

Ans:B

Q. The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort

is

(A) 6 (B) 5

(C) 7 (D) 8

Ans:B

Elements of stack are

1)ordered

2)Unordered

3)sequential

Elements of stack are

1)ordered

2)Unordered

3)sequential