(Download) CBSE Class XII Computer Science Guess Paper : 2012 - Set - I (Class and Objects)

Disclaimer: This website is NOT associated with CBSE, for official website of CBSE visit - www.cbse.gov.in

https://cbseportal.com/sites/default/files/CBSE-LOGO.jpg

CBSE - NEW DELHI

Guess Paper – 2012

Class – XII

Subject – Computer Science

Class and Object

Question1. Define a Class student with the following specification:

Private members

admno integer type

sname 20 character

eng, math,sci, total float

ctotal( ) A function to calculate the total marks with float return type.

Public members:

takedata ( ) function to reed admno, sname,eng,math, sci and invoke ctotal( ) to calculate total.

showdata ( ) to display all the data members on the screen.

Question 2. Define a class Garments in C++with the following descriptions:

Private Members:

GCode of type string

GType of type string

GSize of type integer

GFabric of type string

GPrice of type float

A function Assign( ) which calculates and assigns the value of GPrice as follows:

For the value of GFabric "COTTON",

GType GPrice(Rs)

TROUSER 1300

SHIRT 1100

For GFabric other than "COTTON" the above mentioned

GPrice gets reduced by 10%

Public Members :

A constructor to assign initial values of GCode, GType and GFabric with the

word "NOT ALLOTTED" and GSize and GPrice with o.

A function Input( ) to input the values of the data members GCode, GType,

GSize and GFabricl and invoke the Assign( ) function.

GAafrumnecntito. n Display( ) which displays the content of all the data members for a Garment

Question 3. Define a class DVD in C++ with following description :

Private members :

D Code Integer
Title string
Duration integer
Actor string
Actress string
Price  real number

Public members :

Parameterized constructor to get initial values for all members.

Define copy constructor for the class.

Function INCOMP( ) to input values

Function DISPCOMP( ) to view the contents of all the data members

Question 4. Define and declare a class MYFOLDER with the following specifications:

Private Members:

Filename: An array of string of size [10][25]

Availspace: long

Usedspace: long

Public members:

newfileEntry( ): Function to read value

Retavailspace( ): Function that returns the value of total kilobytes available

Showfile(): Function to display details.

Question 5. Define a class teacher with the following specifications:

( No need to define the functions)

Private members:

name: 20 characters

sub: 10 characters

basic,da,hra: integers

salary: float

calculate(): that returns salary

public members:

readdata(): read data values

showdata(): display details

Question 6.  struct date

{

int dd, mm, yy ;

};

struct doner

{

char name[20];

date dob;

};

void main( )

{

doner person;

------------------

------------------

}

How will you access the fields : name and yy of the above structure? (2)

Question 7.  Define a class named Publisher in C++ with the following descriptions :

Private members

Id long

title 40 char

author 40 char

price , stockqty double

stockvalue double

valcal() A function to find price*stockqty with double as return type

Public members

· a constructor function to initialize price , stockqty and stockvalue as 0

· Enter() function to input the idnumber , title and author

· Takestock() function to increment stockqty by N(where N is passed as argument to this function) and call the function valcal() to update the stockvalue().

· sale() function to decrease the stockqty by N (where N is sale quantity passed to this function as argument) and also call the function valcal() to update the stockvalue

outdata() function to display all the data members on the screen.

Question 8. Define a class Bank to represent the bank account of a customer with the following

specification 4

Private Members:

- Name of type character array(string)

- Account_no of type long

- Type_of_account ( S for Saving Account, C for current Account) of type char

- Balance of type float

Public Members:

A constructor to initialize data members as follows

- Name NULL

- Account_no 100001

- Type_of_account ‘S’

- Balance 1000

A function NewAccount() to input the values of the data members Name, Account_no,

Type_of_account and Balance with following two conditions

· Minimum Balance for Current account is Rs.3000

· Minimum Balance for Saving account is Rs.1000

A function Deposit() to deposit money and update the Balance amount.

A function Withdrawal() to withdraw money. Money can be withdrawn if minimum

balance is as >=1000 for Saving account and >=3000 for Current account.

A function Display() which displays the contents of all the data members for a account.

Question 9. Define a class named result in C++ with the following descriptions: 4

Private members:

Rollno – integer number

Name – String of 20 characters

Subjects – an integer array to store 6 subject marks

Total – integer number

Average – float number

Public members :

¨ A constructor to initialize the values of data members.

¨ Function Get_Value ( ) to read the values for all the data members.

¨ Function Show_Value ( )to show Rollno, Name, Total and Average.

¨ Function Best_Five ( )to find the average and total marks of top 5 subject marks.

Question 10.  Define a class named Football in C++ with the following descriptions: Private members:

Team_A, Team_B– Strings of 20 characters

Goal_A, Goal_B – integer numbers

Winner – String of 20 character

Public members :

¨ A constructor to initialize the values of data members.

¨ Function Get_Team( ) to read the values for all the data members.

¨ Function Show_Team( ) to show Team_A, Goal_A, Team_B, Goal_B and Winner.

¨ Function Champion( ) to assign the value of Winner based on high scoring team. If both team scored same number of goals assign “Draw”.