Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE EVENT_CODE Jan2017 ASSESSMENT_CODE MIT102_Jan2017 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 12138 QUESTION_TEXT What is data structure? Discuss briefly on types of data structures. SCHEME OF EVALUATION The data structure represents the logical relationship of the particular data sets (1 mark) 2 types 1. linear data structures 2. Non linear data structures (2 marks) Linear data structure When the data is stored in the memory in linear or sequential form is called linear data structure (1 mark) Examples of linear data structures include. Array, stack, queue, linked list Array Expn Stack Expn Queue Expn Linked list Expn (any 3=3 marks) Non linear data structure: When the data is stored in the memory in dispersed or non sequential order is called non linear data structure (1 mark) Example: Tress Expn (1 mark) Graphs Expn (1 mark) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 73331 QUESTION_TEXT Give an account of types of mass storage devices SCHEME OF EVALUATION Floppy disks: Relatively slow and have a small capacity, but they are portable, inexpensive, and universal. * Hard disks: Very fast and with more capacity than floppy disks, but also more expensive. Some hard disk systems are portable (removable cartridges), but most are not. * Optical disks: Unlike floppy and hard disks, which use electromagnetism to encode data, optical disk systems use a laser to read and write data. Optical disks have very large storage capacity, but they are not as fast as hard disks. In addition, the inexpensive optical disk drives are read-only. Read/write varieties are expensive. * Tapes: Relatively inexpensive and can have very large storage capacities, but they do not permit random access of data. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 73333 QUESTION_TEXT Explain the array implementation of stack. SCHEME OF EVALUATION Push operation: 5 Marks PUSH (STACK, TOP, MAXSTK, ITEM) 1. [STACK ALREADY FULL?] If TOP=MAXSTK, THEN PRINT ‘OVERFLOW’ AND RETURN; 2. SET TOP=TOP+1 3. SET STACK[TOP]=ITEM 4. RETURN Pop operation: 5 Marks POP (STACK, TOP, ITEM) 1. [STACK IS EMPTY?] IF TOP=-1, THEN PRINT ‘STACK EMPTY’ AND RETURN 2. SET ITEM = STACK[TOP] 3. SET TOP=TOP-1 4. RETURN QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 73334 QUESTION_TEXT Give the recursive functions for the binary tree traversals. A binary tree is a special case of tree where no node of a tree can have a degree of more than two. Therefore, a binary tree is a set of zero or more nodes such that: SCHEME OF EVALUATION There is a specially designated node called the root of the tree The remaining nodes are partitioned into two disjointed sets, T1 and T2, each of which is a binary tree. T1 is called the left sub tree and T2 is called right sub tree. Binary tree traversals: Inorder traversal: Void print_inorder(tree_node *p) { If (p!=NULL) { Print_inorder(pleft); Cout< < p- >data< < endl; Print_inorder(pright); } 3 Marks } Postorder traversal: Void print_postorder(tree_node *p) { If (p!=NULL) { Print_postorder(pleft); Print_postorder(pright); Cout< < p- >data< < endl; } 3.5 Marks } Preorder traversal: Void print_preorder(tree_node *p) { If (p!=NULL) { Cout< < p- >data< < endl; Print_preorder(pleft); Print_preorder(pright); } 3.5 Marks } QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 120229 QUESTION_TEXT Write an algorithm to insert an element into a queue using arrays and explain. QINSERT(QUEUE,N,FRONT,REAR,ITEM) 1. If FRONT=1 and REAR=N or FRONT=REAR+1 then Write OVERFLOW and return 2. [Find new value of REAR] If FRONT:=NULL then Set FRONT:=1 and REAR:=1 Else if REAR=N then Else if REAR=N then Set REAR:=1 Else Set REAR:=REAR+1 3. Set QUEUE[REAR]:=ITEM SCHEME OF EVALUATION 4. Return (5 marks) Explanation (5 marks) QUESTION_TYP DESCRIPTIVE_QUESTION E QUESTION_ID 120234 QUESTION_TEX Write the steps for converting the general tree to a binary tree. T 1. The root of the general tree must be the root of the binary tree ( SCHEME OF EVALUATION 1 mark) 2. Determine the first child of the root which is the left most node in the general tree at the next level. (1 mark) 3. Insert this node. The child-parent relationship in general tree would be considered in binary tree also (1 mark) 4. Continue finding the first child of each parent node and insert it below the parent child (1 mark) 5. When no more first children exist in the path just used, move back to the parent of the last node entered and determine the next sibling, then insert right to the previous left sibling (where sibling in general tree would be child in binary tree) ( 3 marks) 6. In order to complete the tree, the following steps to be executed: →Look for the completion of sibling at one generation level →Next move to left most child of the successor generation and repeat the process as same until the sibling of the generation are inserted (3 marks)