Data Structure through C Language
1 What is an array? What are limitations of arrays? Give an example to show the usefulness of an arrays.
2 Differentiate between primitive data structure and non- primitive data structure.
3 How is the queue different from the stack? What is a circular queue? How do you represent it?
4 Give the data structure to implement two stacks in same array. Write functions to implement PUSH operation on both the stacks.
5 How can you find shortest path between nodes in a graph by Dijkstra’s algorithm? Explain by suitable diagram and algorithm
6 Describe the sequential algorithm. Write a program for Sequential Searching in an array.
7 What is the difference between binary tree and binary search tree? Construct a Binary search tree from these numbers- 50, 30, 60, 22, 38, 55
8 What is double linked list? What are the advantage and disadvantage of double linked list?
Case Detail:
1. Write a program to implement a stack which contains the address of the pointers for allocation of memory. Do the pop operation on stack and free the popped pointers.
Assignment C
Question No: 1
A linked list index is______ that represents the position of a node in a linked list.
An Integer
a variable
a character
a boolean
Question No: 2
________ form of access is used to add and remove nodes from a queue.
LIFO, Last In First Out
FIFO, First In First Out
Both 1 and 2
None of these
Question No: 3
New nodes are addes to the _______ of the queue.
Front
Back
Middle
Both 1 and
Question No: 4
The number of possible binary trees with 4 nodes is
12
13
14
15
Question No: 5
Which of the following algorithm solves the all – pair shortest path problem?
Dijkstra,s algorithm
Floyd’s algorithm
Prim’s algorithm
Warshall’s algorithm
Question No: 6
Finding the location of the element with a given value is:
Traversal
Search
Sort
None of above
Question No: 7
The size of a structure can be determined by; a. size of variable name; b. size of (struct tag)
Only a
Only b
Both a and b
None of these options
Question No: 8
Which of the following data structure is not linear data structure?
Arrays
Linked lists
Both of above
None of above
Question No: 9
Which of the following data structure is linear data structure?
Trees
Graphs
Arrays
None of above
Question No: 10
The operation of processing each element in the list is known as
Sorting
Merging
Inserting
Traversal
Question No: 11
Value of the first linked list index is:
One
Zero
–1
None of these
Question No: 12
Preorder is same as
depth-first order
breadth- first order
topological order
linear order
Question No: 13
______ form of access is used to add and remove nodes from a stack.
LIFO, Last In First Out
FIFO, First In First Out
Both 1 and 2
None of these
Question No: 14
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.
Queue linked list
Stacks linked list
Both of them
Neither of them
Question No: 15
In an array queue, data is stored in an ______ element.
Node
Linked list
Array
Constructor
Question No: 16
The pop () member function determine if the stack is empty by calling the _______
member function.
removeback ()
isEmpty ()
removedfront ()
hasNext ()
Question No: 17
What happens when you push a new node onto a stack?
The new node is placed at the front of the linked list.
The new node is placed at the back of the linked list.
The new node is placed at the middle of the linked list.
No Changes happens
Question No: 18
Arrays are best data structures
for relatively permanent collections of data
for the size of the structure and the data in the structure are constantly changing
for both of above situation
for none of above situation
Question No: 19
Linked lists are best suited
for relatively permanent collections of data
for the size of the structure and the data in the structure are constantly changing
for both of above situation
for none of above situation
Question No: 20
Each array declaration need not give, implicitly or explicitly, the information about—
the name of array
the data type of array
the first data from the set to be stored
the index set of the array
Question No: 21
The elements of an array are stored successively in memory cells because--
By this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
the architecture of computer memory does not allow arrays to store other than serially
both of above
none of above
Question No: 22
Which of the following is the feature of stack?
All operations are at one end
It cannot reuse its memory
All elements are of different data types
Any element can be accessed from it directly
Question No: 23
To create a linked list, we can allocate space and make something point to it, by writing:
struct-name *pointer-variable. Which of the following statement will correctly allocate the space--
pointer-variable = malloc(sizeof(*struct-name));
pointer-variable = malloc(sizeof(struct struct-name));
pointer-variable = alloc(sizeof(struct struct-name));
pointer-variable = alloc(sizeof(*struct-name
Question No: 24
To delete a dynamically allocated array named `a`, the correct statement is--
delete a;
delete a[0];
delete []a;
delete [0]a;
Question No: 25
The five items: A, B, C, D and E are pushed in a stack, one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is--
A
B
C
D
Question No: 26
Array passed as an argument to a function is interpreted as --
Address of the array
Values of the first elements of the array
Address of the first element of the array
Number of element of the array
Question No: 27
The memory address of the first element of an array is called--
Floor address
foundation address
first address
base address
Question No: 28
Which of the following data structures are indexed structures?
linear arrays
linked lists
both of above
none of above
Question No: 29
Two dimensional arrays are also called--
tables arrays
matrix arrays
both of above
none of above
Question No: 30
Which of the following data structure store the homogeneous data elements?
Arrays
Records
Pointers
None
Question No: 31
The difference between linear array and a record is--
An array is suitable for homogeneous data but the data items in a record may have different data type
In a record, there may not be a natural ordering in opposed to linear array
A record form a hierarchical structure but a linear array does not
All of above
Question No: 32
Binary search algorithm can not be applied to--
Sorted linked list
sorted binary trees
sorted linear array
pointer array
Question No: 33
When new data are to be inserted into a data structure, but there is no available space; this situation is usually called--
underflow
overflow
housefull
saturated
Question No: 34
The situation when in a linked list START=NULL is--
Underflow
overflow
housefull
saturated
Question No: 35
Which of the following is two-way list?
Grounded header list
circular header list
linked list with header and trailer nodes
none of above
Question No: 36
The term "push" and "pop" is related to the--
Array
lists
stacks
all of above
Question No: 37
The postfix equivalent of the prefix * + a b – c d is--
ab + cd -*
ab cd + - *
ab + cd * -
ab + - cd *
Question No: 38
Sorting is useful for--
Report generation
Minimizing the storage needed
making searching easier and efficient
Responding to queries easily
Question No: 39
A data structure where elements can be added or removed at either end but not in the middle--
Linked lists
Stacks
Queues
Deque
Question No: 40
When in order traversing a tree resulted E A C K F H D B G; the preorder traversal would return--
FAEKCDBHG
FAEKCDHGB
EAFKHDCBG
FEAKDCHBG