Lab Manual Program Design and File Structures (P): IT-219
Lab Instructions Several practicals / programs? Whether an experiment contains one or several practicals /programs One practical / program Lab Teacher forms groups of the students based on All Students need to perform the practical/program Assign all practicals /programs among all groups Teacher decides whether the completed practicals / programs can be appropriately described using flow chart, algorithm, query statement, etc. Teacher issues necessary instructions to the students for writing practicals / programs accordingly Students write experiments in practical files and get them signed by the lab teacher Students make entries in the list of contents of the practical files and get them signed by the lab teacher Whether practical has been verified and signed by the lab teacher?? If a student has not completed a practical, he/she is expected to complete it at his/her own with the help of his/her fellow students in his/her hostel The student completes the practical file and submits it to the concerned teacher in his/her office or mail box on next working day In case of an experiment containing several practicals, a lab teacher needs to think whether a practical performed by the students in one group needs to be repeated by the other groups in lab on the same day? OR A practical performed by the students in one group needs to be repeated as assignments to be completed by the students of other groups in their hostels? Here, an assignment includes both executing a program on computer and also writing the same in practical file. OR A practical performed by the students in one group needs to be repeated as assignments, only writing practicals in their practical files, for the students of other groups in their hostels? Teacher issues necessary instructions to the students accordingly.
L T P - - 2 Lab Manual Program Design and File Structures (P) IT-219 Practical exam: 40 Sessional: 60 NOTE: Implement the following using C Language on Linux or Windows like platform. Experiment 1 I. Write a program to calculate all the factors of a given integer number. Write a program to calculate Primes in a Range (Using a function that checks if an integer n is a prime). I Write a program to compute exponential Function (e x = 1 + x + x 2 / 2! + x 3 / 3! + + x n / n!). Write a program to open a file and write data to that. V. Write a program to develop scientific calculator. VI. Write a program to print a circular matrix of given order. Like for order 3. 1 2 3 8 9 4 7 6 5 V Write a program to check whether the binary representation of an integer is pallindrom or not. Experiment 2 I. Write a program to check whether a year is leap year or not. Write a program to print the value of f(x) = ax 2 + bx + c for a = 1.0, b=2.0 and c = 1.0 for x = 3.0, and 4.0 respectively. I Compute Julian Day (Julian day is the number of days inclusive for a day counting from new year day inclusive. January 20 is Julian day 20, April 15 is Julian day 31 + 1
28 + 31 + 15 = 105 for an ordinary year and April 15 is Julian day 31 + 29 + 31 + 15 = 106 for a leap year). Write a program to find the roots of a quadratic equation. (Real and Imaginary, Take the values of a, b and c from user). V. Write a program to compute the value of ncm using Recursion where n and m are input by user. VI. Write a program to print pascal triangle. Example pascal triangle of order 3 is 1 1 2 1 1 3 3 1 V Read an integer number of a fixed length and then print its digits separated by spaces. For example if 364 is the input then the output should be 3 6 4. Experiment 3 I. Write a program to check whether a number is odd or even. I Write a program for base conversion (a decimal to another base like binary, octal). Write a program to print diamond pattern. (Use * to print the pattern). Write a program to Generate the first n terms of the Fibonacci series. The first and second terms in the sequence are 0 and 1. V. Write a program to read three values from keyboard and print out largest of them without using if statement. VI. V Write a program to check whether a number is Armstrong or not (e.g. 153=13+53+33). Write a program to solve Towers of Hanoi problem. 2
Experiment 4 I. Write a program to add n numbers which will be entered by user without using any array. I Write a program to check whether a given number is palindrome or not. Write a program to find the day on given date. Write a program that insert a sub-string into given main string from a given position. V. Write a program to find sum like-1+2*3+3*4*5+4*5*6*7 +n*(n+1) *(2n-1) where n is input by the user. VI. Write a program to generate a magic square of odd order like magic square of order 3 is 8 1 6 3 5 7 4 9 2 V Write a program to add two matrix.(no need to take the matrix from user) Experiment 5 I. Write a program to find the GCD (greatest common divisor) of two given integers in recursive and non recursive way. I Write a program to check whether input alphabet is vowel or not. Write a program to find all the combinations of 1, 2 and 3. Write a program, which takes two integers operands and one operator from the user, performs the operation and prints the result.(consider the operators +,-,*,/,% and use switch Statement). V. Write a program to delete the duplicate element of an array in order of O(n) time complexity. VI. Write a program to count the words and characters in a given sentence. V Implement a GUI/Mouse driven simple calculator. 3
Experiment 6 (File Handling) I. Write a program to Create a File & Store Information. I Write a program to illustrate Reading of Data from a File and to delete or replace a specific Line from a Text File. Write a program that Merges Lines Alternatively from 2 Files & Print Result. Write a program to Create Employee Record and Update it. V. Write a program to Convert the Contents of File to Lower case and replace First Letter of every Word with Capital Letter. VI. V Write a program to Count No of Lines, Blank Lines, Comments in a given Program and also Reverse the Contents of a File and Print it. Write a program to Create Employee File Name Record that is taken from the Command-Line Argument. Experiment 7 (Hashing) I. Write a program to implement Division-Remainder hashing. I Write a program to implement Mid-Square hashing. Write a program to implement Folding hashing. Write a program to implement Division-Remainder hashing. V. Write a program to calculate load factor. VI. V VI Write a program to calculate Linear probing. Write a program to calculate double hashing. Write a program to calculate synonym chaining. 4
Experiment 8 (B-Tree and Merging) I. Write a program that builds a B-tree of order 3 from an input sequence of key values. Write a program to traverse a B-tree of order 3 in sequence by key value. I Write a program to locate a given key value in a B-tree of order 3. Write a program to maintain a B-tree of order 3. Be able to accommodate key insertions and deletions. V. Write a program to implement Natural merge VI. Write a program to implement Balanced merge V Write a program to implement Cascade merge 5