Vous êtes sur la page 1sur 8

Data Structures Using C

Viva Questions

Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The infix expression A+((B-C)*D) is correctly represented in prefix notation as + A * BCD 4) A list of data items usually words or bytes, with the accessing restriction that elements can be added or removed at one end of the list only, is known as Stack 5) In what order the elements of a push down stack are accessed Last In First Out (LIFO) 6) The following sequence of operations performed on a stack push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop. The sequence of popped out values are 2, 2, 1, 1, 2 7) The postfix form of A$B * C-D + E/F/(G+H) is AB $ C*D EF/GH+/+ 8) The postfix form of A-B/(C*D$E) is ABCDE$*/9) The prefix form of A-B/(C*D$E) is A/B*C$DE 10) The prefix of (A+B)*(C-D) is *+AB-CD 11) What is a Base case? It is a nonrecursive exit from the recursive routine 12) What is a Recursive case? It is a path that includes a recursive call to the routine, to solve a smaller version of the original problem 13) What will be the value returned by the following function when it is called with 11. recur (int num) { if((num/2)!=0) return(recur(num/2)*10+num%2); else return 1; } 1011 14) A linear list in which elements can be added or removed at either end but not in the middle is known as : dqueue 15) The initial configuration of queue is a, b, c, d (a is at the front). To get the configuration d, c, b, a one needs a minimum of : 3 deletions and 3 additions 16) Queues serve a major role in : simulation of limited resource allocation 17) Queue : can be created by setting up an ordinary contiguous array to hold the items. 18) Let P be the queue of integers defined as follows-

Mr. Shylesh B C

Page 1 of 8

Data Structures Using C

Viva Questions

#define MAXQ 500 struct queue { int items [MAXQ]; int front, rear; }q; To insert an elements in the queue we can use : q.items[++q.rear]=x 19) Implementation of list in a dynamic fashion is : to call upon the system to allocate and free storage or a set of nodes is not reserved in advance for use 20) Because of linear structure of linked list having natural linear ordering, there is similarity between linked list and array in : traversal of elements of list 21) Header of a linked list is a special node at the : Beginning of the list 22)struct address { char name [40]; struct address *next }info; func(struct address *j ) { static struct address *i =0; if (i==0) i= j; else i ->next = j; j -> next =0; i =j; } builds the linked list by placing each element : On the end 23) struct address { char name [40]; struct address *next }info; func (struct address *head) { while (head) { printf (head ->name); head = head -> next;} } prints the : Name in all elements of linked list starting from the elements

24) In linked list the logical order of elements : Is not necessarily equivalent to their physical arrangement. 25) The nth node in singly linked list is accessed via ( where n > 1 ) : ( n 1 ) node 26) In linked list the successive elements : need not occupy contiguous space in memory but should be linked to one another. 27) Linear order in linked list is provided through : Pointer. 28) NULL pointer is used to tell : End of linked list., Empty pointer field of a structure. Linked list is empty. 29) List pointer variable in linked list contains address of the : First node in the list. 30) Underflow condition in linked list may occur when attempting to : Delete a node in an empty list.

Mr. Shylesh B C

Page 2 of 8

Data Structures Using C

Viva Questions

31) Deletion of a node in linked list involves keeping track of the address of the node : Which immediately follows the node that has to be deleted 32) Having address of the node to be deleted in double linked list, the node can be deleted : Without traversing the list 33) Appropriate data structure in C to represent linked list is : Array and Struct 34) Link of linked list in C is of type : Pointer to struct 35) malloc function returns NULL value when : If enough memory is not there or argument size is 0 36) Previously allocated memory can be returned to the system by using : free() 37) Function /s associated with dynamic memory allocation is : malloc(), calloc(), free() 38) How many ancestors does a node in the Nth level (root level =0) of a binary search tree have? N 39) A binary search tree is generated by inserting in order the following integers : 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24. The number of nodes in the left subtree and right subtree of the root respectively is (7,4) 40) Which process is faster for threaded trees compared with their unthreaded counterparts : Traversal 41) If a binary tree is threaded for an in order traversal order, NULL left link of any node is replaced by the address of its : Predecessor 42) The inorder traversal of some binary tree produced the sequence DBEAFC, and the postorder traversal of the same tree produced the sequence DEBFCA. What is the preorder traversal sequence? ABDECF 43) A balanced binary tree is a binary tree in which the heights of the two subtrees of every node never differ by more than : 1 44) The postorder traversal of some binary tree produced the sequence CDBFEA, and the inorder traversal of the same tree produced the sequence CBDAFE. What will be the total number of nodes in its right sub tree : 2 45) The postorder traversal of some binary tree produced the sequence CDBFEA, and the inorder traversal of the same tree produced the sequence CBDAFE. What will be the total number of nodes in its left sub tree : 3 46) The inorder traversal of some binary tree produced the sequence CBDA, and the postorder traversal of the same tree produced the sequence CDBA. Then Right subtree is empty, and the left subtree contains 3 nodes. 47) In view of a complete binary tree what is the value of the outdegree - The outdegree of every node is exactly equal to 2 or 0. 48) Balance of the node : Height of its left subtree minus height of its right subtree.

Mr. Shylesh B C

Page 3 of 8

Data Structures Using C

Viva Questions

49) Level of any node of a tree is : Its distance from the root. 50) The element at the root of the heap is depending on type of heap it may be smallest or largest 51) Bubble sort does not use divide and conquer methodology 52) Name the sort in which array to be sorted is partitioned again and again in such a way that all elements less than or equal to partition element appear before it and those which are greater appear after it. quick sort 52) This sort inserts each elements A(k) into its proper position in the previously sorted subarray A(1), . A(k-1). insertion sort 53) In this sort file is divided into subfiles which are to be independently sorted and then merged : shell Sort 54) Average case time complexity of the quick sort algorithm is more than : O(N log2 N )

55) For sorting contiguous list of records quicksort may be preferred over merge sort because : it does not require extra space for an auxilliary storage 56) In quicksort a desirable choice for the partitioning element will be : median of the list 57) The techniques used in creating hash keys are - Divided 58) In this search keys must be ordered : binary search 59) The searching method requires that all keys must reside in internal memory : binary search 60) The element being searched for is not 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. 100 61) The element being searched for is not 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 ordered from smallest to largest. 50 62) The element being searched for is not 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 ordered from largest to smallest. 50 63) The element being searched for is not in an array of 100 elements. What is the average number of comparisons needed in a sequential search to determine the position of the if the elements are completely unordered. 75 State whether the following statements are TRUE or FALSE : 1) A stack may be represented by a linear linked list - True 2) Push operation in stack is performed at the rear end - False

Mr. Shylesh B C

Page 4 of 8

Data Structures Using C

Viva Questions

3) Only the most recently inserted element can be accessed through POP operation in stack - True 4) POP operation in stack may result in overflow - False 5) PUSH operation in stack may result in underflow - False 6) Stack is an example of linear list - True 7) Recursive function must be called directly - True 8) In many cases we observe that, a recursive solution is the most natural and logical way of solving problem. - True 9) The problem of Tower of Hanoi is very difficult to solve using non recursive process. True 10) Recursive functions and iterative functions using stacks can accomplish exactly the same tasks. - True 11) The number of total elements in a queue is fixed. - False 12) The number of elements in a queue, at any time is : q.rear q.front - 1. - False 13) The operation of removing an element from a queue logically, involves manipulation of only one element. - True 14) The term head of the queue is same as the term front of the queue. - True 15) Queue can be created by setting up am ordinary contiguous array to hold the items. True 16) The concept of circular array is very difficult to implement. - False 17) For stack or queue,a arbitrary amount of memory can be allocated. - False 18) FRONT = REAR pointer means queue is empty. - True 19) A Queue can be implemented using a circular array with front and rear indices and one position left vacant. - True 20) Queue is an useful data structure for any simulation applications. - True 21) A Priority queue is implemented using an array of stacks. - False 22) List NULL can be used to initialize list as empty list - True 23) In linked list the logical order of elements is same as their physical arrangement False 24) Random access of elements in linked list is possible - False

Mr. Shylesh B C

Page 5 of 8

Data Structures Using C

Viva Questions

25) In linked list each node must have atleast two fields - True 26) In linked list successive elements need not occupy adjacent space in memory. - True 27) Searching the linked list requires the list must be in sorted order - False 28) Every tree can be uniquely represented by a binary tree. True 29) Tree traversal is a procedure by which, each node in the tree is processed exactly twice in a systematic manner False 30) In preorder traversal of a binary tree the left subtree is traversed after processing the root node. True 31) In preorder traversal of a binary tree the root node is processed first. True 32) For inorder traversal of a binary tree the inorder traversal of its left subtree should be performed first. True 33) A binary tree is threaded according to a particular traversal order. False 34) For inorder threading of a binary tree if the left link of some node is NULL it is replaced by the address of its successor. True 35) The height of a binary tree is the maximum level of its leaves. False 36) In a tree a node with no sub trees is called a leaf node. True 37) The level of any node of a tree is the length of its path from the root. True 38) The level of the root node of any tree is 1. False 39) In internal sorting methods it is necessary for all data to reside in internal memory True 40) Insertion sort is also called bubble sort False 41) In merge sort, files to be merged must be sorted True 42) Quick sort and merge sort are example of divide and conquer algorithms True 43) Insertion sort is O(N) False 44) Average case time for quick sort is O(log n ) False 45) Bubble sort algorithm requires O(N) comparisons for sorting a sorted list True 46) Quick sort algorithm requires O(N log N) comparisons for sorting a sorted list False 47) A Heap need not be a binary tree False 48) Merge sort is a stable sorting algorithm True

Mr. Shylesh B C

Page 6 of 8

Data Structures Using C

Viva Questions

49) For sorting elements of an array, where each element is a large record, it is always desirable to use an index array for reducing overhead of comparison. False 50) Radix search algorithms work with bits or components of the keys instead of the complete keys. True 51) A binary search of an ordered set of elements in an array is always faster than a sequential search of the elements :False 52) A binary search is an O ( N log2 N ) algorithm : False 53) A binary search of elements in an array requires that the elements be sorted from smallest to largest True 54) When a hash function is used to determine the placement of elements in an array, the order in which the elements are added will not affect the resulting array : False 55) When hashing is used, increasing the size of the array will always reduce the number of collisions. False 56) No. of elements in the linear Queue with pointers REAR & FRONT at any given instant can be given by formula - REAR FRONT +1 57) If n is the size of array, maximum no. of elements that can be stored in the circular queue is n - 1 58) The property of which data structure matches with that of Priority queue? Heap 59) If a doubly linked list is I/P restricted as well as O/P restricted, the queue become circular queue 60) The use of free() function in C requires the header file declaration malloc.h, alloc.h 61) malloc(sizeof(int[10])) The pointer that can point to the above defined m/y area is void 62)Minimum no of pointer adjustment for deletion of any node from the circular doubly linked list is 4 63) sizeof () is an identifier 64) The overflow condition in the array implementation of linked list may occur while calling to getnode 65) Struct book { int acc_no; char title[20]; float price; }; struct book *s; sizeof (*s) will give 2

Mr. Shylesh B C

Page 7 of 8

Data Structures Using C

Viva Questions

66) What is the purpose of using header nodes in the linked? i) To contain global information ii) To avoid null condition in the case when list is empty iii) To indicate the beginning of linked list 67) Which function will require the concept of previous node pointer (for linear linked list): Ordered insertion, Deletion of all occurrences of x, Insertion in the end 68) Using C language to implement the heterogeneous linked list, what may be the different pointer types? The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type. 69) Minimum number of queues needed to implement the priority queue is 70) The queue data structure follows the order FIFO 2

Mr. Shylesh B C

Page 8 of 8

Vous aimerez peut-être aussi