Data Structure through C Language
ASSIGNMENT A-
1. A two-dimensional array defined as a [4…7, -1 …….3] requires 2 bytes of storage
space for each element. If the array is stored in row-major form, then calculate the address
of element at location a[6,2]. Give the base address is 100.
2. Write a C program to implement bubble sort.
3. Write a program in C to show PUSH and POP operations in a stack.
4. Write the algorithms for the insertion and deletion operations performed on the
circular queue.
5. What is double linked list? What are the advantage and disadvantage of double
linked list?
6. What is a binary search tree? Construct a binary search tree from these numbers –
50, 30, 60, 22, 38, 55, 34.
7. Explain the Dijkastra’s Algorithm.
8. What do you mean by the Hashing? Explain different method of hashing.
ASSIGNMENT B-
1. If you are using C language to implement the heterogeneous linked list, what pointer
type will you use?
2. What is the binary tree? What are threaded and properties of binary trees?
3. What is directed graph? Explain the various types of graph and traversal of
directed graph.
ASSIGNMENT C-
1. The memory address of the first element of an array is called
Options
a) Floor Address
b) Foundation Address
c) First Address
d) Base Address
2. Memory address of fifth element of an array can be calculated by the formula
Options
a) LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words
per memory cell for the array
b) LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per
memory cell for the array
c) LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per
memory cell for the array
d) None of above
3. Which of the following data structures are indexed structures?
Options
a) linear arrays
b) linked lists
c) both of above
d) none of above
4. Which of the following is not the required condition for binary search algorithm?
Options
a) The list must be sorted
b) There should be the direct access to the middle element in any sublist
c) There must be mechanism to delete and/or insert elements in list
d) none of above
5. Which of the following is not a limitation of binary search algorithm?
Options
a) Must use a sorted array
b) requirement of sorted array is expensive when a lot of insertion and deletions are
c) There must be a mechanism to access middle element directly
d) Binary search algorithm is not efficient when the data elements are more than
6. Two dimensional arrays are also called
Options
a) Tables arrays
b) Matrix Arrays
c) both of above
d) none of above
7. A variable P is called pointer if
Options
a) P contains the address of an element in DATA.
b) P points to the address of first element in DATA
c) P can store only memory addresses
d) P contain the DATA and the address of DATA
8. Which of the following data structure can't store the non-homogeneous data elements?
Options
a) Arrays
b) Records
c) Pointers
d) None
9. Which of the following data structure store the homogeneous data elements?
a) Options
b) Arrays
c) Records
d) Pointers
e) None
10. Each data item in a record may be a group item composed of sub-items; those items which
are indecomposable are called
Options
a) Elementary items
b) Atoms
c) Scalars
d) All of above
11. The difference between linear array and a record is
Options
a) An array is suitable for homogeneous data but the data items in a record may have
b) In a record, there may not be a natural ordering in opposed to linear array.
c) A record form a hierarchical structure but a lienear array does not
d) All of above
12. Which of the following statement is false?
Options
a) Arrays are dense lists and static data structure
b) data elements in linked list need not be stored in adjecent space in memory
c) pointers store the next data element of a list
d) linked lists are collection of the nodes that contain information part and next pointer
13. Binary search algorithm can not be applied to
Options
a) Sorted linked list
b) Sorted binary trees
c) Sorted linear array
d) Pointer array
14. When new data are to be inserted into a data structure, but there is no available space; this
situation is usually called
Options
a) Underflow
b) Overflow
c) Houseful
d) Saturated
15. The situation when in a linked list START=NULL is
Options
a) Underflow
b) Overflow
c) Housefull
d) Saturated
16. Which of the following is two way lists?
Options
a) grounded header list
b) circular header list
c) linked list with header and trailer nodes
d) none of above
17. Which of the following name does not relate to stacks?
Options
a) FIFO lists
b) LIFO list
c) Piles
d) Push-down lists
18. The term "push" and "pop" is related to the
Options
a) Array
b) Lists
c) Stacks
d) All Of Above
19. A data structure where elements can be added or removed at either end but not in the middle
Options
a) Linked lists
b) Stacks
c) Queues
d) Deque
20. When in order traversing a tree resulted E A C K F H D B G; the preorder traversal would
return
Options
a) FAEKCDBHG
b) FAEKCDHGB
c) EAFKHDCBG
d) FEAKDCHBG
21. Value of the first linked list index is________
Options
a) One
b) Zero
c) –1
d) None of these
22. A linked list index is ____ that represents the position of a node in a linked list
Options
a) An Integer
b) A variable
c) A character
d) A Boolean
23. Why is the constructor of the Queue Linked List class empty?
Options
a) Because initialization of data members of the Linked List class is performed by the
constructor of the Linked List class.
b) Because initialization of data members of the Linked List class is performed by the
destructor of the Linked List class.
c) Because initialization of data members of the Queue Linked List class is performed by
the constructor of the Linked List class.
d) Because initialization of data members of the Queue Linked List class is performed by
the destructor of the Linked List class
24. _______ form of access is used to add and remove nodes from a queue
Options
a) LIFO Last In First Out
b) FIFO, First In First Out
c) Both 1 and 2
d) None of these
25. ______ form of access is used to add and remove nodes from a stack
Options
a) LIFO
b) FIFO
c) Both 1 and 2
d) None of these
26. New nodes are added to the _____ of the queue.
Options
a) Front
b) Back
c) Middle
d) Both 1 and 2
27. A _______ is a data structure that organizes data similar to a line in the supermarket, where
the first one in line is the first one out.
Options
a) Queue linked list
b) Stacks linked list
c) Both of them
d) Neither of them
28. In an array queue, data is stored in an _____ element
Options
a) Node
b) Linked list
c) Array
d) Constructor
29. The pop () member function determines if the stack is empty by calling the _____ member
function
Options
a) removeback()
b) isEmpty()
c) removedfront()
d) hasNext()
30. What happens when you push a new node onto a stack?
Options
a) The new node is placed at the front of the linked list
b) The new node is placed at the back of the linked list.
c) The new node is placed at the middle of the linked list.
d) No Changes happens
31. Which of the following algorithm solves the all – pair shortest path problem?
Options
a) Dijkstra,s algorithm
b) Floyd’s algorithm
c) Prim’s algorithm
d) Warshall’s algorithm
32. The operation of processing each element in the list is known as
Options
a) Sorting
b) Merging
c) Inserting
d) Traversal
33. To delete a dynamically allocated array named `a`, the correct statement is
Options
a) delete a;
b) delete a[0];
c) delete []a;
d) delete [0]a;
34. The memory address of the first element of an array is called
Options
a) Floor address
b) Foundation address
c) First address
d) Base address
35. Which of the following data structure store the homogeneous data elements?
Options
a) Arrays
b) Records
c) Pointers
d) None
36. The number of possible binary trees with 4 nodes is
Options
a) 12
b) 13
c) 14
d) 15
37. Which of the following data structure is not linear data structure?
Options
a) Arrays
b) Linked lists
c) Both of above
d) None of above
38. Finding the location of the element with a given value is:
Options
a) Traversal
b) Search
c) Sort
d) None of above
l
39. Preorder is same as
Options
a) depth-first order
b) breadth- first order
c) topological order
d) linear order
40. Which of the following is the feature of stack?
Options
a) All operations are at one end
b) It cannot reuse its memory
c) All elements are of different data types
d) Any element can be accessed from it directly