Sei sulla pagina 1di 7

Kulachi Hansraj Model School Computer Science (083) Class-XII List of Programs (2010-11)

SERIES (Wt. 1) 1. Write a function to generate the following series using functions passing the required parameters:a. 1 + x2/2! + x3/3!.........xn/n! b. 1+x2/3!-x3/4!.........xn/n+1! MACROS(Wt. 1) 2. Write a program to define following macro/constant and their implementation: Area of rectangle Area of square Area of triangle Constant Max = 100 STRING Manipulation (Wt. 1) 3. Write program to accept a string and display the following menu with out using builtin functions: o String Length. o Palindrome or not. o Vowel count o Change case. ARRAYS & FUNCTIONS(Wt. 2) 4. Given two arrays of integers A and B of sizes M and N respectively. Write a function named MIX() which will produce a third array named C, such that the following sequence is followed : (HOTS) All even numbers of A from left to right are copied into C from left to right. All odd numbers of A from left to right are copied into C from right to left All even numbers of B from left to right are copied into C from left to right. All odd numbers of B from left to right are copied into C from right to left A, B and C are passed as arguments to MIX(). e.g. : A is {3,2,1,7,6,3} and B is {9,3,5,6,2,8,10}, the resultant array C is {2,6,6,2,8,10,5,3,9,3,7,1,3} 5. Write a function in C++ which accepts an integer array and its size as arguments / parameters and assign the elements into a two dimensional array of integers in the following format (HOTS) If the array is 1, 2,3,4,5,6 If the array is 1,2,3

The 1 2 1 2 1 2 1 2 1 2 1 0

resultant 2D array is given below 3 4 5 6 3 4 5 0 3 4 0 0 3 0 0 0 0 0 0 0 0 0 0 0

The resultant 2D array is given below 1 2 3 1 2 0 1 0 0

CLASSES (Wt. 3+2+1) 6. Define following class and make menu driven program to call its functions. class array { int a[10]; int n; public: void createarray(); void showarray(); void insertion_Sort(); void selectsort(); void bubble_sort(); void Binary_search(); void Linear_search(); };
7. Define following class and make menu driven program for doing various operations: class arr2d { int a[10][10]; int m,n; public; void create2D( ); void show2D( ); void show2D_LOWER1( ); void show2D_LOWER2( ); void show2D_UPPER1( ); void show2D_UPPER2( ); void show_Diagonal1( ); void show_Diagonal2( ); }; Assuming the2D array to be a square matrix with odd dimensions , i.e 3x3, 5x5,7x7, etc Example if the array content is 543 678 129 Output through the function void show_Diagonal1( ) and void show_Diagonal2( ) should be

Diagonal one : 5 7 9 Diagonal two : 3 7 1 . Output through the function void show2D_LOWER1( ) and show2D_LOWER2( ) should be 5 3 67 7 8 129 1 2 9 Output through the function void show2D_UPPER1( ) and show2D_UPPER2( ) should be 543 543 78 67 9 1 8. Consider the following class employee Private members: Data members EmpNo Integer Name Character Address Character Pin code Character Basic Salary Float HRA Rate Float DA Rate Float PF Rate Float HRA Float DA Float PF Float GROSS Float NET Float Calculate() to calculate HRA, DA, PF, GROSS and net salary Public: Retempno() function to return empno Retename() function to return employee name Readdata() to accept employee no, name, address, pincode, Basic salary, HRA rate, DA rate and PF rate. Invoke function calculate() to calculate HRA, DA, PF, GROSS and net salary Displaydata() to display employee no, name, address, pincode, Basic salary, HRA, DA, PF, GROSS and net salary of the employee Display the following menu for atleast 5 employees (Array of employee type): o Create. To accept data of 5 employee o Salary statement. To display payslip of 5 employee o Query in employee number. To accept empno and display relevant data o Query on employee name. To accept employee name and display relevant data.

9. Consider the classes: class student{ protected: int roll; char name[10]; public: void read_roll(); void show_roll(); int return_roll() { return roll; } }; class test:public student { protected: float unit1, unit2; public: void get_marks(); void show_marks(); }; class sports { protected: char grade; public: void get_grade(); void show_grade(); }; class result : public test , public sports { float total; public: void show_result(); };

INHERITANCE(Wt. 1)

Complete the definition of above mentioned classes and write main function for processing result of 5 students (array of result) and display a menu: 1. Create (array of 5 result) 2. show result of all 3. Search on the basis of roll no. and display result if roll no found 4. Exit

FILE HANDLING (Wt. 5) 10. Write a program to accept a text file name and display: Number of characters Frequency Table No of Uppercase character No of Vowels No of Digits o No of Words (considering words are separated by a space) o Number of lines 11. Write a program to accept the text file name and do the following (Use modular approach, use seekg(), seekp(), tellg() , tellp() functions as required for the same) Encode file (by replacing every character with its subsequent character) Decode file (back to original contents) 12. Write a program to accept a source file name and target file name and display the following menu: Copy contents source to target Change case of source to target Replace many spaces to one space (if words are separated by more than one space. The function must return total no. of spaces removed) 13. Consider the following structure struct STUD { int Rno; char Name[20]; }; Write the program which displays the following menu and allows following file operations (assuming the binary file is containing the objects of the above mentioned structure) Create New file Display all records Display record of particular roll no. if present (Search) Exit NOTE : Define separate functions for above mentioned operations 14. Write a program to create an employee class having the following data members: Private Emp_no Integer Name Character Basic Float

HRA Float DA Float PF Float Public Readata() To accept the data Retempno() Function to return employee no. Showdata() To show the data And display the following menu: - NOTE : Define separate functions for operations Create New file (with 5 records) Add Record (in existing file) Modify record of particular employee (Using one file) Search (On the basis of Name) Display All records Exit

Potrebbero piacerti anche