CBSE Board Class 12 Computer Science Sample Papers 2005
CBSE Board Sample Papers 2005 for Class 12 Computer Science
Sample Paper – 2005
Class – XII
Subject – COMPUTER SCIENCE
Time:3HRS M.M 70
General Instruction:
(i) All Questions are compulsory
(ii) Programming Language : C++
Q1 a) Reusability of classes is one of the major properties of OOP. How it is implemented 2
b) Name the header file(s) required for the given built-in functions of C++ library 1
i) abc() ii)printf()
c) Rewrite the given snippet after correcting the error(s) if any. Underline the each
correction(s) 2
#include<iostream.h>
class Employee
{
int no;
class date
{
int dd,mm,yy;
public:
void print_date()
{ cout<<dd<<mm<<yy;}
};
date DOB;
public :
date DOJ;
void prin()
{
print_date();
cout<<DOB.dd<<DOB.mm<<DOB.yy;
}
};
void main()
{
Employee ob1;
date ob2;
}
d) What will be the output of the following program 3
#include<iostream.h>
void main()
{
static int arr[]={0,1,2,3,4};
int *p[] = { arr,arr+1,arr+2,arr+3,arr+4};
int **ptr=p;
ptr++;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
*ptr++;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
*++ptr;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
++*ptr;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
}
e) Predict the output for the program given below : 2
#include <iostream.h>
#define cube(x)(x*x*x);
void main()
{
int x=2,y,z;
y=cube(++x);
z=++y+386/cube(++x);
cout<<++x<<y<<z;
}
f) What will be the output of the following program given below : 2
#include<iostream.h>
void change (int *,int);
void main()
{
int a[] = { 2,4,6,8,10 };
change(a,5);
for(int I =0; i<5; i++) cout<<a[i];
}
void change(int *b, int n)
{
int i ;
for( i =0; i<n; i++)
*(b+i) = *(b+i)+5;
}
Q2a) What do you mean by static data members of a class ? Explain the characteristics of static
data members 2
b) Answer the questions (i) and (ii) after going through the following program : 2
#include<iostream.h>
#include<string.h>
class Hospital
{
long patients_no;
char Pat_name[35];
float charge;
Hospital() //function 1
{
patient_no = 7164;
strcpy(Pat_name, “JLO”);
charge=12750.00;
}
publc:
void Enquiry() // function2
{
cout<<patient_no<<”:” <<Pat_name<<” : ” <<charge<<endl;
}
};
void main()
{
Hospital Hosp; //statement 1
Hosp.Enquiry(); //statement 2
}
i)Will statement 1 initialize all the data members for the object Hosp with the value given in Function 1? Justify your answer suggesting the correction(s) to be made in the above code.
ii)What shall be the possible output when the program gets executed ? Assume if required suggested correction(s) are made in the program
c) Define a class Departmental with the following specification : 4
private data members
Prod_name string (45 charactes) [ Product name]
Listprice long
Dis_Price long [ Discount Price]
Net long [Net Price ]
Dis_type char(F or N) [ Discount type]
Cal_price() – The store gives a 10% discount on every product it sells. However at the
time of festival season the store gives 7% festival discount after 10%
regular discount. The discount type can be checked by tracking the
discount type. Where ‘F’ means festival and ‘N’ means Non- festival .
The Cal_price() will calculate the Discount Price and Net Price on the
basis of the following table.
public members
Constructor to initialize the string elements with “NULL”, numeric elements with 0 and character elements with ‘N’
Accept() - Ask the store manager to enter Product name, list Price and discount type . The function will invoke Cal_price() to calculate Discount Price and Net Price .
ShowBill() - To generate the bill to the customer with all the details of his/her purchase along with the bill amount including discount price and net price.
d) Answer the questions (i) to (iv) based on the following code: 4
class X
{
int P[20];
float b;
protected :
char str[20];
public:
X();
void Read();
void Display();
};
class E: protected X
{
int No;
protected :
float S;
public :
E();
void EDetails();
void DDetails();
};
class P : public X
{
int Pno;
long double b2;
pubic :
P();
void Accept();
void Show();
};
void main()
{
P obj;
}
i)Mention the members accessible by the obj declared in main()
ii)What is the size of obj in bytes? What type of inheritance is depicted in the given snippet?
iii)If E if inherited in private visibility mode and P in public visibility mode from E. name the members that can be accessed by the obj.
iv)Name the member functions that can access the data members str, if the inheritance is in multi-level format
Q3 a) Write a C++ function RevDup(int [], int) to remove the duplicate occurrence of the value
present in an integer array, passed to the function as a parameter. 3
For e.g. If array initially is X[] = { 1,1,1,7,5,2,2,6}
After removing duplicate values the array will be X{} = { 1,7,5,2,6}
b)An array Arr[25][10] is stored in the memory in row major order. If the address of
Arr[10[5] is 1405 and Arr[5][3] is 625. Find the location of Arr[7][7] 4
c)Write an user defined Sumup(int [ ][ ]) to display sum of upper half elements of a square
matrix . the function will return the sum of the values. 3
d)Evaluate the following postfix expression using stack and show the contents after
execution of each operations 2
-500, 15,7,0,-,10,2,0,-,*,+,*,+
e)Consider the following portion of a program, which implements Stack of Book . Write the
definition of the function Insert() and Pop() , to insert a new information about a book and to display the information of the book written by Jane Austen 4
struct bnode
{
int bno; /* book number */
char Aname[30]; /* Author name */
char Bname[45]; /* Book name */
float Price; /* Price of the book */
bnode *link ;
};
class LIBRARY
{
bnode * REAR,*FRONT;
public :
LIBRARY() { REAR= FRONT=NULL;}
void Insert (); // function to add new information to library
void Pop() ; // function to display the information from the stack
~LIBRARY(){ cout<<” Book not available “};
};
Q4 a) Observe the program segment given below carefully and fill in the blanks marked by the
statement1 and statement 2 using Seekg() and tellg() functions for performing the required
task 1
#include <fstream.h>
class Car
{
char No_Plate[15],Car_type[20];
public :
/* function to count the total no. of records in a file */
int Countrec();
};
int Car::Countrec()
{
fstream file ;
file.open(“ Veh.dat”,ios::binary| ios::in);
_______________________________ //statememt1
int bytes = ________________________ //statement 2
int Count = bytes/sizeof(Car);
file.close();
return Count;
}
b) Write a function that merges lines alternatively from two files and writes the results to new
file. If one file has less number of lines than the other , the remaining lines from the larger
file should be simply copied into the target file. 2
c) Given a binary file Resume.dat containing records of all the following class Candidate type 3
class Candidate
{
char C_name[20], Post_apply[20];
int Expr, Sal_Exp ;
public :
void Apply()
{
gets(C_name); gets(Post_apply);
cin>>Expr>>Sal_Exp;
}
char * Post()
{ return Post_apply; }
int Sal_Expected()
{ return Sal_Exp; }
void ShowDet()
{ cout<<C_name<<” “<<Post_apply<<” ”<<Expr<<” “<<Sal_Exp<<endl; }
};
Write a function in C++ that would read the content of Resume.dat and display the records of
all those candidate who have applied for “Sales Manager “ with an expected salary between
35000 .
Q5 a) What is the difference between DROP And DELETE Command of SQL ? Illustrate it with
an example 2
b) Study the following tables STAFF and SALARY and write SQL commands for the
question (i) to (iv) and give output for SQL queries (v) to (vi) 6
i)Display the name of all CA’s who are working for more than 5 years
ii)Display the number of staff joined year-wise
iii)Hike the Allowance of all female staff working in finance sector and joined the company before 2000
iv)Display the average salary given to the employee in each department
v)SELECT DEPT, COUNT(*)
FROM STAFF
WHERE SEX=’m’
GROUP BY DEPT
HAVING COUNT(*) >2
vi) SELECT AVG(BASIC+ ALLOWANCE), QUALF
FROM SALARY S1, STAFF S2
WHERE S1.ID=S2.ID
GROUP(QUALF)
vii) SELECT DISTINCT QUALF FROM STAFF
viii)SELECT NAME, BASIC+ALLOWANCE
FROM STAFF S, SALARY SA
WHERE S.ID=SA.ID AND YEAR(DOJ)<2002
Q6 a) State and Verify Absorption Law in Boolean Algebra. 2
b) Write the equivalent POS expression of following SOP form
F (x,y,z)= ∑ (0,2,4,6) 2
c) Draw the Logical circuit of the following expression with the help of NAND gate only x+yz 1
d) Obtain the simplified form of a Boolean expression using K-Map. 3
F(a,b,c,d)=∑(0,1,2,3,4,7,11,12,14)
Q7 a) Expand the following terminologies : 2
GSM
CDMA
XML
URL
b) What are Cookies? 1
c) Compare Optical Fiber and Coaxial transmission media 1
d) THE CSM organization has set up its new front office at Gangtok(Sikkim) for its
web- based activities. It has 4- Wings of buildings as shown in the diagram :
i) Suggest a most suitable cable layout of connection between the Wings and topology. 1
ii) Suggest the most suitable place to house the server of the organization, with suitable
reason. 1
iii) Suggest the placement of the following device : 1
Repeater
Hub/Switch
iv) The organization is planning to link its head office situated in Delhi with its branch office at
Gangtok. Suggest an economic way to connect it, the company is ready to compromise on the
speed of connectivity. Justify your answer. 1
Class – XII
Subject – COMPUTER SCIENCE
Time:3HRS M.M 70
General Instruction:
(i) All Questions are compulsory
(ii) Programming Language : C++
Q1 a) Reusability of classes is one of the major properties of OOP. How it is implemented 2
b) Name the header file(s) required for the given built-in functions of C++ library 1
i) abc() ii)printf()
c) Rewrite the given snippet after correcting the error(s) if any. Underline the each
correction(s) 2
#include<iostream.h>
class Employee
{
int no;
class date
{
int dd,mm,yy;
public:
void print_date()
{ cout<<dd<<mm<<yy;}
};
date DOB;
public :
date DOJ;
void prin()
{
print_date();
cout<<DOB.dd<<DOB.mm<<DOB.yy;
}
};
void main()
{
Employee ob1;
date ob2;
}
d) What will be the output of the following program 3
#include<iostream.h>
void main()
{
static int arr[]={0,1,2,3,4};
int *p[] = { arr,arr+1,arr+2,arr+3,arr+4};
int **ptr=p;
ptr++;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
*ptr++;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
*++ptr;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
++*ptr;
cout<<ptr-p<<*ptr-arr<<**ptr<<endl;
}
e) Predict the output for the program given below : 2
#include <iostream.h>
#define cube(x)(x*x*x);
void main()
{
int x=2,y,z;
y=cube(++x);
z=++y+386/cube(++x);
cout<<++x<<y<<z;
}
f) What will be the output of the following program given below : 2
#include<iostream.h>
void change (int *,int);
void main()
{
int a[] = { 2,4,6,8,10 };
change(a,5);
for(int I =0; i<5; i++) cout<<a[i];
}
void change(int *b, int n)
{
int i ;
for( i =0; i<n; i++)
*(b+i) = *(b+i)+5;
}
Q2a) What do you mean by static data members of a class ? Explain the characteristics of static
data members 2
b) Answer the questions (i) and (ii) after going through the following program : 2
#include<iostream.h>
#include<string.h>
class Hospital
{
long patients_no;
char Pat_name[35];
float charge;
Hospital() //function 1
{
patient_no = 7164;
strcpy(Pat_name, “JLO”);
charge=12750.00;
}
publc:
void Enquiry() // function2
{
cout<<patient_no<<”:” <<Pat_name<<” : ” <<charge<<endl;
}
};
void main()
{
Hospital Hosp; //statement 1
Hosp.Enquiry(); //statement 2
}
i)Will statement 1 initialize all the data members for the object Hosp with the value given in Function 1? Justify your answer suggesting the correction(s) to be made in the above code.
ii)What shall be the possible output when the program gets executed ? Assume if required suggested correction(s) are made in the program
c) Define a class Departmental with the following specification : 4
private data members
Prod_name string (45 charactes) [ Product name]
Listprice long
Dis_Price long [ Discount Price]
Net long [Net Price ]
Dis_type char(F or N) [ Discount type]
Cal_price() – The store gives a 10% discount on every product it sells. However at the
time of festival season the store gives 7% festival discount after 10%
regular discount. The discount type can be checked by tracking the
discount type. Where ‘F’ means festival and ‘N’ means Non- festival .
The Cal_price() will calculate the Discount Price and Net Price on the
basis of the following table.
public members
Constructor to initialize the string elements with “NULL”, numeric elements with 0 and character elements with ‘N’
Accept() - Ask the store manager to enter Product name, list Price and discount type . The function will invoke Cal_price() to calculate Discount Price and Net Price .
ShowBill() - To generate the bill to the customer with all the details of his/her purchase along with the bill amount including discount price and net price.
d) Answer the questions (i) to (iv) based on the following code: 4
class X
{
int P[20];
float b;
protected :
char str[20];
public:
X();
void Read();
void Display();
};
class E: protected X
{
int No;
protected :
float S;
public :
E();
void EDetails();
void DDetails();
};
class P : public X
{
int Pno;
long double b2;
pubic :
P();
void Accept();
void Show();
};
void main()
{
P obj;
}
i)Mention the members accessible by the obj declared in main()
ii)What is the size of obj in bytes? What type of inheritance is depicted in the given snippet?
iii)If E if inherited in private visibility mode and P in public visibility mode from E. name the members that can be accessed by the obj.
iv)Name the member functions that can access the data members str, if the inheritance is in multi-level format
Q3 a) Write a C++ function RevDup(int [], int) to remove the duplicate occurrence of the value
present in an integer array, passed to the function as a parameter. 3
For e.g. If array initially is X[] = { 1,1,1,7,5,2,2,6}
After removing duplicate values the array will be X{} = { 1,7,5,2,6}
b)An array Arr[25][10] is stored in the memory in row major order. If the address of
Arr[10[5] is 1405 and Arr[5][3] is 625. Find the location of Arr[7][7] 4
c)Write an user defined Sumup(int [ ][ ]) to display sum of upper half elements of a square
matrix . the function will return the sum of the values. 3
d)Evaluate the following postfix expression using stack and show the contents after
execution of each operations 2
-500, 15,7,0,-,10,2,0,-,*,+,*,+
e)Consider the following portion of a program, which implements Stack of Book . Write the
definition of the function Insert() and Pop() , to insert a new information about a book and to display the information of the book written by Jane Austen 4
struct bnode
{
int bno; /* book number */
char Aname[30]; /* Author name */
char Bname[45]; /* Book name */
float Price; /* Price of the book */
bnode *link ;
};
class LIBRARY
{
bnode * REAR,*FRONT;
public :
LIBRARY() { REAR= FRONT=NULL;}
void Insert (); // function to add new information to library
void Pop() ; // function to display the information from the stack
~LIBRARY(){ cout<<” Book not available “};
};
Q4 a) Observe the program segment given below carefully and fill in the blanks marked by the
statement1 and statement 2 using Seekg() and tellg() functions for performing the required
task 1
#include <fstream.h>
class Car
{
char No_Plate[15],Car_type[20];
public :
/* function to count the total no. of records in a file */
int Countrec();
};
int Car::Countrec()
{
fstream file ;
file.open(“ Veh.dat”,ios::binary| ios::in);
_______________________________ //statememt1
int bytes = ________________________ //statement 2
int Count = bytes/sizeof(Car);
file.close();
return Count;
}
b) Write a function that merges lines alternatively from two files and writes the results to new
file. If one file has less number of lines than the other , the remaining lines from the larger
file should be simply copied into the target file. 2
c) Given a binary file Resume.dat containing records of all the following class Candidate type 3
class Candidate
{
char C_name[20], Post_apply[20];
int Expr, Sal_Exp ;
public :
void Apply()
{
gets(C_name); gets(Post_apply);
cin>>Expr>>Sal_Exp;
}
char * Post()
{ return Post_apply; }
int Sal_Expected()
{ return Sal_Exp; }
void ShowDet()
{ cout<<C_name<<” “<<Post_apply<<” ”<<Expr<<” “<<Sal_Exp<<endl; }
};
Write a function in C++ that would read the content of Resume.dat and display the records of
all those candidate who have applied for “Sales Manager “ with an expected salary between
35000 .
Q5 a) What is the difference between DROP And DELETE Command of SQL ? Illustrate it with
an example 2
b) Study the following tables STAFF and SALARY and write SQL commands for the
question (i) to (iv) and give output for SQL queries (v) to (vi) 6
i)Display the name of all CA’s who are working for more than 5 years
ii)Display the number of staff joined year-wise
iii)Hike the Allowance of all female staff working in finance sector and joined the company before 2000
iv)Display the average salary given to the employee in each department
v)SELECT DEPT, COUNT(*)
FROM STAFF
WHERE SEX=’m’
GROUP BY DEPT
HAVING COUNT(*) >2
vi) SELECT AVG(BASIC+ ALLOWANCE), QUALF
FROM SALARY S1, STAFF S2
WHERE S1.ID=S2.ID
GROUP(QUALF)
vii) SELECT DISTINCT QUALF FROM STAFF
viii)SELECT NAME, BASIC+ALLOWANCE
FROM STAFF S, SALARY SA
WHERE S.ID=SA.ID AND YEAR(DOJ)<2002
Q6 a) State and Verify Absorption Law in Boolean Algebra. 2
b) Write the equivalent POS expression of following SOP form
F (x,y,z)= ∑ (0,2,4,6) 2
c) Draw the Logical circuit of the following expression with the help of NAND gate only x+yz 1
d) Obtain the simplified form of a Boolean expression using K-Map. 3
F(a,b,c,d)=∑(0,1,2,3,4,7,11,12,14)
Q7 a) Expand the following terminologies : 2
GSM
CDMA
XML
URL
b) What are Cookies? 1
c) Compare Optical Fiber and Coaxial transmission media 1
d) THE CSM organization has set up its new front office at Gangtok(Sikkim) for its
web- based activities. It has 4- Wings of buildings as shown in the diagram :
i) Suggest a most suitable cable layout of connection between the Wings and topology. 1
ii) Suggest the most suitable place to house the server of the organization, with suitable
reason. 1
iii) Suggest the placement of the following device : 1
Repeater
Hub/Switch
iv) The organization is planning to link its head office situated in Delhi with its branch office at
Gangtok. Suggest an economic way to connect it, the company is ready to compromise on the
speed of connectivity. Justify your answer. 1
CBSE Board Best Sellers
In order to keep pace with technological advancement and to cope up with CBSE Board examinations, Pearson group has launched Edurite to help students by offering Books and CDs of different courses online.
Sign Up FREE
Get help on CBSE Board Sample Question Paper for class 12 Now
Board Sample Paper
- CBSE Board Class 9 English Core 2011
- CBSE Board Class 12 Political Science 2009
- Karnataka Board Class 10 Home Science Sample Paper Of 2011
- CBSE Board Class 12 Computer Science 2007
- Madhya Pradesh Board Class 12 Economics 2013-SET-3
- CBSE Board Class 11 Accountancy 2007
- CBSE Board Class 11 Biology 2010
- CBSE Board Class 12 Entrepreneurship 2005
- Bihar Board Class 12 Physics 2012
- CBSE Board Geography Sample Papers for Class 12 for year 2011
Previous Year Paper
- CBSE Board 12 Biology Previous Year Question Paper 2007
- CBSE Board Class 11 Chemistry 2009
- CBSE Board Class 12 Geography 2008
- CBSE Board Class 12 Biology 2011
- CBSE Board Class 12 Functional English 2011
- CBSE Board Class 11 English Elective 2008
- CBSE Board Class 11 History 2011
- CBSE Board Class 10 English Core 2005
- CBSE Board Class 12 Physics 2007
- CBSE Board Class 10 Functional English 2011
Syllabus
- Himachal Pradesh Board Class 11 Music (Hindustani Vocal)
- Himachal Pradesh Board Class 11 Physics
- Madhya Pradesh Board Class 9 Gujarati (special)
- Madhya Pradesh Board Class 9 Marathi
- Madhya Pradesh Board Class 10 Tamil
- Madhya Pradesh Board Class 10 Gujarati (special)
- Gujarat Board Class 9 Social Science
- Madhya Pradesh Board Class 9 Marathi (special)
- CBSE Board Class 11 English Core
- Rajasthan Board Class 9 Social Science



