Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Ravi Kiran

CBSE CLASS XII

Output:

The original value is 10
Return value of function change() is 20
The value after function change() is over 20

Q. 1. b. Name the header files to which the following belong: (i) abs( ) (ii) strcmp( )

Ans:

(i) abs( ) - stdlib.h, math.h, complex.h
(ii) strcmp( ) - string.h

Q.1. c. Rewrite the following program after removing the syntactical error(s), if any. Underline each correction.
#include<iostream.h>
const int Multiple 3;
void main( )
{ value = 15;
for(int Counter = 1;Counter = <5;Counter ++, Value -= 2)
if(Value%Multiple = = 0)
cout<<Value * Multiple;
cout<<end1;
else
cout<<Value + Multiple <<endl; }

Ans:

#include<iostream.h>
const int Multiple=3;
void main( )
{
int Value = 15;
for(int Counter = 1;Counter <=5;Counter ++, Value -= 2)
if(Value%Multiple == 0)
{
cout<<Value * Multiple;
cout<<endl;
}
else
cout<<Value + Multiple <<endl;
}

Q.1.e. Find the output of the following program
#include<iostream.h>
#include<string.h>
#include<ctype.h>
void Convert(char Str[ ],int Len)
{ for(int Count=0;Count<Len;Count++)
{ if(isupper(Str[Count]))
Str[Count]=tolower(Str[Count]);
else if (islower(Str[Count]))
Str[Count]=toupper(Str[Count]);
else if(isdigit(Str[Count]))
Str[Count]=Str[Count]+1;
else Str[Count]=’*’;
}
}
void main( )
{ char Text[ ]=”CBSE Exam 2005”;
int Size = strlen(Text);
Convert(Text,Size);
cout<<Text<<endl;
for(int C=0,R=Size – 1;C<=Size/2;C++,R--)
{ char Temp=Text[C];
Text[C]=Text[R];
Text[R]=Temp;
}
cout<<Text<<endl;
}

Paper By Mr. Ravi Kiran
Email Id : [email protected]