CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran
CBSE CLASS XII
Q.1.b. Name the header file to be included for
the use of the following built in functions.
(i)getc( ) (ii)strcat() 1
Ans:
(i) getc( ) - stdio.h
(ii) strcat( ) - string.h
Q.1.e. Give the output of the following program.
#include<iostream.h>
#include<conio.h>
int g=20;
void func(int &x,int y)
{ x=x-y;
y=x*10;
cout<<x<<’,’<<y<<’\n’;
}
void main( )
{ int g=7;
func(g,::g);
cout<<g<<’,’<<::g<<’\n’;
func(::g,g);
cout<<g<<’,’<<::g<<’\n’;
}
Ans:
Output:
-13,-130
-13,20
33,330
-13,33
Q.1.f. Write a function named SUMFIN( ), with
arguments x, N, which returns the sum of N
terms of the following series.
x – x^3/3 + x^5/5 – x^7/7 + x^9/9
#include<iostream.h>
#include<math.h>
#include<conio.h>
double SUMFIN(int x1,int n1);
void main()
{ int x;
int n;
clrscr();
cout<<"Enter the vaue of X and N";
cin>>x>>n;
cout<<”\nThe sum of Series = “<<SUMFIN(x,n);
getch();
}
double SUMFIN(int x1,int n1)
{ double sum=0;
int c=0;
for(int i=1;i<=(2*n1);i=i+2)
{ c=c+1;
if(c%2==1)
{ sum=sum+(pow(x1,i))/i;
}
else
{ sum=sum-(pow(x1,i))/i;
}
}
return sum;
}
Paper By Mr. Ravi Kiran
Email Id : [email protected] |