KENDRIYA VIDYALAYA VAYUSENA NAGAR NAGPUR

WINTER BREAK HOMEWORK (2014-15)

Class XII

Computer Science (083)

Note: Answer the questions given below in your computer register only

Chapter-Classes and objects, Constructors & Destructors and Inheritance

Q1.What is an abstract class? How is it different from a concrete class?

Q2 What is OO Paradigm? How is it different from Procedural Programming Paradigm?

Q3 What is polymorphism? Give an example in C++ to show how it is implemented in C++?

Q4 What is inheritance? Give an example in C++ to show how it is implemented in C++?

Q5 Which functions in classes in C++ are inline by default. What is the significance of these functions?

Q6.What happens if no constructor is provided by the user in a class?

Q7When is memory allocated to a constructor?

Q8. Differentiate between multilevel and hierarchical inheritance.

Q9. Reusability of classes is one of the major properties of OOP. How is it implemented in C++?

Q10. CONSIDER a class Item with the following specifications:

class Item

{ private: :

int Ino ;

char IName[25];

float Price

public:

Item(); //f1

Item (int n,char nm[25],float rate); //f2

Item(Item &obj); //f3

}

a)Write function definitions of all the member functions.

b)Name the feature of OOP implemented in the class above.

c)Write the constructor invocation statement for the above functions.

Q.11 CONSIDER a class Candidate with the following specifications :

Class Result

{Private: :

int Cno ;

char Name[20];

int mks;

Public:

Candidate();//f1

Candidate(int Cn,char nm[20],int marks); //f2

~ Candidate( ); //f3

}

a)What are the member functions f1..f3 called in C++.

b)Write the definitions of all functions.

c)Create an object for f1 and f2 to invoke them.

Q12.Answer the questions(i) to (iv) based on the following code:

class sports

{

char category[10];

char Date_of_activity[30];

char Name[30];

public:

sports() { }

void enterdetails();

void show details();

};

class club:public sports

{

protected:

char player_Name[30]

char Player_Address[20];

public:

float fees;

club() { }

void enterclubdetails();

void showclubdetails();

};

class badmintonclub:public club

{

int facility

char F_Name[20];

public:

badmintonclub() { }

void enterbadmintondetails();

void showbadmintondetails();

};

1)Which type of inheritance is illustrated in the c++ code above?

2)How many bytes will be required by an object of a class badmintonclub?

3)Write names of all the data members which are accessible from the object of class

badmintonclub.

4)Write the names of all the members, which are accessible from the objects of class club.

Q13. Answer the questions (1) to (4) based on the following :
class Student
{ private :
char Rollno[20], Sname[30];
protected :
auto float marks;
public:
Student( );
void ENROL( );
void SHOW( );
};
class Graduate: public Student
{ char Fname[30];
protected:
unsigned int age;
public:
Graduate( );
void GENROL( );
void GSHOW( );
};

class Pgraduate: private Graduate
{
char Mname[25];
signed int year;
public:
Pgraduate( );
void PGENROL( );
void PGSHOW( );
};

  1. Mention the member names that are accessible by an object of Pgraduate class.
  2. Name the data members which can be accessed by the objects of Graduate class.
  3. Name the data members that can be accessed bythe functions of PGraduate class.
  4. How many bytes will be occupied by an object of class PGraduate?

Execute the following programs(Q14-17) and bring print outs of source code and output

Q.14Define a class hotel with the following specifications:

Private: members :

Roomno integer

Name string

Charges_day float

No_of_days integer

Compute() -To calculate and return the total charges as charges_day *No_of_days

Public members :

Getit() -to enter the data members

Showit() to show the data member

A constructor function to initialize the data members.

Q.15 Define a class Stock with the following specifications :

Private: members :

Itemnointeger

Item Namestring

Price, qty, total ,discount float

Compute() -To calculate and return the total .Find discount as

If qty >=50 discount=10%on total amount

If qty<50 discount =nil

Public members :

Getit() -to enter the data members

Showit()-to show the data member

A constructor function to initialize the data

Q16.Define a class Clothing with the following specification:

Private: members:

Codestring

Typestring

Sizeinteger

Materialstring

Pricefloat

Calculate() function which computes the Price as follows:

For the value of Material as “COTTON”

TypePrice (Rs.)

TROUSER1500

SHIRT 1200

Public members:

  • Constructor to initialize the values as 0 to Size & Price and NULL to Code, type and Material.
  • ReadData() function which accepts the data values and invoke the function Calculate().
  • DisplayData() function which prints the data on the screen.

Q17.Define a class Housing with the following specification:

Private: members: Name20 Characters

TypeCharacter

Costfloat

Reg_no integer(range 10-1000)

Public members:

  • ReadData() function to read an object of Housing type.
  • DisplayData() function which prints the details of an object.

Function Draw_nos() to chose and display the details of two houses selected randomly from an array of ten objects of type Housing. Use random function to generate the registration numbers to match with Reg_no from the array.

Chapter: Boolean Algebra

Q1. State and verifythe following laws in Boolean algebra

a)Associative law

b) Idempotent Law

c) Involution Law

Q2.State and prove Demorgan’s law algebraically

Q3. Write the POS form of a Boolean function G, which is represented in a truth table as follows

A / B / C / G
0 / 0 / 0 / 1
0 / 0 / 1 / 1
0 / 1 / 0 / 0
0 / 1 / 1 / 0
1 / 0 / 0 / 1
1 / 0 / 1 / 0
1 / 1 / 0 / 0
1 / 1 / 1 / 1

Write the equivalent Boolean Expression R for the followingcircuit diagram:

Q5.(A)IfF(P,Q,R,S) = π (0,2,4,5,6,7,8,10,11,12,14), obtain the simplified form

usingK-Map.

(B)IfFu,v,w,z) = ∑ (0,3,4,5,7,11,13,15), obtain the simplified form

usingK-Map.

Q6. Write canonical SOP for the following Boolean expression

(X’+Y+Z’).(X’+Y+Z).(X’+Y’+Z).(X’+Y’+Z’)

Create a Power Point presentation on any of the following topics:

  1. GPRS – the Mobile Communication Mantra.
  2. USB Flashdrive – the Mobile Datastore.
  3. A study of Object Oriented Programming Methodology.
  4. Nanotechnology – the new generation technology.

pg. 1