Friday, 7 August 2015

Unknown

Syllabus For Class XII Computer Science

Class XII (Theory) – C++

Duration: 3 hours Total Marks: 70



Unit 1: Object Oriented Programming in C++ (50 Theory + 40 Practical) Periods
REVIEW: C++ covered In Class – XI,
Object Oriented Programming: Concept of Object Oriented Programming – Data hiding, Data
encapsulation, Class and Object, Abstract class and Concrete class, Polymorphism
(Implementation of polymorphism using Function overloading as an example in C++); Inheritance,
Advantages of Object Oriented Programming over earlier programming methodologies,
Implementation of Object Oriented Programming concepts in C++: Definition of a class,
Member of a class – Data Members and Member Functions (methods), Using Private and Public
visibility modes, default visibility mode (private); Member function definition: inside class
definition and outside class definition using scope resolution operator (::); Declaration of objects
as instances of a class; accessing members from object (s), Objects as function arguments–pass by
value and pass by reference;
Constructor and Destructor: Constructor: special characteristics, declaration and definition of a
constructor, default constructor, overloaded constructors, copy constructor, constructor with
default arguments;
Destructor: Special Characteristics, declaration and definition of destructor;
Inheritance (Extending Classes): Concept of Inheritances, Base Class, Derived classes, protected
visibility mode; Single level inheritance, Multilevel inheritance and Multiple inheritance, Privately derived, publicly derived and Protectedly derived class, accessibility of members from objects and
within derived class (es);
Data File Handling: Need for a data file, Types of data files – Text file and Binary file;
Text File: Basic file operations on text file: Creating/Writing text into file, Reading and
Manipulation of text from an already existing text File (accessing sequentially).
Binary File: Creation of file, Writing data into file, Searching for required data from file,
Appending data to a file, Insertion of data in sorted file, Deletion of data from file, Modification
of data in a file;
Implementation of above mentioned data file handling in C++;
Components of C++ to be used with file handling:
Header file: fstream.h; ifstream, ofstream, classes;
Opening a text file in in, out, and app modes;
Using cascading operators (>><<) for writing text to the file and reading text from the file; open
(), get (), read () put (), write(), getline() and close() functions; Detecting end-of-file (with or
without using eof() function), tellg(), tellp(), seekg().seekp();
Pointers:
Introduction to Pointer, Declaration and Initialization of Pointer; Dynamic memory allocation/deallocation
operators: new, delete; Pointers and Arrays: Array of Pointers, Pointer to an array (1
dimensional array), Function returning a pointer, Reference variables and use of alias; Function
call by reference. Pointer to structure: De-reference/Deference operator: *, ->; self referencial
structure;
Unit 2: Data Structures (42 Theory + 36 Practical) Periods
Introduction to data structure- array, stack queues primitive and non-primitive data structure,
linear and non-linear structure, static and dynamic data structure.
Arrays:
One and two Dimensional arrays: Sequential allocation and address calculation;
One dimensional array: Traversal, Searching (Linear, Binary Search), Insertion of an element in an
array, deletion of an element from an array, Sorting (Insertion, Selection, Bubble)
Two-dimensional arrays: Traversal Finding sum/difference of two NxM arrays containing numeric
values, Interchanging Row and Column elements in a two dimensional array;
Stack (Array and Linked implementation of Stack):
Introduction to stack (LIFO_Last in First out Operations)
Operations on stack (PUSH and POP) and its Implementation in C++, Converting expressions from
INFIX to POSTFIX notation and evaluation of Postfix expression;
Queue: (Array and Linked Implementation)
Introduction to Queue (FIFO – First in First out operations)
Operations on Queue (Insert and Delete and its Implementation in C++, circular queue using array.

Tuesday, 4 August 2015

Sorting Techniques

Unknown

Sorting Techniques


/* Sorting ==> Bubble Sort technique */

#include<iostream.h>
#include<conio.h>
#define max 100

void main()
{
int arr[max], len, i, j, temp;
cout<<"Entre the size of array :\t";
cin>>len;

for(i=0; i<len; i++)
{
cout<<"Enter element "<<i+1<<" : ";
cin>>arr[i];
}

cout<<"\n Original array is :\n";
for(i=0; i<len; i++)
{
cout<<arr[i]<<" , ";
}

//Sorting starts here

for(i=0; i<len; i++)
{
for(j=0; j<len-1; j++)
{
if(arr[j] >arr[j+1])
{
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
       //Sorting over

//Display sorted list

cout<<"Sorted array is :\n";

for(i=0; i<len; i++)
{
cout<<arr[i]<<"  ";
}

getch();
}

/* Sorting ==> Selection Sort technique */


#include<iostream.h>
#include<conio.h>
#define max 100

void main()
{
int arr[max], len, i, j, temp;
cout<<"Entre the size of array :\t";
cin>>len;

for(i=0; i<len; i++)
{
cout<<"Enter element "<<i+1<<" : ";
cin>>arr[i];
}

cout<<"\n Original array is :\n";
for(i=0; i<len; i++)
{
cout<<arr[i]<<" , ";
}

//Sorting starts here

         for(i=0; i<len-1; i++)
 {
               int low = arr[i];
               int p = a[i];
for(j=i+1; j<len; j++)
{
if(low>arr[i])
{
low = arr[i];
                                p = i;
}
}
         if(p != i)
         {
                temp = arr[i];
                arr[i] = arr[p];
                arr[p]=temp;
}
       }
       //Sorting over

//Display sorted list

cout<<"Sorted array is :\n";

for(i=0; i<len; i++)
{
cout<<arr[i]<<"  ";
}

getch();
}

Monday, 3 August 2015

Project programs for cbse 2016

Unknown


Project Programs for CBSE Class XII


Q1. WAP to generate an Anti-Spiral matrix.

Solution :

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[20][20],x,y,n,s,p;
cout<<"Enter size (even no.):";
cin>>s;
cout<<"Enter number:";//entry of starting no
cin>>n;
s--;
p=s/2;
for(x=p;x>=0;x--)//filling of elements in required order
{
  for(y=x;y<=(s-x);y++)
    a[x][y]=n++;
  for(y=(x+1);y<=(s-x);y++)
    a[y][s-x]=n++;
  for(y=s-(x+1);y>=x;y--)
    a[s-x][y]=n++;
  for(y=s-(x+1);y>x;y--)
    a[y][x]=n++;
}
cout<<endl;
for(x=0;x<=s;x++)//display of matrix after filling
{
  for(y=0;y<=s;y++)
    cout<<a[x][y]<<"\t";
  cout<<endl<<endl;
}
getch();
}


/*     OUTPUT

Enter size (even no.):4
Enter number:5

9       10      11      12

20      5       6       13

19      8       7       14

18      17      16      15

*/

Q2. WAP to find future date.

Solution :

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int d,m,y,da;
cout<<"enter date in dd-mm-yyyy format:";
cin>>d;cout<<"-";cin>>m;cout<<"-";cin>>y;
cout<<"enter no. of days:";
cin>>da;
while(da>0)
{
if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
{
if(d<31)
{
 d++;
 da--;
 continue;
}
if(d==31 && m!=12)
{
 m++;
 d=1;
 da--;
 continue;
}
if(d==31 && m==12)
{
 y++;
 m=1;
 d=1;
 da--;
 continue;
}
}
if(m==4 || m==6 || m==9 || m==11)
{
if(d<30)
{
 d++;
 da--;
 continue;
}
if(d==30)
{
 m++;
 d=1;
 da--;
 continue;
}
}
if(m==2)
{
  if(y%4==0)
  {
if(d<29)
{
 d++;
 da--;
 continue;
}
if(d==29)
{
 m++;
 d=1;
 da--;
 continue;
}
  }
  else
  {
if(d<28)
{
 d++;
 da--;
 continue;
}
if(d==28)
{
 m++;
 d=1;
 da--;
 continue;
}
  }
}
}
cout<<"the future date= "<<d<<"-"<<m<<"-"<<y;
getch();
}


/*     OUTPUT

enter date in dd-mm-yyyy format:11 05 2000
--enter no. of days:200
the future date= 27-11-2000


*/

Q3.WAP to find the number of days between two dates.

Solution :

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int d,m,y,da=0,d2,m2,y2;
cout<<"enter 1st date in dd-mm-yyyy format:";
cin>>d;cout<<"-";cin>>m;cout<<"-";cin>>y;
cout<<"enter 2nd date in dd-mm-yyyy format:";
cin>>d2;cout<<"-";cin>>m2;cout<<"-";cin>>y2;
while(d!=d2 || m!=m2 || y!=y2)
{
da++;
if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
{
if(d<31)
{
 d++;
 continue;
}
if(d==31 && m!=12)
{
 m++;
 d=1;
 continue;
}
if(d==31 && m==12)
{
 y++;
 m=1;
 d=1;
 continue;
}
}
if(m==4 || m==6 || m==9 || m==11)
{
if(d<30)
{
 d++;
 continue;
}
if(d==30)
{
 m++;
 d=1;
 continue;
}
}
if(m==2)
{
  if(y%4==0)
  {
if(d<29)
{
 d++;
 continue;
}
if(d==29)
{
 m++;
 d=1;
 continue;
}
  }
  else
  {
if(d<28)
{
 d++;
 continue;
}
if(d==28)
{
 m++;
 d=1;
 continue;
}
  }
}
}
cout<<"The number of days="<<da;
getch();

}

Q4. WAP to find the number of vowel pairs in an entered string.

Solution :

#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char s[100],v[10]="AEIOUaeiou";//string of all vowels to be checked
int l,a[5][5],x,y,c1,c2,f,p1,p2;
for(x=0;x<5;x++)
{
  for(y=0;y<5;y++)
    a[x][y]=0;
}
cout<<"Enter sentence:";
cin.getline(s,100);
l=strlen(s);
for(x=0;x<l-1;x++)
{
  f=0;
  c1=s[x];
  c2=s[x+1];
  for(y=0;y<10;y++)
  {
    if(c1==v[y])
    {
      p1=y;
      for(y=0;y<10;y++)
      {
if(c2==v[y])
{
 p2=y;
 f=1;
}
      }
    break;
    }
  }
  if(f==1)
  {
    if(p1>4)
      p1-=5;
    if(p2>4)
      p2-=5;
    a[p1][p2]++;
  }
}
cout<<"\n\nVovel pairs are:\n\n\n";
cout<<"\t";
for(x=0;x<5;x++)
  cout<<v[x]<<"\t";
cout<<endl<<endl;
for(x=0;x<5;x++)
{
  cout<<v[x]<<"\t";
  for(y=0;y<5;y++)
    cout<<a[x][y]<<"\t";
  cout<<endl<<endl;
}
getch();

}

Q5. WAP to enter a number and print it in words.

Solution :

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,r;
char na1[9][5]={"one","two","three","four","five","six","seven","eight","nine"};
char na2[8][7]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninty"};
char na3[10][9]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sisteen","seventeen","eighteen","nineteen"};
cout<<"Enter number:";
cin>>n;
if(n>=1000)//checking thousand'th digit for n>1000
{
r=n/1000;
n=n%1000;
r--;
cout<<na1[r]<<" thousand ";
}
if(n>=100)//checking hundered'th digit for n>100
{
r=n/100;
n=n%100;
r--;
cout<<na1[r]<<" hundred ";
}
if(n>=20)//checking last 2 digits for n>20
{
r=n/10;
n=n%10;
r-=2;
cout<<" "<<na2[r];
}
if(n>=10)//checking unit digit for n>10
{
r=n%10;
n=0;
r--;
cout<<na3[r];
}
if(n>0)
cout<<" "<<na1[(n-1)];
getch();
}

/*   OUTPUT
Enter number:1254
one thousand two hundred  fifty four
*/

To be updated soon......
Gaurav Nigam