0% found this document useful (0 votes)
30 views12 pages

DS Ans

Uploaded by

shlok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
30 views12 pages

DS Ans

Uploaded by

shlok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
10122121, 6:07 AM PK CE-Semester-3 Data Structure 3190702] Mid Semester Exam [22-10-2024] DPK CE-Semester-3 Data Structure [3130702] Mid Semester Exam [22- 10-2021] Dear Students, This is a mid sem exam for the subject Data Structure. There are 30 questions each of 1 mark and all are compulsory. Your Exam will start at 3:00 PM and submit before 3:45 PM. Points: 26/30 1. Enrollment Number 200130107002 2. Division htps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhjvxdAeCOSLELBIVHGAL YMXcAXQYVHvbn@k:-SHmOpUOUUROPONVAZUECAOUpZUOICR.... 1/12, 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 3. To represent the hierarchical relationship between elements, which data-structure is suitable? (1/1 Point) All of the given Tree ¥ Priority Deque 4. Consider the following data and specify which one is Preorder Traversal Sequence, Inorder, and Postorder sequences. S1:N,M,P,0,Q $2: N, P,Q, 0,M S3:M,N,0,P,Q (1/1 Point) S1is inorder, S2 is postorder and $3 is preorder o S1 is inorder, $2 is preorder and 53 is postorder S1 is postorder, S2 is inorder and S3 is preorder S1 is preorder, S2 is inorder and $3 is postorder 5. Which of the following application makes use of a circular linked list? (1/1 Point) Undo operation in a text editor Implement Hash Tables Allocating CPU to resources v Recursive function calls htps:ormsaffice.comIPages/ResponsePage aspx7ié=bhiyxdAeCOSLEIBIVHSAL YMXcAXQYVHvbn@k:-SHmOpUOUUROPONVAZUECAOUpZUOICR.... 2/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] x 6.Which of the following properties does a simple graph not hold? (0/1 Point) Must be unweighted Must have no multiple edges Must be connected Must have no loops or multiple edges a 7.Which of the following is the right “C Statement” for creating a new Node of a Link List? Assume: “struct node *new1 " is defined properly. (1/1 Point) new! = (struct node *) malloc (sizeof(struct node *) ); new! = (struct node ) malloc (sizeof(struct node *) ) new! = (struct node ) malloc (sizeof(struct node) ) ; new! = (struct node *) malloc (sizeof(struct node) ); a x 8. If the sorted input sequence is given to the sorting algorithm, which one in the given list, is better in time complexity compare to the others. (0/1 Point) Bubble Sort v Selection Sort Merge Sort Quick Sort htps:tormsaffice.comIPages/ResponsePage.aspx7ié=bhivxdAeCOSLEIBIVHSAL YMXcAXQYVHvbn@k:-SHmOpUOUUROPONVAZUECAOUpZUOICR... 3/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 9. What is the maximum height of any AVL tree with 7 nodes? Assume that height of a single node tree is 0. (1/1 Point) 5 10. What does the following function do for a given Linked List with the first node as the head? void funt (struct node* head) { if head return; = NULL) fun1(head-> next); printf(%d ", head-> data); } (1/1 Point) Prints all nodes of linked list in reverse order v Prints all nodes of linked lists Prints alternate nodes in reverse order Prints alternate nodes of Linked List hitps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhjvxdAeCOSLELBIVHGAL YMXcAXQYVHvbn@k:-SHmOpUQUUROPONVAZUECAOUpZUOICR.... 4/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 11. For an undirected graph having n vertices and e edges, how many 1's are there in Adjacency Matrix representing the Graph? (1 represents there is an edge between vertex i and j of the Graph ) (1/1 Point) nee dern 2"e v 2e+t 12. Which of the following data structure is non-linear type? (1/1 Point) Stacks None of the mentioned a Lists Strings 13, What is the possible number of binary trees that can be created with 3 nodes, giving the sequence N, M, L when traversed in post-order? (1/1 Point) 5 “ 15 14, What is the worst case time complexity of inserting a node in a doubly linked list? (1/1 Point) hitps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhvxdAeCOSLEIBIVHSAL YMXcAXQYVHvbn@k-SHmOpUQUUROPONVAZUECAOUpZUOICR.... 5/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] om) Om) v Ofnlogn) Otlogn) 15. A Stack data-structure can be used for (1/1 Point) Evaluation of Infix to Postfix Expression Nested Function Calls All of the given v Recursion 16. Which Data Structure is used to implement Breadth First Traversal of the Graph? (1/1 Point) Stack Queue v Linked List Tree 17. Postfix and Prefix expression of a+b*c+d is respectively, (1/1 Point) abet++d, ++¥abed abctd++, + +ab*cd abct+d+, ++atbed v ab+cd+*, *rab+cd htps:formsaffice.comIPagos/ResponsePage.aspx7i¢=bhvxdAeCOSLELBIVHGAL YMXcAXQYVHvbn@k-SHmOpUOUUROPONVAZUECAOUpZUOICR.... 6/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 18. Which of the following is not a technique to avoid a collision? (1/1 Point) Increasing hash table size v Make the hash function appear random Use uniform hashing Use the chaining method 19. The element which is inserted first will be removed last in the (1/1 Point) Array None of the mentioned v Linked list Queue 20. The number of edges from the node to the deepest leaf is called of the tree. (1/1 Point) Length Height v Width Depth htps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhivxdAeCOSLEIBIVHSAL YMXcAXQYVHvbn@k:-SHmOpUOUUROPONVAZUECAOUpZUOICR.... 7/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 21. If row-major order is used, how is the following matrix stored in memory? abe def ghi (1/1 Point) cfibehadg abcdefghi v ihgfedcba adgbehcfi 22, What is the Time Complexity of “Insert a node at the end” in a Singly Linked List? There are n nodes in the Singly Linked List. (1/1 Point) on) v on) Of log2 nm) All of the given x 23. You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list? [Ij (0/1 Point) Insert a new element as a first element Delete the first element ‘Add a new element at the end of the list Delete the last element of the list y hitps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhvxdAeCOSLELBIVHSAL YMXcAXQYVHvbn@k:-SHmOpUOUUROPONVAZUECAOUpZUOICR... 8/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 24, What is the condition for Overflow in Circular Queue, if itis implemented using Array? F and R are front and rear pointers respectively and N is size of the Circular Queue. (1/1 Point) if(F==R==N) printf("\nOverfiow’) ; if(R+1)%N)==F) printf("\nOverfiow’) ; if(R+1)= (F+1)%6N) printf("\nOverflow’) ; i 25. A queue data-structure can be used for application. (1/1 Point) Resource Allocation y Recursion Conversion of Infix to Postfix Expression Alllof the given x 26. What is the Time Complexity of “Insert a node” in Binary Search Tree? Assume the tree is balanced. (0/1 Point) O(n) omnr2) O(n log n) O(log n) - htps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhvxdAeCOSLEIBIVHGAL YMXcAXQYVHvbn@k:-SHmOpUQUUROPONVAZUECAOUpZUOICR.... 9/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 27.Maximum number of nodes in a binary tree with height k, where root is height 0, is (1/1 Point) 2M +1 20-1 20k +4 2M(k+1) -1 v 28. Which of the following properties are obeyed by all three tree ~ traversals? (1/1 Point) Left subtrees are visited before right subtrees v Root node is visited before right subtree Right subtrees are visited before left subtrees Root node is visited before left subtree 29, How many common operations are performed in a binary tree? (1/1 Point) htps:formsaffice.comIPages/ResponsePage 2spx7i¢=bhjvxdAeCOSLELBIVHGAL YMXcAXQYVHvbn@k-SHmOpUOUUROPONVAZUECMOUpZUOIC... 10/12 10122121, 607 AM PK CE-Semester-3 Data Siuctue [3130702] Mid Semester Exam [22-10-2021] 30. What is the output of the following function for start pointing to the first node of the following linked list? 1->2->3->4->5->6 void fun(struct node* start) { if(start return; printf("%d_", start-> data); NULL) iffstart->next != NULL) fun(start->next->next); printf("9d_", start->data); } (1/1 Point) 135531 ~ 135135 146641 1235 31. What is a full binary tree? (1/1 Point) Each node has exactly two children Each node has exactly zero or two children v Each node has exactly one or two children All the leaves are at the same level hitps:formsaffice.comIPages/ResponsePage aspx7i¢=bhjvxdAeCOSLELBIVHSAL YMXcAXQYVHvbn@k-SHmOpUOUUROPONVAZUECAOUpZUDIC... 11/12, 1012271, 607 AM DPK CE-Semester-3 Data Sucre [2190702] Mis Semostr Exar [2-10-2021] 32. Linked list is considered as an example of type of memory allocation (1/1 Point) Static Cache Dynamic v Automatic Go back to thank you page This content is created by the owner of the form. The data you submit wil be sent to the form owner. Microsoft is not responsible for the privacy or security practices of its customers, including those of this form owner. Never give out your password, Powered by Microsoft Forms |Privacy and cookies | Terms of use hitps:formsaffice.comIPages/ResponsePage.aspx7i¢=bhjvxdAeCOSLELBIVHSAL YMXcAXQYVHvbnGk-SHmOpUOUUROPONVAZUECMOUpZUOIC... 12/12

You might also like