Escolar Documentos
Profissional Documentos
Cultura Documentos
Class-XII
List of Programs (2009-10)
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
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
3. Write program to accept a string and display the following menu with out using built-
in functions: -
o String Length.
o Palindrome or not.
o Vowel count
o Change case.
ARRAYS & FUNCTIONS
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 resultant 2D array is given below The resultant 2D array is
1 2 3 4 5 6 given below
1 2 3 4 5 0 1 2 3
1 2 3 4 0 0 1 2 0
1 2 3 0 0 0 1 0 0
1 2 0 0 0 0
1 0 0 0 0 0
STRUCTURES ( Wt. 2)
6. Create a structure student with following members
Roll Name Address Father’s Marks in 5
No. Name Subjects
Add1 A Pin
dd2 Code
Write menu driven program which calls following functions :
• Void create_array(student s[10], int n); // for creating array of structure
student
• Void show_array(student s[10], int n); // for displaying array of structure
student
• Void merit_List(student s[10], int n); //Merit List Generation: - should have the
roll no., name, marks in 5 subjects, total and average. Array to be sorted
according to total (Descending order).
• Void grade_report(student s[10], int n);//Grade report - should have roll no.,
name, total and grade of all the students.
Criteria for grade is -
Average Grade
>=90 A
<90 and >=75 B
<75 and >=60 C
<60 and >=40 D
<40 F
CLASSES (Wt. 2)
8. 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 Binary_search()
};
9. 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 showDiagonal2( );
};
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
10. Write a program to store the record of an employee with the following details: -
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: -
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.
CONSTRUCTOR
11. Write a program to accept the number and compute the factorial.
12. Write a program to generate Tribonacci series.
INHERITANCE
13. Consider the classes:
class person{
private:
char name[20];
protected:
int age;
public:
void readdata();
void displdata();
};
class employee:public person
{
char department[20];
protected:
float salary;
public:
void read();
void write();
float retsal { return salary;}
int retage(){ return age;}
int retdep(char *d)
{ if (strcmp(d,department) == 0)
return 1;
else
return 0;}
};
Complete the above classes and write main function having 5 employees (array of
employee) and display a menu:
1. Create
2. Search on the basis of age
3. Search on the basis of department
4. Search on the basis of salary
FILE HANDLING
14. Write a program to accept a text file name and display: -
Number of characters
Frequency Table
o No of Uppercase character
o No of Vowels
o No of Digits
o No of Words
Number of lines
15. Write a program to accept the text file name and display the following menu: -
(OPTIONAL)
Find and replace every character with its subsequent character
Replace lowercase character with uppercase character
16. Write a program to accept a source file and target file and display the following
menu: - (OPTIONAL)
Copy contents source to target
Change case of source to target
Replace many spaces to one space
Change contents like “AASTHA” to “aaSTHa”
26.Write a program to perform various queue operations like insert(), delete(), display()
on a linked queue having 1 integer and 1 floating type data.
Struct Node
{
int x;
float y;
Node *link;
};
28. Write the outputs of SQL commands given in (h) with the help of the table shown.
EmpNo Name Job Mgr Hiredate Sal Deptno
Integer Character Character Float Date Float Integer
29.Write the SQL command for (a) to (f) on the basis of the table given below
(DIRECTORY).
DIRECTORY
No. Fname Lname Phone Address
Integer Character Character Float Character
To select all the information of employee of Rohini area.
Update the database set the phone no. as 7047645 where phone number is
7057456.
To create a view called Dir with the following fields-> Fname, Phone and Address.
To display the data for Arpit, Rahul and Kisan.
To delete the rows where the address is Rohini.
To delete the table physically.