101
XII CBSE Previous Year Question Paper QUESTION NO 2 (d) 4 Marks

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

Embed Size (px)

Citation preview

XII CBSE Previous Year Question

Paper

QUESTION NO 2 (d)

4 Marks

(d) Answer the questions (i) to (iii) based on the following code : DELHI 2006class stationary{char Type;char Manufacturer[10];public:stationary( );void Read_sta_details( );void Disp_sta_details( );};class office : public stationary{

int no_of_types;float cost_of_sta;public:void Read_off_details( );void Disp_off_details( );};class printer : private office{int no_of_users;char delivery _date [10];public:void Read_pri_details( );void Disp_pri_details( ); };

void main( ){ printer MyPrinter; }(i) Mention the member names which are accessible by MyPrinter declared in main( ) function 1(ii) What is the size of MyPrinter in bytes ? 1(iii) Mention the names of functions accessible from the member function Read_pri_details( ) of class printer. 2

(d) (i) Read_pri_details(), Disp_pri_details()(1 mark for correct function names)(ii) 29 bytes OR 33 bytes

(1 mark for correct answer)

(iii) Disp_pri_details(), Read_off_details(), Disp_off_details(), Read_sta_details(), Disp_sta_details()

(2 marks for all correct member functions)Note:• No partial marks to be given for any of the parts.• Ignore the constructor and function itself

(d) Answer the questions (i) to (iii) based on the following code : OUTSIDE DELHI 2006

class furniture{char Type;char Model[10];public:furniture();void Read_fur_details();void Disp_fur_details();};

class sofa : public furniture{int no_of_seats;float cost_of_sofa;public:void Read_sofa_details();void Disp_sofa_details();};class office : private sofa{int no_of_pieces;char delivery_date[10];

public:void Read_office_details();void Disp_office_details();};void main(){ office MyFumiture; }

(i) Mention the member names which are accessible by MyFumiture declared in main() function. 1(ii) What is the size of MyFumiture in bytes ? 1(iii) Mention the names of functions accessible from the member functionRead_office_details() of class office. 2

(d) (i) Read_office_detailsDisp_office_details.(1 mark for correct names)(ii) 29 bytesOR33 Bytes(1 mark for correct answer)(iii) Read_fur_details(),Disp_fur_details,Read_sofa_details( ),Disp_sofa_details( ),Disp_office_details( )Read_office_details( ) (Optional)(2 marks for correct answer)

(d) Answer the questions (i) to (iv) based on the following code : DELHI 2007 4class Teacher{char TNo[5], TName[20], DeptflO];int Workload;protected:float Salary;void AssignSal(float);public:Teacher( ) ;void TEntry( ) ;void TDisplay( );};

(d) Answer the questions (i) to (iv) based on the following code : DELHI 2007 4class Student{char Admno[10], SName[20], Stream[10];protected:int Attendance, TotMarks;public:Student( );void SEntry( );void SDisplay( );};

(d) Answer the questions (i) to (iv) based on the following code : DELHI 2007 4class School : public Student, public Teacher{char SCode[10], SchName[20];public:School ( ) ;void SchEntry( );void SchDisplay( );};(i) Which type of Inheritance is depicted by the above example ?

(d) Answer the questions (i) to (iv) based on the following code : DELHI 2007 4

(ii) Identify the member functiion(s) that cannot be called directly from the objects of class School from the following :

TEntry( ) SDisplay( ) SchEntry( )

(iii) Write name of all the member(s) accessible from member functions of class School.(iv) If class School was derived privately from class Teacher and privately from class Student, then, name the member function(s) that could beaccessed through Objects of class School.

(d) (i) Multiple Inheritance(1 Mark for correct answer)(ii) NoneORAll the functions can be called.(1 Mark for any of the correct answer)(iii) Data Members: SCode, SchName, Attendance, TotMarks, SalaryMember Functions: SchDisplay(), SchEntry(), SEntry(), SDisplay( ), TEntry( ), TDisplay( ), AssignSal( )

( 1 Mark for all correct members)NOTE:· Mention of Constructor functions School(), Student() and Teacher() to be ignored.· No marks to be awarded for partially correct answers

(iv) SchEntry( ),SchDisplay( ).

( 1 Mark for all correct member functions)NOTE:· Constructor function School() to be ignored.· No marks to be awarded for partially correct answers

(d) Answer the questions (i) to (iv) based on the following code : OUTSIDE DELHI 2007 4

class Trainer{char TNo [5], TName [20], Specialisation [10];int Days;protected :float Remuneration;void AssignRem (float);public :Trainer ( ) ;void TEntry ( );void TDisplay ( ); };

(d) Answer the questions (i) to (iv) based on the following code : OUTSIDE DELHI 2007 4

class Learner{char Regno [10], LName [20], Program [10];Protected :int Attendance, Grade;public:Learner ( );void LEntry ( );void LDisplay ( );};

(d) Answer the questions (i) to (iv) based on the following code : OUTSIDE DELHI 2007 4

class Institute : public Learner, public Trainer{char ICode[10], IName [20]; (public:Institute ( );void IEntry ( );void IDisplay ( );};

(d) Answer the questions (i) to (iv) based on the following code : OUTSIDE DELHI 2007 4

(i) Which type of Inheritance is depicted by the above example?(ii) Identify the member function(s) that cannot be called directly from the objects of class Institute from the followingTEntry( )LDisplay()IEntry()

(d) Answer the questions (i) to (iv) based on the following code : OUTSIDE DELHI 2007 4

(iii) Write name of all the member(s) accessible from member functions of class Institute.

(iv) If class Institute was derived privately from class Learner and privately from class Trainer, then, name the member function(s) that could be accessed through Objects of class Institute.

(d) (i) Multiple Inheritance(1 Mark for correct answer)(ii) NoneORAll the above functions can be called.(1 Mark for correct answer)(iii) Data Members: ICode, IName, Attendance, Grade,RemunerationMember Functions: IEntry( ), IDisplay( ), LEntry(),LDisplay( ),AssignRem( ), TEntry( ), TDisplay( )

(1 Mark for correct members)Note:· Constructor functions Trainer(), Learner() and Institute() to be ignored.· No marks to be awarded for partially correct answers(iv) IEntry( ), IDisplay( )(1 Mark for correct answer)NOTE:· Constructor function Institute() to be ignored.· No marks to be awarded for partially correct answers

(d) Answer the questions (i) to (iv) based on the following code: DELHI 2008 4class Dolls{char DCode[5] ;protected:float Price;void CalcPrice(float);public:Dolls ( );void DInput ( ) ;void DShow ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following code: DELHI 2008 4class SoftDolls : public Dolls{char SDName[20] ;float Weight;public:SoftDolls ( ) ;void SDInput ( ) ;void SDShow ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following code: DELHI 2008 4class ElectronicDolls: public Dolls{char EDName[20] ;char BatteryType[10];int Batteries;public:ElectronicDolls ( ) ;void EDInput ( ) ;void EDShow ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following code: DELHI 2008 4

(i) Which type of Inheritance is shown in the above example?(ii) How many bytes will be required by an object of the class ElectronicDolls? .(iii) Write name of all the data members accessible from member functionsof the class SoftDolls(iv) Write name of all the member functions accessible by an object of the class ElectronicDolls.

(i) Which type of Inheritance is shown in the above example?Ans: Hierarchical InheritanceORSingle Level Inheritance(1 mark for mentioning any of the above mentioned type of Inheritance)(ii) How many bytes will be required by an object of the class ElectronicDolls?Ans: 41 bytes(1 Mark for correct answer)

(iii) Write name of all the data members accessible from member functions of the class SoftDolls

Ans: SDName, Weight, Price

(1 Mark for correct answer)

Note:

No marks to be awarded for partially correct answer

(iv) Write name of all the member functions accessible by an object of the classElectronicDolls.

Ans: EDInput( ), EDShow( ), DInput( ), DShow( )

(1 Mark for Correct answer)

Note: Constructor functions ElectronicDolls( ) & Dolls( ) to be Ignored. No marks to be awarded for partially correct answers

(d) Answer the questions (i) to (iv) based on the following code: OUTSIDE DELHI 2008 4class Toys{char TCode [5] ;protected:float Price;void Assign (float);public:Toys( ) ;void TEntry ( ) ; ,void TDisplay () ;} ;

(d) Answer the questions (i) to (iv) based on the following code: OUTSIDE DELHI 2008 4class SoftTOYS: public Toys{char STName [ 20] ;float weight;public:SoftToys( ) ;void STEntry ( ) ;void STDisplay ( );} ;

(d) Answer the questions (i) to (iv) based on the following code: OUTSIDE DELHI 2008 4class ElectronicToys: public Toys{char ETName[20];int No_of_Batteries;public:ElectronicToys( ) ;void ETEntry ( ) ;void ETDisplay ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following code: OUTSIDE DELHI 2008 4

(i) Which type of Inheritance is shown in the above example?(ii) How many bytes will be required by an object of the class SoftToys ?(iii) Write name of all the data members accessible from member functions of the class SoftToys.(iv) Write name of all the member functions, which are accessible from an object of the class ElectronicToys.

(i) Which type of inheritance is shown in the above example?Ans: Hierarchical InheritanceORSingle Level Inheritance(1 Mark to be given for mentioning any of the above mentioned type of inheritance)(ii) How many bytes will be required by an object of the class softToys?Ans:33(1 Mark for correct answer)

(iii) Write name of all the data member(s) accessible from member functions of class SoftToys.Ans: Data Members: Price, STName, Weight(1 Mark for all correct members)NOTE:No marks to be awarded for partially correct answers

(iv) Write name of all the member functions, which are accessible from an object of the class ElectronicToys.Ans:Member Functions: TEntry ( ) , TDisplay ( ) , ETEntry ( ) , ETDisplay ( )(1 Mark for correct answer)

NOTE:

Constructors Toys() & ElectronicToys(), it mentioned to be ignored. No marks to be awarded for partially correct answers

(d) Answer the questions (i) to (iv) based on the following: DELHI 2009 4class FaceToFace{char CenterCode [10] ;public:void Input ( ) ;void Output ( ) ;} ;class Online{char website [50] ;

(d) Answer the questions (i) to (iv) based on the following: DELHI 2009 4public:void SiteIn ( ) ;void SiteOut ( ) ;} ;class Training: public FaceToFace, private Online{long Tcode ;float charge;int period;

(d) Answer the questions (i) to (iv) based on the following: DELHI 2009 4public:void Register ( ) ;void Show ( ) ;} ;(i) Which type of Inheritance is shown in the above example?(ii) Write names of all the member functions accessible from Show( ) function of class Training.

(d) Answer the questions (i) to (iv) based on the following: DELHI 2009 4

(iii) Write name of all the members accessible through an object of class Training.

(iv) Is the function Output( ) accessible inside the function SiteOut( ) ? Justify your answer.

(i) Which type of Inheritance is shown in the above example?

Ans Multiple Inheritance

(1 Mark for mentioning correct inheritance type)

ii) Write names of all the member functions accessible from Show( ) function of class Training.

Ans Register( ) Siteln( ). SiteOut( ).Input( ), Output( )

(1 Mark for correct answer)

Note: No marks to be awarded for any other alternative answer

iii) Write name of all the members accessible through an object of class Training.

Ans Register( ), Show( ), Input( ), Output( )

(1 Mark for correct answer)

Note: No marks to be awarded for any other alternative answer

iv) Is the function Output( ) accessible inside the function SiteOut( )? Justify your answer.

Ans No, function Output( ) is not accessible inside the function SiteOut( ), because Output( ) is a member of class FaceToFace and SiteOut( ) is a member of class Online. and the classes FaceToFace and Online are two independent classes.

( ½ Mark for mentioning NOT ACCESSIBLE correctly)

( ½ Mark for correct justification)

OR

(1 Mark if YES is supported with valid justification that the function InRegular( ) is accessible inside the function InDistance( ) ONLY for an object of the derived class OR in context of Inheritance)

NOTE: No mark to be awarded if only YES is written without any justification.

(d) Answer the questions (i) to (iv)based on the following: OUTSIDE DELHI 2009 4class Regular{char SchoolCode[10];public:void InRegular( );void OutRegular( );} ;class Distance{char StudyCentreCode [5] ;void InDistance( );

(d) Answer the questions (i) to (iv)based on the following: OUTSIDE DELHI 2009 4public:void OutDistance ( );} ;class Course: public Regular, private Distance{char Code [5] ;float Fees;int Duration;public:void InCourse( );void OutCourse( ); } ;

(d) Answer the questions (i) to (iv)based on the following: OUTSIDE DELHI 2009 4

(i) Which type of Inheritance is shown in the above example?(ii) Write names of all the member functions accessible from OutCourse function of class Course.(iii) Write name of all the members accessible througb an object of class Course.(iv) Is the function InRegular( ) accessible inside the function InDistance( )? Justify your answer.

(i) Which type of Inheritance is shown in the above example?

Ans Multiple Inheritance

(1 Mark for mentioning correct type of inheritance)

(ii) Write names of all the member functions accessible from OutCourse functionof class Course.Ans InCourse( ),InDistance( ), OutDistance( ),InRegular( ), OutRegular( )(1 Mark for correct answer)

Note: No marks to be awarded for any other alternative answer

(iii) Write name of all the .:members accessible througb an object of class Course.

Ans InCourse( ), OutCourse( ),InRegular( ), OutRegular( )

(1 Mark for correct answer)

Note: No marks to be awarded for any other alternative answer

(iv) Is the function InRegular( ) accessible inside the function InDistance( )? Justifyyour answer.

Ans No, function InRegular( ) is not accessible inside the function InDistance( ), because InRegular( ) is a member of class Regular and InDistance( ) is a member of class Distance, and the classes Regular and Distance are twoindependent classes.

(½ Mark for mentioning NOT ACCESSIBLE correctly)(½ Mark for correct justification)OR(1 Mark if YES is supported with valid justification that the functionInRegular( ) is accessible inside the function InDistance(} ONL Y for an objectof the derived class OR in context of Inheritance}NOTE: No mark to be awarded if only YES is written without any justification.

(d) Answer the questions (i) to (iv) based on the following: DELHI 2010 4class Chairperson{long CID; //Chairperson Identification Numberchar CName[20];protected:char Description [40];void Allocate();public:Chairperson();void Assign();

(d) Answer the questions (i) to (iv) based on the following: DELHI 2010 4void Show();};class Director{int DID; //Director IDchar Dname[20];protected:char Profile[30];public:Director();

(d) Answer the questions (i) to (iv) based on the following: DELHI 2010 4

void Input();void output();};class Company: private Chairperson, public Director{int CID; //Company IDchar City[20], Country[20];public:Company();void Enter();void Display(); };

(d) Answer the questions (i) to (iv) based on the following: DELHI 2010 4

void Input();void output();};class Company: private Chairperson, public Director{int CID; //Company IDchar City[20], Country[20];

(d) Answer the questions (i) to (iv) based on the following: DELHI 2010 4

public:Company();void Enter();void Display();};(i) Which type of inheritance out of the following is specifically is illustrated in the above C++ code?

(a) Single Level Inheritance(b) Multi Level Inheritance(c) Multiple Inheritance

(ii) Write the names of data members, which are accessible by objects of class type Company.(iii) Write the names of all member functions, which are accessible by objects of class type Company.(iv) Write the names of all members, which are accessible from member functions of class Director.

(i) Which type of inheritance out of the following is specifically is illustrated inthe above C++ code?(a) Single Level Inheritance(b) Multi Level Inheritance(c) Multiple Inheritance

Ans. (c) Multiple Inheritance

(1 Mark for writing correct inheritance type)

(ii) Write the names of data members, which are accessible by objects of class type Company.

Ans None

(1 Mark for writing None or No data members)

(iii) Write the names of all member functions, which are accessible by objects of class type Company.

Ans. Enter(), Display(), Input(), output()

(1 Mark for writing correct member functions)

Note: Both output() or Output() are acceptable as correct answer since differentiation between small and capital O is very difficult. No marks to be awarded for any other alternative answer Ignore mention of Constructor(s)

(iv) Write the names of all members, which are accessible from member functions of class Director.Ans. Input(), output(), Profile, Dname, DID(1 Mark for writing correct members)Note: Both output() or Output() are acceptable as correct answer since differentiation between small and capital O is very difficult. No marks to be awarded for any other alternative answer Ignore mention of Constructor(s)

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2010 4class Director{long DID; //Director Identification Numberchar Name[20];protected:char Description[40];void Allocate();public:Director();void Assign();void Show(); };

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2010 4class ShowRoom:private Factory{int SID; //Showroom IDchar City[20];public:ShowRoom();void Enter();void Display();};

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2010 4

(i) Which type of inheritance out of the following is illustrated in the above C++ code?(a) Single Level Inheritance(b) Multi Level Inheritance(c) Multiple Inheritance

(ii) Write the names of data members, which are accessible by objects of class type ShowRoom.

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2010 4

(iii) Write the names of all member functions which are accessible by objects of class type ShowRoom.

(iv) Write the names of all members, which are accessible from member functions of class Factory.

(i) Which type of inheritance out of the following is illustrated in the above C++code?(a) Single Level Inheritance(b) Multi Level Inheritance(c) Multiple Inheritance

Ans. (b) Multilevel Inheritance

(1 Mark for mentioning correct option)

(ii) Write the names of data members, which are accessible by objects of classtype ShowRoom.

Ans. None

(1 Mark for correct answer)

Note: No marks to be awarded for any partial/alternative answer

(iii) Write the names of all member functions which are accessible by objects of class type ShowRoom.

Ans. Enter(), Display()

(1 Mark for correct answer)

Note:No marks to be awarded for any partial/alternative answer Ignore mentionof Constructor(s)

(iv) Write the names of all members, which are accessible from member functions of class Factory.

Ans. FID, Address, NOE, Description,Input(), Output(), Assign(), Show(), Allocate()

(1 Mark for correct answer)

Note:

No marks to be awarded for any partial/ alternative answer Ignore mention of Constructor(s)

(d) Answer the questions (i) to (iv) based on the following: DELHI 2011 4class Student{int Rno;char Name [20] ;float Marks;protected:void Result( ) ;public:Student( ) ;void Register( ); void Display( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following: DELHI 2011 4class Faculty{long FCode;char FName[20];protected:float Pay;public :Faculty ( ) ;void Enter ( ) ;void Show ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following: DELHI 2011 4class Course : public Student, private Faculty{long CCode [10]; char CourseName [50] ;char StartDate[8], EndDate[8] ;public :Course ( ) ;void Commence ( ) ;void CDetail ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following: DELHI 2011 4

(i) Which type of inheritance is illustrated in the above C++ code?(ii) Write the names of the all data members, which is/are accessible from member function Commence of class Course.(iii) Write the names of member functions, which are accessible from objects of class Course.(iv) Write the name of all the members, which are accessible from objects of class Faculty.

(i) Which type of inheritance is illustrated in the above C++ code?Ans Multiple Inheritance(1 Mark for correct answer)(ii) Write the names of the all data members, which is/are accessible from member function Commence of class Course.Ans CCode, CourseName, StartDate, EndDate, Pay(1 Mark for correct answer)Note:No marks to be awarded for any other alternative answer

(iii) Write the names of member functions, which are accessible from objects of class Course.Ans Commence( ), CDetail( ), Register( ), Display( )(1 Mark for correct answer)Note: No marks to be awarded for any other alternative answer Constructor functions to be ignored

(iv) Write the name of all the members, which are accessible from objects of class Faculty.Ans Enter( ), Show( )(1 Mark for correct answer)

Note: No marks to be awarded for any other alternative answer Constructor functions to be iqnored

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2011 4class Student{int Rollno:char SName[20];float Marksl;protected:void Result ( ) ;public:Student ( ) ;void Enroll ( ) ;void Display ( ) ; } ;

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2011 4class Teacher{long TCode;char TName [20];protected:float Salary;public:Teacher ( );void Enter ( ) ;void Show ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2011 4

class Course: public Student, private Teacher{long CCode [10]; char CourseName [50];char StartDate [8] , EndDate [8];public:Course ( ) ;void Commence ( );void CDetail ( ) ;} ;

(d) Answer the questions (i) to (iv) based on the following: OUTSIDE DELHI 2011 4

(i) Write the names of member functions, which are accessible from objects of class Course.(ii) Write the names of all the data members, which is/are accessible from member function Commence of class Course.(iii) Write the names of all the-members, which are accessible from objects of class Teacher.(iv) Which type of Inheritance is illustrated in the above C++ code?

(i) Write the names of member functions, which are accessible from objects ofclass CourseAns Commence( )CDetail( )Enroll( )Display( )(1 Mark for correct answer)Note:No marks to be awarded for a partially correct answer Constructor functions to be ignored

ii) Write the names of all the data members, which is/are accessible from member function Commence of class CourseAns CCodeCourseNameStartDateEndDateSalary(1 Mark for correct answer)Note:No marks to be awarded for a partially correct answer

iii) Write the names of all the-members, which are accessible from objects of class Teacher.

Ans Enter( ), Show( )(1 Mark for correct answer)Note:No marks to be awarded for a partially correct answer Constructor functions to be ignorediv) Which type of Inheritance is illustrated in the above C++ code?

Ans Multiple Inheritance(1 Mark for correct answer)Note: No marks to be awarded for a partially correct answer

(d) Answer the questions (i) to (iv) based on the following: SAMPLE PAPER 2010 SET I 4class PUBLISHER{char Pub[12];double Turnover;protected:void Register();public:PUBLISHER();void Enter();void Display();};

(d) Answer the questions (i) to (iv) based on the following: SAMPLE PAPER 2010 SET I 4class BRANCH{char CITY[20];protected:float Employees; public:BRANCH();void Haveit();void Giveit();};

(d) Answer the questions (i) to (iv) based on the following: SAMPLE PAPER 2010 SET I 4class AUTHOR : private BRANCH , public PUBLISHER{int Acode;char Aname[20];float Amount;public:AUTHOR();void Start();void Show(); };

(d) Answer the questions (i) to (iv) based on the following: SAMPLE PAPER 2010 SET I 4(i) Write the names of data members, which are accessible from objects belonging to class AUTHOR.(ii) Write the names of all the member functions which are accessible from objects belonging to class BRANCH.(iii) Write the names of all the members which are accessible from member functions of class AUTHOR.(iv) How many bytes will be required by an object belonging to class AUTHOR?

(d)

(i)None of data members are accessible from objects belonging to class AUTHOR.

(1 Mark for correct answer)

(ii) Haveit(), Giveit()

(1 Mark for correct answer)

(iii) Data members: Employees, Acode, Aname, Amount

Member function: Register(), Enter(), Display(), Haveit(), Giveit(), Start(), Show(),

(1 Mark for correct answer)

(iv) 70(1 Mark for correct answer)

SAMPLE PAPER 2012 SET I

SAMPLE PAPER 2012 SET I

SAMPLE PAPER 2012 SET I

SAMPLE PAPER 2012 SET I

SAMPLE PAPER 2012 SET I

SAMPLE PAPER 2012 SET II

SAMPLE PAPER 2012 SET II

SAMPLE PAPER 2012 SET II

SAMPLE PAPER 2012 SET II

THANK YOU