PROGRAMS NORMAL PROGRAM 1. Wap to display months in words where month in number is input. 2. Wap to print Fibonacci series till n elements. 3. Wap to reverse 4 digit numbers. 4. Wap to accept a number separate out digits and print sum of all digits and also print separated digits. 5. Wap to check whether given input in even and odd. 6. Wap a menu driven program to calculate sin(x), cos(x), tan(x) and exit to dos. 7. Wap to take input as a number and calculate/print its square, cube, and forth power without any unnecessary calculations. 8. Wap to print 4 s table. 9. Wap to reverse a given number. 10. Wap to print all the prime no between r1 and r2.(where r1<r2). 11. Wap to calculate GCD and LCM. 12. Wap to calculate y where y=x n where y, x are real and n is natural no. 13. Wap to find factorial of given number. 14. menu driven program to 1.add 2.sud 3.mul 4.exit Program will quit when 4 is inputted else cal respective function to perform given operation. Page 1
ARRAYS 1. Wap to find largest in given list of n elements and also print its position. 2. Wap to delete specified element in array. 3. Wap to accept n multiply 20 real numbers. 4. Take an array (100), compute sum and average. then count the number of values Of x greater than the average and the number less than the average. print the Values, the average and the two counts. 5. Wap to take names and marks of 50 students and print them out in descending order of marks. 6. Wap to print the largest and the second largest elements in an array of n elements. 7. Wap to calculate distance s of an object in free fall. the formula is S=S1+V!*t+1/2at 2 Make the table of s for t=1, 5, 10, 15, 20, 25,..100. 8. Wap that builds tables of the tip speed of propeller having diameter d (an input value) for various shrank speeds, measured in revolutions per minute. Let s= 1000, 2000, 3000..80000. store the tip speeds and shrank speed in the table then print the tables. The formula for computing the angular velocity in radians/second. W=2 s/60 and the speed= (w*d)/2. 9. Wap to accept A(amount deposited),i(interest rate per year) and n (no. of years) from user and print F. F=A[(1+i/100) 1 +(1+i/100) 2 +(1+i/100) 3 +(1+i/100) n ] 10. Wap to calculate mean, variance and standard deviation of a set of numbers using the following formula. n Mean=1/n xi i=1 n Variance= 1/n (xi-mean) 2 i=1 Standard deviation=squareroot (variance) 11. One dimensional array a[j] has n elements. o Wap to cyclically permutes the values of A so that a[2] contains a[1],a[3] o Wap to interchange a[1]and a[2] if a[1]>a[2]and a[3]>a[4] so on Page 2
STRING OPERATION RELATED PROGRAM 1. Check whether the given string is palindrome or not. 2. Wap to remove extra blank places. 3. Wap to concate two strings in one. 4. Wap to reverse the given string. 5. Wap to accept no. in format 1,000 and print 1000. 6. Wap to find duplicate in the array and print the array without duplicate. 7. Wap to count the frequency of a given character in the string. 8. Wap to check whether given substring s2 exists in the string s1. 9. Wap to find all permutation of string. MATRIX RELATED PROGRAMS 1. Wap to make a magic square matrix of 3,5,7,9,11,13,15. 2. wap to take n x m matrix and print back only even rows elements row wise. 3. Wap to check that whether (A*B)^t=A^t*B^t Where matrix a is of M*L and matrix b is of L*N. 4. Wap to check whether matrix in symmetric or not. (A=A T ). 5. Wap to check whether given matrix is diagonal or not. 6. Wap to print only even no. of rows. 7. Wap to add, subtract, multiply two matrixes. 8. Find all the minmax or Saddle point in the given matrix. (Saddle point or minmax point is the point which is minimum in its row and Maximum in its column) Page 3
FUNCTIONS 1. wap to illustrate parameter passing technique to add two numbers. Call add (a,b, c) where a, b are parameters and c is reference to store answer. 1. Wap to print Fibonacci series till n elements using fibo(). 2. Wap recursive function to calculate GCD of given no. 3. Wap recursive function to calculate factorial of a given number. 4. Wap to calculate bio where bio=n! /(r!*(n-r)!) r,n are natural numbers. Use functions bio (). STRUCTURES 1. Wap to declare c structure for computer configuration having cpu type,sdrae-size, clock speed, hdd size, cdrome type(rom,r/w), cd rom speed, mouse-type, keyboard type, SVGA_monitor_make. Read info of 50 computers and list computers more than 8GB. 2. Wap to accept player s name, country, no of matches played and batting average. And print the list in descending order of the batting average. 3. Wap to accept records n students with structure name, date of birth, total marks obtained also use structure DOB to represent date of birth. Print the list in descending order of total marks. 4. Wap to declare structure for employee having name, e-code, salary. Read information for 30 employees and list only having salary greater than 10000. Page 4
OTHER PROGRAMS 1. Wap to print A B C D C B A A B C B A A B A A 2. Wap to print Pascal s triangle. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 3. Floyd's triangle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Page 5
FROM THE CONCEPTS OF OOPS 1) Write a program in C++ to download + = operator to add 2 distances given in feet and inches. (10 Marks) 2) An educational institution wishes to maintain a database of its employees. The database is divided into a number of classes, as shown below. Specify all the classes and define functions to create a database and retrieve individual information as and when required. Assume necessary data. (10 Marks) Staff Code name Teacher Officer Subject Typist Grade experience Speed dept. experience Regular Basic sal. Casual Duration 3) Using constructor write a program in C++ to generate first n terms of Fibonacci Series. Fibonacci Series is 0,1. 1,2,3,5,8.. (10 Marks) Page 6
4) Create a class Float that contains one Float data member, overloaded all the four arithmetic operators so that they operate on the objects of FLOAT. 5) Create a base class Rectangle that contains Length and Width as data members. From this class drive a class named Box that has additional data members named depth. The function members of base Rectangle class should consist of a constructor and an area () function. The derived Box class should have a constructor and an override function named area () that returns the surface area of Box and a Volume function. Write a C++ program on above class calling all the member functions. (10 Marks) 6) Write a class to represent a vector (a series of float values) include member functions to perform the following task: i) To create the vector ii) To modify the value of a given element iii) To multiply by a scalar value iv) To display the vector in the form (10,20,30 ) (10 Marks) 7) Create a base class called shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to the base class, a member function get_data () to initialize base class data members and another member function display_area () to compute and display the area of figures. Make display_area () as a virtual function and redefine this function in the derived classes to suit their requirements. Using these 3 classes, design a program that will accept dimensions of a rectangle and display the area. Remember the two values given as input will be trated as lengths of two sides in the case of rectangles, and as base and height in the case of triangles, and used as follows: Area of rectangle = x*y Area of triangle = (1/2)*x*y (9 Marks) 8) Write programs to evaluate different functions to 0.0001% accuracy: 1) sin x = x- (x3/3!)+(x5/5!)-(x7/7!)+.. 2) cos x = 1-(x2/2!)+(x4/4!)-(x6/6!)+ (5 Marks) Page 7
9) An educational institution wishes to maintain a database of its students. The database is divided into number of classes, whose relationships are shown below. Fig. below also shows the minimum information required for each class. Specify all the classes and define functions to create the database and retrieve individual information as and when required. (12 Marks) Student Roll no. Sports Score Test Mark 1 Mark 2 Results Score 10) Develop a class for linked list (Dynamic data structure) with the following member functions to carryout the following: (20 Marks) (i) Create a linked list of store set of integer data. (ii) Display the Linked list. (iii) Insert a node containing data in a sorted list (iv) Delete a node from the list containing a specific data. Use object as node rather than using a struct variable to model a node. Page 8
SEMESTER 2 CP II JAVA PROF. JOIN SOON Page 9