xii cbse previous year question paper

110
XII CBSE Previous Year Question Paper QUESTION NO 2 (c) 4 Marks

Upload: orlando-lynch

Post on 30-Dec-2015

72 views

Category:

Documents


0 download

DESCRIPTION

XII CBSE Previous Year Question Paper. QUESTION NO 2 (c) 4 Marks. (c) Define a class named ADMISSION in C++ with the following descriptions : Delhi 2006 4 Private members : AD_NO integer (Ranges 10 - 2000) NAME Array of characters(String) CLASS Character FEES Float - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: XII CBSE Previous Year Question Paper

XII CBSE Previous Year Question

Paper

QUESTION NO 2 (c)

4 Marks

Page 2: XII CBSE Previous Year Question Paper

(c) Define a class named ADMISSION in C++ with the following descriptions :

Delhi 2006 4Private members :AD_NO integer (Ranges 10 - 2000)NAME Array of characters(String)CLASS CharacterFEES FloatPublic Members :• Function Read_Data( ) to read an object of ADMISSION type• Function Display( ) to display the details of an object• Function Draw-Nos( ) to choose 2 students randomly. And display the details. Use random function to generate admission nos. to match with AD_NO.

Page 3: XII CBSE Previous Year Question Paper

(c) class ADMISSION{int AD_NO;char NAME[20]; //or any constant sizechar CLASS;float FEES;public:void Read_Data(){do{cin>>AD_NO;}while (AD_NO<10 || AD_NO>2000);

Page 4: XII CBSE Previous Year Question Paper

gets(NAME);cin>>CLASS;cin>>FEES;}void Display(){cout<<AD_NO;cout<<NAME;cout<<CLASS;cout<<FEES;}

Page 5: XII CBSE Previous Year Question Paper

void Draw_Nos();};(1 mark for proper syntax of class definition with correct class name and a semicolon to end the class definition)(1 mark for proper declaration of private members)(1 mark for proper definition of Read_Data())(1 mark for proper definition of Display())Note: No marks should be deducted forNot checking the range for AD_NO Not declaring or defining Draw_Nos(). (Mentioned as Draw- Nos() in the question paper)

Page 6: XII CBSE Previous Year Question Paper

(c) Define a class named HOUSING in C++ with the following descriptions :

Outside Delhi 2006 4Private membersREG_NO integer(Ranges 10 - 1000)NAME Array of characters(String)TYPE CharacterCOST Float

Page 7: XII CBSE Previous Year Question Paper

(c) Define a class named HOUSING in C++ with the following descriptions :

Outside Delhi 2006 4Public Members

• Function Read_Data() to read an object of HOUSING type• Function Display() to display the details of an object• Function Draw_Nos()to choose and display the details of 2 houses selected randomly from an array of 10 objects of type HOUSING. Userandom function to generate the registration nos. to match with REG_NO from the array.

Page 8: XII CBSE Previous Year Question Paper

(c) class HOUSING{int REG_NO;char NAME[20];char TYPE;float COST;public:void Read_Data();void Display();void Draw_Nos(HOUSING S);};

Page 9: XII CBSE Previous Year Question Paper

(c)void HOUSING::Read_Data(){cin>>REG_NO; //Validation not requiredcin>>NAME; //OR gets(NAME);cin>>TYPE; cin>>COST;}void HOUSING::Display(){cout<<REG_NO<<NAME<<TYPE<<COST<<endl;}

Page 10: XII CBSE Previous Year Question Paper

(c)

void HOUSING::Draw_Nos();//Ignore

(1/2 mark for proper syntax of class definition with correct class name and a semicolon to end the class definition)(1/2 mark for mentioning the proper visibility modes (private / public))(1 mark for proper declaration of private data members)

Page 11: XII CBSE Previous Year Question Paper

(1 mark for proper definition of Read_Data() with user entry for data members OR declaring a local object and entering the values of data members of this object )(1 mark for proper definition of Display())Note: As language of Third part of this question has ambiguity, it is required to be ignored. Moreover, if anyone has partially attempted the third part (i.e., Draw_nos function) and not attempted/not correctlyattempted Read/Display function, he/she should be given 2 Marks for Third part taking into consideration the marks for this question should not exceed the max. marks allocated (i.e. 4 marks) to this question 2 (c).

Page 12: XII CBSE Previous Year Question Paper

(c) Define a class Travel in C++ with the description given below :

Delhi 2007 4Private Members :T_Code of type stringNo_of_Adults of type integerNo_of_Children of type integerDistance of type integerTotalFare of type float

Page 13: XII CBSE Previous Year Question Paper

(c) Define a class Travel in C++ with the description given below :

Delhi 2007 4Public Members :• A constructor to assign initial values as follows :T_Code with the word “NULL”No_of_Adults as 0No_of_Children as 0Distance as 0TotalFare as 0

Page 14: XII CBSE Previous Year Question Paper

(c) Define a class Travel in C++ with the description given below :

Delhi 2007 4• A function AssignFare( ) which calculates and assigns the valueof the data member TotalFare as follows :For each AdultFare (Rs) For Distance (Km)500 >=1000300 <1000 & >=500200 <500

Page 15: XII CBSE Previous Year Question Paper

(c) Define a class Travel in C++ with the description given below :

Delhi 2007 4For each Child the above Fare will be 50% of the Fare mentioned in the above table.For example :If Distance is 750, No_of_Adults = 3 and No_of_Children = 2Then TotalFare should be calculated asNo_of_Adults * 300 + No_of_Children * 150i.e. 3 * 300 + 2 * 150 = 1200

Page 16: XII CBSE Previous Year Question Paper

(c) Define a class Travel in C++ with the description given below :

Delhi 2007 4

• A function EnterTraveK ( ) to input the values of the data membersT_Code, No_of_Adults, No_of_Children and Distance; andinvoke the AssignFare( ) function.• A function ShowTraveK) which displays the content of all thedata members for a Travel.

Page 17: XII CBSE Previous Year Question Paper

(c) class Travel{char TCode[5]; //OR char *Tcode;int No_of_Adults;int No_of_Children;int Distance;float TotalFare;public:Travel();void AssignFare();void EnterTravel();void ShowTravel();};

Page 18: XII CBSE Previous Year Question Paper

Travel::Travel(){strcpy(TCode,”NULL”);// OR TCode[0]=’\0’ OR strcpy(TCode,”\0”)// OR TCode=NULL if TCode is declared as char pointerNo_of_Adults = 0;No_of_Children = 0;Distance = 0;TotalFare = 0;}

Page 19: XII CBSE Previous Year Question Paper

void Travel::AssignFare(){if(Distance>=1000)TotalFare = 500*No_of_Adults+250*No_of_Children;elseif (Distance >= 500)TotalFare = 300*No_of_Adults+150*No_of_Children;elseTotalFare = 200*No_of_Adults+100*No_of_Children;}

Page 20: XII CBSE Previous Year Question Paper

void Travel::EnterTravel(){gets(TCode); // or cin >> TCode;cin>>No_of_Adults>>No_of_Children>>Distance;AssignFare();}void Travel::ShowTravel(){cout<<TCode<<No_of_Adults<<No_of_Children<<Distance<<TotalFare<<endl;}

Page 21: XII CBSE Previous Year Question Paper

(½ Mark for correct syntax of class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of constructor)(1 Mark for checking all three conditions and calculating TotalFare in AssignFare( ))(½ Mark for correct EnterTravel( ) with proper invocation of AssignFare( ))(½ Mark for displaying all data Members including TotalFare inside ShowTravel( ))

Page 22: XII CBSE Previous Year Question Paper

(c) Define a class Tour in C++ with the description given below :

Outside Delhi 2007 4

Private Members :TCode of type stringNoofAdults of type integerNoofKids of type integerKilometres of type integerTotalFare of type float

Page 23: XII CBSE Previous Year Question Paper

(c) Define a class Tour in C++ with the description given below :

Outside Delhi 2007 4

Public Members :• A constructor to assign initial values as follows :TCode with the word “NULL”NoofAdults as 0NoofKids as 0Kilometres as 0TotalFare as 0

Page 24: XII CBSE Previous Year Question Paper

(c) Define a class Tour in C++ with the description given below :

Outside Delhi 2007 4

• A function AssignFare ( ) which calculates and assigns the value ofthe data member TotalFare as followsFor each AdultFare(Rs) For Kilometres500 >=1000300 <1000&>=500200 <500

Page 25: XII CBSE Previous Year Question Paper

(c) Define a class Tour in C++ with the description given below :

Outside Delhi 2007 4

For each Kid the above Fare will be 50% of the Fare mentioned in theabove tableFor example :If Kilometres is 850, NoofAdults = 2 and NoofKids = 3Then TotalFare should be calculated asNumofAdults * 300 + NoofKids * 150i.e. 2*300 + 3*150=1050

Page 26: XII CBSE Previous Year Question Paper

(c) Define a class Tour in C++ with the description given below :

Outside Delhi 2007 4

• A function EnterTour( ) to input the values of the data membersTCode, NoofAdults, NoofKids and Kilometres; and invoke theAssign Fare( ) function.• A function ShowTour( ) which displays the content of all the datamembers for a Tour.

Page 27: XII CBSE Previous Year Question Paper

(c) class Tour{char TCode[10]; //OR char *Tcode;int NoofAdults;int NoofKids;int Kilometres;float TotalFare;public:Tour(){strcpy(TCode,”NULL”); //OR TCode[0]=’\0’OR strcpy(TCode,”\0”)

Page 28: XII CBSE Previous Year Question Paper

//OR TCode=NULL if TCode is declared as char pointerNoofAdults = 0;NoofKids = 0;Kilometres = 0;TotalFare = 0;}void AssignFare();void EnterTour();void ShowTour();};

Page 29: XII CBSE Previous Year Question Paper

void Tour::AssignFare(){if(Kilometres>=1000)TotalFare = 500*NoofAdults+250*NoofKids;else if (Kilometres >= 500)TotalFare = 300*NoofAdults+150*NoofKids;elseTotalFare = 200*NoofAdults+100*NoofKids;}

Page 30: XII CBSE Previous Year Question Paper

void Tour::EnterTour(){gets(TCode); // or cin >> TCode;cin>>NoofAdults>>NoofKids>>Kilometres;AssignFare( );}void Tour::ShowTour(){cout<<TCode<<NoofAdults<<NoofKids<<Kilometres<<TotalFare<<endl;}

Page 31: XII CBSE Previous Year Question Paper

(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of constructor)(½ Mark for condition checking in AssigFare())(½ Mark for calculation of correct TotalFare for each condition)(½ Mark for correct EnterTour() with proper invocation of AssignFare())(½ Mark for displaying all data Members including TotalFare inside ShowTour())

Page 32: XII CBSE Previous Year Question Paper

(c) Define a class Garments in C++ with the following descriptions:

Delhi 2008 4Private Members:GCode of type stringGType of type stringGSize of type integerGFabric of type stringGPrice of type floatA function Assign ( ) which calculates and assigns the value of GPrice as follows

Page 33: XII CBSE Previous Year Question Paper

(c) Define a class Garments in C++ with the following descriptions:

Delhi 2008 4For the value of GFabric as “COTTON”,GType GPrice(Rs)TROUSER 1300SHIRT 1100For GFabric other than “COTTON” the above mentioned GPrice gets reduced by 10%.

Page 34: XII CBSE Previous Year Question Paper

(c) Define a class Garments in C++ with the following descriptions:

Delhi 2008 4Public Members:A constructor to assign initial values of GCode, GType and GFabric with the word “NOT ALLOTTED” and GSize and GPrice with 0A function Input ( ) to input the values of the data members GCode,GType, GSize and GFabric and invoke the Assign ( ) function.A function Display ( ) which displays the content of all the data members for a Garment.

Page 35: XII CBSE Previous Year Question Paper

Ans:class Garments{char GCode[10];char GType[10];int GSize;char GFabric[10] ;float GPrice;void Assign( ) ;

Page 36: XII CBSE Previous Year Question Paper

public:Garments( ){strcpy(GCode,”NOT ALLOTTED”) ;strcpy(GType,”NOT ALLOTTED”) ;strcpy (GFabric, “NOT ALLOTTED”) ;GSize=0;GPrice=0;}void Input( ) ;void Display( ) ;} ;

Page 37: XII CBSE Previous Year Question Paper

void Garments::Assign( ){if (strcmp(GFabric,“COTTON”)==0)//if (!strcmp(GFabric, “COTTON”)){if (strcmp(GType,“TROUSER”) ==0)GPrice=1300;else if (strcmp(GType,“SHIRT”)==0)GPrice=1100;}

Page 38: XII CBSE Previous Year Question Paper

else{if (strcmp(GType,”TROUSER”) = =0)GPrice=1300*0.9; // 10% reductionelse if (strcmp(GType,“SHIRT”)= =0)GPrice=1100*0.9; // 10% reduction}}void Garments::Input( ){gets(GCode) ; // or cin >> GCode;gets(GType) ; // or cin >> GType;cin>>Gsize;

Page 39: XII CBSE Previous Year Question Paper

gets(GFabric) ;// or cin >> GFabric;Assign( ) ;}void Garments::Display( ){cout<<GCode<<GType<<GSize<<GFabric<<GPrice<<endl;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(½ Mark for correct definition of constructor)

Page 40: XII CBSE Previous Year Question Paper

(1 Mark for correct definition of Assign( ))(1 Mark for correct definition of Input( ) with proper invocation of Assign( ) function)(½ Mark for correct definition of Display( ))NOTE:Deduct % Mark if Assign( ) is not invoked properly inside Input( ) function

Page 41: XII CBSE Previous Year Question Paper

(c) Define a class Clothing in C++ with the following descriptions:

Outside Delhi 2008 4Private Members:Code of type stringType of type stringSize of type integerMaterial of type stringPrice of type floatA function Calc_Price( ) which calculates and assigns the value of Price as follows:

Page 42: XII CBSE Previous Year Question Paper

(c) Define a class Clothing in C++ with the following descriptions:

Outside Delhi 2008 4For the value of Material as “COTTON” :Type Price (Rs.)TROUSER 1500SHIRT 1200For Material other than “COTTON” the above mentioned Pricegets reduced by 25%.

Page 43: XII CBSE Previous Year Question Paper

(c) Define a class Clothing in C++ with the following descriptions:

Outside Delhi 2008 4Public Members:A constructor to assign initial values of Code, Type and Material with the word “NOT ASSIGNED” and Size and Price with 0.A function Enter( ) to input the values of the data members Code, Type, Sizeand Material and invoke the CalcPrice( ) function.A function Show( ) which displays the content of all the data members for a Clothing

Page 44: XII CBSE Previous Year Question Paper

Ans: class Clothing{char Code[25];char Type[25];int Size;char Material[30];float Price;Public:Clothing() ;void Calc_Price() ;void Enter() ;void Show() ;};

Page 45: XII CBSE Previous Year Question Paper

Clothing::Clothing(){strcpy(Code,”NOT ASSIGNED”);strcpy(Type,”NOT ASSIGNED”);Size=0;strcpy (Material, “NOT ASSIGNED”);Price=0;}

Page 46: XII CBSE Previous Year Question Paper

void Clothing:: Calc_Price(){if (strcmp(Type, “TROUSER”) ==0 && strcmp (Material,“COTTON”)==0)Price=1500;else if (strcmp(Type, “SHIRT”) ==0 && strcmp(Material,”COTTON”)==O)Price=1200;else if (strcmp(Type, “TROUSER”) ==0 && strcmp(Material,”COTTON”)!=O)Price=1500*0.75;

Page 47: XII CBSE Previous Year Question Paper

void Clothing:: Calc_Price(){if (strcmp(Type, “TROUSER”) ==0 && strcmp (Material,“COTTON”)==0)Price=1500;else if (strcmp(Type, “SHIRT”) ==0 && strcmp(Material,”COTTON”)==O)Price=1200;else if (strcmp(Type, “TROUSER”) ==0 && strcmp(Material,”COTTON”)!=O)Price=1500*0.75;else if (strcmp(Type,”SHIRT”)==0) &&

Page 48: XII CBSE Previous Year Question Paper

strcmp(Material,”COTTON”)!= 0)Price=1200*0.75;}void Clothing::Enter(){gets(Code) ; // or cin >> Code;gets(Type) ; // or cin >> Type;cin>>Size;gets(Material) ;// or cin >> Material;Calc_Price() ;}

Page 49: XII CBSE Previous Year Question Paper

void Clothing::Show(){cout<<Code<<Type<<Size<<Material<<Price<<endl;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(½ Mark for correct definition of function Calc_price())(½ Mark for constructor)(1 Mark for calculation of correct Price for each condition)

Page 50: XII CBSE Previous Year Question Paper

(½ Mark for correct Enter() with proper invocation of Calc_Price())(½ Mark for displaying all data Members in function Show())

Page 51: XII CBSE Previous Year Question Paper

(c) Define a class RESORT in C++ with following description:

Delhi 2009 4Private Members Rno //Data member to store Room No Name //Data member to store customer name Charges //Data member to store per day charges Days //Data member to store number of days of stay COMPUTE( ) //A function to calculate’ and return Amount as

Page 52: XII CBSE Previous Year Question Paper

(c) Define a class RESORT in C++ with following description:

Delhi 2009 4Days*Charges and if the value of Days*Charges is more than 11000then as 1.02*Days*ChargesPublic Members Getinfo ( ) //A function to enter the content Rno, Name, Charges and Days Dispinfo ( ) //A function to display Rno, Name, Charges,Days and Amount (Amount to be displayed by calling function COMPUTE ( ) )

Page 53: XII CBSE Previous Year Question Paper

Ans class RESORT{int Rno;char Name [20];float Charges;int Days;float COMPUTE();public:void Getinfo() ;void Dispinfo();};

Page 54: XII CBSE Previous Year Question Paper

void RESORT::Getinfo(){cin>>Rno;gets (Name);cin>>Charges;cin>>Days;}void RESORT::Dispinfo(){cout<<Rno<<” “<<Name<<“ “<<Charges<<” “<<Days<<COMPUTE()<<endl;}

Page 55: XII CBSE Previous Year Question Paper

float RESORT::COMPUTE(){float Amount = Charges*Days;if (Amount>11000)Amount = 1.02*Days*Charges;return Amount;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of COMPUTE ( )) .

Page 56: XII CBSE Previous Year Question Paper

(1 Mark for correct definition of Dispinfo( ) with proper invocation of COMPUTEO function)(1 Mark for correct definition of Getinfo( ))NOTE: Deduct ½ Mark if COMPUTE( ) is not invoked properly inside Dispinfo( ) function

Page 57: XII CBSE Previous Year Question Paper

(c) Define a class HOTEL in C++ with the following description:

Outside Delhi 2009 4Private Members: Rno //Data member to store Room No Name //Data member to store customer name Tariff //Data member to store per day charges NOD //Data member to store number of days of stay CALC( ) //A function to calculate and return Amount as NOD*Tariff and if the value of NOD*Tariff is more than 10000 then as1.05*NOD*Tariff

Page 58: XII CBSE Previous Year Question Paper

(c) Define a class HOTEL in C++ with the following description:

Outside Delhi 2009 4

Public Members Checkin ( ) / / A function to enter the content Rno, Name, Tariff and NOD Checkout( ) / / A function to display Rno, Name, Tariff,NOD and Amount (Amount to be displayed by calling function CALC( ))

Page 59: XII CBSE Previous Year Question Paper

Ans class HOTEL{int Rno;char Name[20];float Tariff;int NOD;float CALC() ;public:void Checkin() ;void Checkout() ;} ;

Page 60: XII CBSE Previous Year Question Paper

float HOTEL::CALC(){float Amount = Tariff*NOD;if (Amount>10000)Amount = 1.05*NOD*Tariff;return Amount;}void HOTEL::Checkin(){cin>>Rno;gets (Name);cin>>Tariff;cin>>NOD; }

Page 61: XII CBSE Previous Year Question Paper

void HOTEL::Checkout(){cout<<Rno<<” “<<Name<<“ “<<Tariff<<” “<<NOD<<CALC ()<<endl;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of CALC( ))(1 Mark for correct definition of Checkout( ) with proper invocation of CALC( ) function)

Page 62: XII CBSE Previous Year Question Paper

(1 Mark for correct definition of Checkin())NOTE: Deduct ½ Mark if CALC() is not invoked properly inside Checkout( )function

Page 63: XII CBSE Previous Year Question Paper

(c) Define a class ITEM in C++ with following description:

Delhi 2010 4

Private Members

Code of type integer (Item Code) Iname of type string (Item Name) Price of type float (Price of each item) Qty of type integer (Quantity of item in stock) Offer of type float (Offer percentage on the item)

Page 64: XII CBSE Previous Year Question Paper

(c) Define a class ITEM in C++ with following description:

Delhi 2010 4

A member function GetOffer() to calculate Offer percentage as per thefollowing rule:If Qty<=50 Offer is 0If 50<Qty<=100 Offer is 5If Qty>100 Offer is 10

Page 65: XII CBSE Previous Year Question Paper

(c) Define a class ITEM in C++ with following description:

Delhi 2010 4

Public Members A function GetStock() to allow user to enter values for Code, Iname,Price, Qty and call function GetOffer() to calculate the offer A function ShowItem() to allow user to view the content of all the datamembers

Page 66: XII CBSE Previous Year Question Paper

Ans. class ITEM{int Code;char Iname [20] ;float Price;int Qty;float Offer;void GetOffer() ;public:void GetStock (){cin>>Code;

Page 67: XII CBSE Previous Year Question Paper

gets (Iname) ; // OR cin.getline (Iname, 80) ; OR cin>>Iname;cin>>Price>>Qty;GetOffer() ;}void ShowItern ( ){cout<<Code<<Iname<<Price<<Qty<<Offer;};

Page 68: XII CBSE Previous Year Question Paper

void ITEM: : GetOffer (){if (Qty<=50)Offer = 0;else if (Qty <=100)Offer = 5; / /OR Offer = 0.05;elseOffer = 10; / /OR Offer = 0.1;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)

Page 69: XII CBSE Previous Year Question Paper

(1 Mark for correct definition of GetOffer())(1 Mark for correct definition of GetStock () with proper invocation of GetOffer()function)(1 Mark for correct definition of Showltem())

NOTE:

Deduct ½ Mark if GetOffer() is not invoked properly inside GetStock()function

Page 70: XII CBSE Previous Year Question Paper

(c) Define a class STOCK in C++ with following description:

OUTSIDE DELHI 2010 4

Private Members ICode of type integer (Item Code) Item of type string (Item Name) Price of type float (Price of each item) Qty of type integer (Quantity in stock) Discount of type float (Discount percentage on the item)

Page 71: XII CBSE Previous Year Question Paper

(c) Define a class STOCK in C++ with following description:

OUTSIDE DELHI 2010 4

A member function FindDisc() to calculate discount as per the following rule:If Qty<=50 Discount is 0If 50<Qty<=100 Discount is 5If Qty>100 Discount is 10

Page 72: XII CBSE Previous Year Question Paper

(c) Define a class STOCK in C++ with following description:

OUTSIDE DELHI 2010 4

Public Members A function Buy() to allow user to enter values for ICode, Item, Price,Qty and call function FindDisc() to calculate the Discount.A function ShowAll( ) to allow user to view the content of all the datamembers.

Page 73: XII CBSE Previous Year Question Paper

Ans. class STOCK{int ICode,Qty;char Item[20];float Price,Discount;void FindDisc();public:void Buy();void ShowAll();} ;

Page 74: XII CBSE Previous Year Question Paper

void STOCK::Buy(){cin>>ICode;gets(Item);cin>>Price;cin»Qty;FindDisc();}

Page 75: XII CBSE Previous Year Question Paper

void STOCK::FindDisc(){if (Qty<=50)Discount=0;else if (Qty<=100)Discount=5; // =0.05;elseDiscount=10; // =0.1;}

Page 76: XII CBSE Previous Year Question Paper

void STOCK::ShowAll(){cout<<ICode<<’\t’<<Item<<’\t’<<Price<<’\t’<<Qty<<’\t’<<Discount<<endl;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of FindDisc())

Page 77: XII CBSE Previous Year Question Paper

(1 Mark for correct definition of Buy() with proper invocation of FindDisc() function)(1 Mark for correct definition of ShowAll())

NOTE:

Deduct ½ Mark if FindDisc() is not invoked properly inside Buy() function

Page 78: XII CBSE Previous Year Question Paper

(c) Define a class Candidate in C++ with following description:

Delhi 2011 4Private Members A data member RNo (Registration Number) of type long A data member Name of type string A data member Score of type float A data member Remarks of type string A member function AssignRem( ) to assign Remarks as per the Score obtained by a candidate. Score range and the respective Remarks are shown as follows:

Page 79: XII CBSE Previous Year Question Paper

(c) Define a class Candidate in C++ with following description:

Delhi 2011 4Score Remarks>=50 Selectedless than 50 Not selected

Public Members

A function ENTER ( ) to allow user to enter values for RNo, Name, Score & call function AssignRem( ) to assign the remarks. A function DISPLAY ( ) to allow user to view the content of all the data members.

Page 80: XII CBSE Previous Year Question Paper

Ans class Candidate{long RNo;char Name[20];float Score;char Remarks[20];void AssignRem( ) ;public:void Enter( );void Display( );} ;

Page 81: XII CBSE Previous Year Question Paper

void Candidate: :AssignRem( ){if (Score>=50)strcpy (Remarks,"Selected") ;elsestrcpy(Remarks,"Not Selected") ;}void Candidate: : Enter ( ){cin>>RNo ;gets (Name) ; cin>>Score;AssignRem( ) ;}

Page 82: XII CBSE Previous Year Question Paper

void Candidate: :Display(){cout<<RNo<<Name<<Score<<Remarks<<endl;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of AssignRem())(1 Mark for correct definition of Enter() with proper invocation of AssignRem() function)

Page 83: XII CBSE Previous Year Question Paper

(1 Mark for correct definition of Display())NOTE: Deduct ½ Mark to be deducted if Assignrem() is not invoked properly inside Enter( ) function No marks to be deducted if member function definitions are writteninside the class

Page 84: XII CBSE Previous Year Question Paper

(c) Define a class Applicant in C++ with following description:

OUTSIDE DELHI 2011 4Private Members A data member ANo (Admission Number) of type long A data member Name of type string A data member Agg (Aggregate Marks) of type float A data member Grade of type char A member function GradeMe() to find the

Page 85: XII CBSE Previous Year Question Paper

(c) Define a class Applicant in C++ with following description:

OUTSIDE DELHI 2011 4

Grade as per the Aggregate Marks obtained by a student. Equivalent Aggregate Marks range and the respective Grades are shown as follows:Aggregate Marks Grade

>=80 Aless than 80 and >=65 Bless than 65 and >=50 Cless than 50 D

Page 86: XII CBSE Previous Year Question Paper

(c) Define a class Applicant in C++ with following description:

OUTSIDE DELHI 2011 4

Public Members

A function ENTER() to allow user to enter values for ANo, Name, Agg & call function GradeMe() to find the Grade. A function_RESULT( ) to allow user to view the content of all the data members.

Page 87: XII CBSE Previous Year Question Paper

Ans class Applicant{long ANo;char Name [20] ;float Agg;char Grade;void Grademe ( ) ;public:void Enter ( ) ;void Result ( ) ;} ;

Page 88: XII CBSE Previous Year Question Paper

void Applicant: :GradeMe( ){if (Agg>=80)Grade=' A' ;else if(Agg>=65)Grade=' B' ;else if(Agg>=50)Grade=' C' ;elseGrade=' D' ;}

Page 89: XII CBSE Previous Year Question Paper

void Applicant: :Enter ( ){cin>>ANo;gets (Name) ;cin>>Agg;GradeMe() ;}void Applicant: :Result ( ){cout<<ANo<<Name<<Agg<<Grade<<end1;}

Page 90: XII CBSE Previous Year Question Paper

(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(1 Mark for correct definition of GradeMe( ))(1 Mark for correct definition of Enter() with proper invocation of GradeMe( ) function)(1 Mark for correct definition of Result())NOTE:½ mark to be deducted if Grademe() is not invoked within Enter()No marks to be deducted if member function definitions are inside the Class

Page 91: XII CBSE Previous Year Question Paper

(c) Define a class TEST in C++ with following description: SAMPLE PAPER 2010 SET I 4

Private Members

• TestCode of type integer• Description of type string• NoCandidate of type integer• CenterReqd (number of centers required) of type integer• A member function CALCNTR() to calculate and return the number of centers as(NoCandidates/100+1)

Page 92: XII CBSE Previous Year Question Paper

(c) Define a class TEST in C++ with following description: SAMPLE PAPER 2010 SET I 4

Public Members

• A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres• A function DISPTEST() to allow user to view the content of all the data members

Page 93: XII CBSE Previous Year Question Paper

(c) class TEST {int TestCode;char Description[20];int NoCandidate,CenterReqd;void CALCNTR();public:void SCHEDULE();void DISPTEST();};

Page 94: XII CBSE Previous Year Question Paper

void TEST::CALCNTR(){CenterReqd=NoCandidate/100 + 1;}void TEST::SCHEDULE(){cout<<"Test Code :";cin>>TestCode;cout<<"Description :";gets(Description);cout<<"Number :";cin>>NoCandidate;CALCNTR();}

Page 95: XII CBSE Previous Year Question Paper

void TEST::DISPTEST(){cout<<"Test Code :"<<TestCode<<endl;cout<<"Description :"<<Description<<endl;cout<<"Number :"<<NoCandidate<<endl;;cout<<"Centres :"<<CenterReqd<<endl;;}(½ Mark for correct syntax for class header)(½ Mark for correct declarations of data members)

Page 96: XII CBSE Previous Year Question Paper

(1 Mark for appropriate definition of function CALCNTR())(1 Mark for appropriate definition of SCHEDULE() with a call for CALCNTR())(1 Mark for appropriate definition of DISPTEST())

Page 97: XII CBSE Previous Year Question Paper

(c) Define a class FLIGHT in C++ with following description: SAMPLE PAPER 2010 SET II 4Private Members• A data member Flight number of type integer• A data member Destination of type string• A data member Distance of type float• A data member Fuel of type float• A member function CALFUEL() to calculate the value of Fuel as per the following criteriaDistance Fuel<=1000 500more than 1000 and <=2000 1100

Page 98: XII CBSE Previous Year Question Paper

Distance Fuel<=1000 500more than 1000 and <=2000 1100more than 2000 2200

Public Members

A function FEEDINFO() to allow user to enter values for Flight Number,Destination, Distance & call function CALFUEL() to calculate the quantity of Fuel.A function SHOWINFO() to allow user to view the content of all the data members

Page 99: XII CBSE Previous Year Question Paper

(c) class FLIGHT {int Fno;char Destination[20];float Distance, Fuel;void CALFUEL();public:void FEEDINFO();void SHOWINFO();};

Page 100: XII CBSE Previous Year Question Paper

void FLIGHT::CALFUEL(){if (Distance<=1000)Fuel=500;elseif (Distance<=2000)Fuel=1100;elseFuel=2200;}

Page 101: XII CBSE Previous Year Question Paper

void FLIGHT::FEEDINFO(){cout<<"Flight No :";cin>>Fno;cout<<"Destination :";gets(Destination);cout<<"Distance :";cin>>Distance;CALFUEL();}

Page 102: XII CBSE Previous Year Question Paper

void FLIGHT::SHOWINFO(){cout<<"Flight No :"<<Fno<<endl;cout<<"Destination :"<<Destination<<endl;cout<<"Distance :"<<Distance<<endl;;cout<<"Fuel :"<<Fuel<<endl;;}

Page 103: XII CBSE Previous Year Question Paper

(½ Mark for correct syntax for class header)(½ Mark for correct declarations of data members)(1 Mark for appropriate definition of function CALFUEL())(1 Mark for appropriate definition of FEEDINFO() with a call for CALFUEL())(1 Mark for appropriate definition of SHOWINFO())

Page 104: XII CBSE Previous Year Question Paper

SAMPLE PAPER 2012 SET I 4

Page 105: XII CBSE Previous Year Question Paper
Page 106: XII CBSE Previous Year Question Paper

SAMPLE PAPER 2012 SET I 4

Page 107: XII CBSE Previous Year Question Paper

SAMPLE PAPER 2012 SET II 4

Page 108: XII CBSE Previous Year Question Paper

SAMPLE PAPER 2012 SET II 4

Page 109: XII CBSE Previous Year Question Paper

SAMPLE PAPER 2012 SET II 4

Page 110: XII CBSE Previous Year Question Paper

THANK YOU