April / May 2013
Programming & Data Structures - I
Anna University
2 question papers available. Select an examination session to view its question paper.
Programming & Data Structures - I
Programming and Data Structures I
Based on available extracted papers. Question groups and frequency are provisional, not official syllabus weightage or examination predictions.
Define depth and height of a tree.
1 eligible source papersHow are collisions handled while hashing? —
1 eligible source papersDiscuss the efficiency in terms of the number of comparisons in Quick sort. NO = MANSY
1 eligible source papersa) i) Explain the various control structures and the different control statements used in ‘C’ with an example code for each. . (10)
0 eligible source papersa) ii) Differentiate between call by value and-call by reference using suitable example. (6)
0 eligible source papersa) i) Write a C program that reads several different names and addresses into the computer, rearranges the names into alphabetical order, and then writes out the alphabetized list. Make use of structure variables within the program. (10)
0 eligible source papersa) ii) Differentiate Array of Pointers and Pointer to an Array with suitable example and syntax. . . 6)
0 eligible source papersb) i) Write a C program to copy the contents of one file into another. (10)
0 eligible source papersb) ii) How can the getchar() function be used to read multicharacter strings? (6)
0 eligible source papersa) i) Formulate an algorithm to perform an insertion in a singly linked list in an increasing order of their INFO field. (10)
0 eligible source papersa) ii) A circular queue has a size of 5 and has 3 elements 10, 20 and 40 where F=2 and R=4. After inserting 50 and 60, what is the value of F and R. Trying to insert 30 at this stage what happens. Delete 2 elements from the queue and insert 70 ,80 & 90. - Show the sequence of steps with necessary diagrams with the value of F & R. (6) — (OR)
0 eligible source papersb) i)Formulate an ADT to implement cursor with the following routines InitializeCursor(), CursorAloc(), CursorFree(), InsertMidQ), Delete(). (10)
0 eligible source papersb) ii) Simulate using Stack to convert the infix expression to postfix expression A*(B+D)/E—F*#(G+H/K) (6)
0 eligible source papersa) i) Formulate'an algorithm for performing insertion and deletion in a binary search tree. (10)
0 eligible source papersa) ii) Make a BST for the following sequence of numbers. 45, 36, 76, 23, 89, 115, 98, 39, 41, 56, 69, 48 Traverse the tree in Preorder, Inorder and Postorder. . (6)
0 eligible source papersb) i)Formulate an algorithm to implement open addressing hash table with operations, InitializeTable(), Insert(), Delete() and Find(). (10)
0 eligible source papersb) ii) Consider inserting the keys 10, 22, 31, 4, 15, 28, 17, 88, 59 into a-hash table of length m = 11 using open addressing with the primary hash function h'(k)=k . mod m. Illustrate the result of inserting these keys using linear probing, using quadratic and using double hashing with h2(k)=1+(kmod(m-1)). (6)
0 eligible source papersa) i) Write the algorithm to sort using Mergesort. (10)
0 eligible source papersa) ii) Show how Heap sort processes the input 15, 75, 10, 80, 21, 35, 23, 8, 12, 7. (6)
0 eligible source papersb) i) Sort the data 81, 94, 11, 96, 12, 35, 17, 99, 28, 58, 41, 75, 15 using external sorting algorithms. Show the steps to generate extended initial runs using Replacement Selection strategy. (10)
0 eligible source papersb) ii) Write the algorithm for Shell sort. (6)
0 eligible source papersBrief on the rules to follow on naming variables.
1 eligible source papersWrite the output of the following code: # include <stdio.h> int func() { static int a = 10; return at+; } main() _ printf(‘\nFirst call : %d”, func()); printf(“\nSecond call : %d”, func()); return 0; } What are the advantages of preprocessors?
0 eligible source papersWrite a code snippet that reads the elements of a n x m matrix using a pointer variable.
1 eligible source papersIs linked list is better than an arrayed list? Give atleast two reasons for your answer. |
1 eligible source papersGive the postfix notation of the expression:a*((o*c+d)/(e-f*g)).
1 eligible source papersWhat are binary search trees? Give an example.
1 eligible source papersDefine rehashing.
0 eligible source papersWhat are min-heap and max-heap? 109. Sort the following numbers using Insertion sort. 9523 26 1 4 53 46 8 17
0 eligible source papersi) Write a function to reverse a string and use this function to check whether the user given string is a palindrome. (10) ii) What are the components of a recursive function? Give a recursive function to find a factorial of a number. ் (6) 12. 13. 14, 15. b) a) b) a) b) b) Write a program to store the voter's information such as voter-id, name, father name, date-of-birth, age, gender, address and ward—no for ‘n’ voters. Also write functions - to compute the number of male and female voters of a ward ‘w’; - to display the information of each voter using pointer. (16) . OR ப Write a program to create a file; read and display the contents of the file; inserting a string at position ‘n’ from the end of the file and finally displaying the whole content of the file. | (46) i)-Define C functions to evaluate a postfix expression using stack operations. (8) ii) Given two sorted linear linked lists L1 and L2, how do you create a list L3, . which consists of the uncommon elements of L1 and L2? Write a suitable ADT for the construction of doubly linked list L3. (8) . OR i) Write ADTs for insert and delete operations in a Circular Queue using singly linked list. | 7 (8) ii) Write a C program to convert an infix expression into a prefix expression (8) i) Write suitable ADT’s to perform insertion and deletion operations in Binary Search Tree. (8) ii) Simulate the result of inserting: 61, 32, 36, 14, 6, 75, 82, 3, 19, 87, 94 one at a time, into an initially empty binary search tree. (4) iii) Simulate the deletion of the elements 36, 87, 61, 75 one by one from the above binary search tree. . | (4) [OR] Explain the collision.resolving schemes in hashing with proper illustrations. (16) i) Explain Heap sorting of data with suitable example. . (10) ii) Arrange the following numbers in ascending order using Merge Sort. 49 58 25 63 4 14 78 96 8 10 2 43 (6) [OR] i) Explain Quick Sort in detail by arranging the following set of numbers. Write suitable routines to illustrate Quick sort operations. 56 67 20 98 134 142 69 34 12 46 52 . (10) ii) Explain Replacement Selection algorithm with a suitable example. (6)
0 eligible source papersHistorical analysis based on extracted question papers. Topic classifications, marks and planning estimates are provisional.