Important Questions

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

CBSE CLASS XII

(c) #include <iostream.h>
const int Multiple=3;
void main ()
{
int Value=15;
for (int Counter = 1;Counter<=5;Counter++,Value-=2)
if (Value%Multiple==O)
cout<<Value * Multiple<<endl;
else
cout<<Value+Multiple<<endl;
}
OR
#include <iostream.h>
const int Multiple=3;
void main ()
{
int Value=15;
for (int Counter = 1;Counter<=5;Counter++,Value-=2)
if (Value%Multiple==O)
{ 4
cout<<Value * Multiple;
cout<<endl;
}
else
cout<<Value+Multiple<<endl;
}
[1/2 Mark for each correction]

OR

[Only 1/2 for only identifying all the errors]
(d) 10×15×6
11×16×6
10×16×11

2. (a) Data hiding is a method of keeping the data in private or protected visibility modes to avoid
their access From outside its scope.
For example:
class Sample
{
int Data; //Data will not be accessible from the object
public:
void Function( );
} ;

(c) class TravelPlan
{
long PlanCode;
char Place[20];
int Number_of_travellers;
int Number_of_buses;
public:
TravelPlan();
void NewPlan();
void ShowPlan()
};
TravelPlan::TravelPlan()
{
PlanCode=1001;
strcpy(Place,”Agra”);
Number_of_travellers=5;
Number_of_buses=1;
}
void TravelPlan::NewPlan()
{
cin>>PlanCode;
gets(Place);
cin>>Number_of_travellers;
if (number_of_travellers<20)
numer_of_buses=1;
else if (number_of_travellers<40)
numer_of_buses=2;
else numer_of_buses=3;
}
void TravelPlan::ShowPlan()
{
cout <<PlanCode<<endl<<Place<<endl
<<Number_of_travellers<<endl
<<Number_of_buses<<endl;
}

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