CBSE Board Class 12 Computer Science Sample Papers 2008
CBSE Board Sample Papers 2008 for Class 12 Computer Science
Sample Paper 2008
COMPUTER SCIENCE (Theory)
Class-XII
Time Allowed: 3hours Maximum Marks: 70
Note. (i) All questions are compulsory.
(ii) Programming Language: C+ +
Ques. 1.a)What is the difference between Run Type error and Syntax error? Give one example of each. 2
b)Name the header files that shall be needed for the successfully execution of following code: 1
void main()
{
char Word[]=”Exam”;
cout<<setw(20)<<Word;
}
c)Rewrite the following program after removing syntactical error(s) if any. Underline each correction. 2
#include “iostream.h”
Class MEMBER
{
int Mno;
float Fees;
PUBLIC:
void Register ( )
{cin>>Mno>>Fees;}
void Display( )
{cout<<Mno<<" : "<<Fees<<endl;}
};
void main()
{
MEMBER delete;
Register();
delete.Display();
}
d) Give the output of the following program segment (Assuming all required header files are included in the program): 2
void main()
{
char *NAME=”a ProFiLe!”;
for(int x=0;x<strlen(NAME);x++)
if(islower(NAME[x]))
NAME[x]=toupper(NAME[x]);
else
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
cout<<NAME<<endl;
}
e)Find the output of the following program. 3
#include<iostream.h>
void Withdef(int HisNum=30)
{
for(int I=20;I<=HisNum;I+=5)
cout<<I<<”,”;
cout<<endl;
}
void Control(int &MyNum)
{
MyNum+=10;
Withdef(MyNum);
}
void main()
{
int YourNum=20;
Control(YourNum);
Withdef();
cout<<”Number=”<<YourNum<<endl;
}
f)In the following program, find the correct possible output(s) from the options. Justify your answer. 2
#include<iostream.h>
#include<stdlib.h>
void main( )
{
randomize( );
int p=99,q=999;
int x=random(3)+4;
int y=random(2)+2;
for(int i=0;i<x;i++)
cout<<’#’;
cout<<p<<’-’;
for(i=0;i<y;i++)
cout<<’@’;
cout<<q<<endl;
}
i.##99-@999
ii.##99-@@999
iii.######99-@@999
iv.####99-@@@
Ques. 2.a)When will you make function inline and why? 2
b)Answer the questions (i) and (ii) after going through the following class: 2
class WORK
{
int WorkID;
char WorkType;
public:
~WORK( ) // Function 1
{
cout<<”Un-Allocated”<<endl;
}
void status( ) // Function 2
{
cout<<WorkID<<”;”<<WorkType<<endl;
}
WORK( ) // Function 3
{
WorkID=10;
WorkType=’T’;
}
WORK(WORK &W) // Function 4
{
WorkID=W.WorkID+12;
WorkType=W.WorkType+1;
}
};
(i)Which member function out of function1, function2, function3 and function4 shown in the above example of class WORK is called automatically, when the scope of an object gets over? Is it known as Constructor OR Destructor OR Overloaded Function OR Copy Constructor?
(ii)WORK W; //Statement 1
WORK Y (W); //Statement 2
Which member function out of Function1, Function2, Function3 and Function4 shown in above definition of class WORK will be called on execution of statement written as Statement 2? What is this function specifically known as out of Destructor or Copy Constructor or Parameterized Constructor?
c)Define a class Stock in C+ + with the following description: 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)
A member function FindDisc( ) to calculate discount as per the following rule:
If Qty<=50 Discount is 0
If Qty (51 and100) Discount is 5
If Qty>100 Discount is 10
Public Members:
A constructor to assign all values with 0 and null respectively
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 userto view the content of all the data members.
d)Answer the questions (i)to (iv) based on the following: 4
class FacetoFace
{
char CenterCode[10];
public:
void Input( );
void Output( );
};
class Online
{
char Website[50];
public:
void Sitein( );
void Siteout( );};
class Training : public FacetoFace, private Online
{
long Tcode;
float Charge;
int Period;
public:
void Register( );
void Show ( );
};
(i)Which type of inheritance is shown in the above example?
(ii)Write names of all member functions accessible from Show( ) function of class Training.
(iii)Write names of all the members accessible through an object of class Training.
(iv)Is the function Output( ) accessible inside the function SiteOut( )? Justify you answer.
Ques. 3.a)Write a function in C++ to find and return the sum of elements from all alternate elements of a two dimensional array passed as argument with size, starting from [0][0]. For eg 3
If the following is the content of the array
B[0][0]
B[0][1]
B[0][2]
4
5
1
B[1][0]
B[1][1]
B[1][2]
2
8
7
B[2][0]
B[2][1]
B[2][2]
9
6
3
The function should add elements B[0][0], B[0][2], B[1][1], B[2][0] and B[2][2].
b)An array T[50][20] is stored in the memory along the column with each element occupying 4 bytes. Find out the base address and address of element T[30[15], if an element T[25][10] is stored at the memory location 9800. 4
c)Write a function in C++ to delete an element from a dynamically allocated Queue where each node contains a real number as data. 3
Assume the following definition of MYNODE for the same.
struct MYNODE
{
float NUM;
MYNODE *Link;
};
d)Convert the following infix expression to its equivalent postfix expression Showing stack contents for the conversion: 2
(A+B)*(C^(D-E)+F)-G
e)Evaluate the following postfix notation of expression: 2
(Show status of stack after each operation)
True, False, NOT, OR, False, True, OR, AND
Ques. 4.
a)Observe the program segment given below carefully and fill the blanks marked statement 1 and statement 2 using seekg( ) and tellg( ) function for performing the required task. 1
#include<fstream.h>
class Employee
{
int Eno;
char Ename[30];
public:
//Function to count the total number of records
int Countrec( );
};
int Employee:: Countrec( )
{
fstream File;
File.open(“Emp.Dat”,ios::binary|ios::in);
___________ // Statement 1
int Bytes = ________________ // Statement 2
int count = Bytes/sizeof(Employee);
File.close( );
return count;
}
b)Assume a text file “coordinate.txt” is already created. Using this file create a C++ function to count the number of .words having first character capital. 2
Example:
Do less Thinking and pay more attention to your heart. Do Less Acquiring and pay more Attention to what you already have. Do Less Complaining and pay more Attention to giving. Do Less criticizing and pay more Attention to Complementing. Do less talking and pay more attention to SILENCE.
Output will be : Total words are 16
c)Given a binary file PHONE.DAT, containing records of the following class type 3
class Phonlist
{
char name[20];
char address[30];
char areacode[5];
char Phoneno[15];
public:
void Register()
void Show();
void CheckCode(char AC[])
{
return(strcmp(areacode,AC);
}
};
Write a function TRANSFER( ) in C++, that would copy all those records which are having areacode as “DEL” from PHONE.DAT to PHONBACK.DAT.
Ques. 5.a)What are DDL and DML Commands? Give one example of each. 2
b)Consider the following tables Stationary and Consumer. Write SQL commands for the statement (i) to (iv) and output for SQL queries (v) to (viii): 6
Table: Stationary
S_ID
StationaryName
Company
Price
DP01
Dot Pen
ABC
10
PL02
Pencil
XYZ
6
ER05
Eraser
XYZ
7
PL01
Pencil
CAM
5
GP02
Gel Pen
ABC
15
Table: Consumer
C_ID
ConsumerName
Address
S_ID
01
Good Learner
Delhi
PL01
06
Write Well
Mumbai
GP02
12
Topper
Delhi
DP01
15
Write & Draw
Delhi
PL02
16
Motivation
Banglore
PL01
(i)To display the details of those consumers whose Address is Delhi.
(ii)To display the details of Stationary whose Price is in the range of 8 to 15. (Both Value included)
(iii)To display the ConsumerName, Address from Table Consumer, and Company and Price from table Stationary, with their corresponding matching S_ID.
(iv)To increase the Price of all stationary by 2.
(v)SELECT DISTINCT Address FROM Consumer;
(vi)SELECT Company, MAX(Price), MIN(Price), COUNT(*) from Stationary GROUP BY Company;
(vii)SELECT Consumer.ConsumerName, Stationary.StationaryName, Stationary.Price FROM Strionary, Consumer WHERE Consumer.S_ID=Stationary.S_ID;
(viii)Select StationaryName, Price*3 From Stationary;
Ques.6.a)Verify the following algebraically 2
(A’+B’).(A+B)=A’.B+A.B’
b)Draw a logical Circuit Diagram for the following Boolean Expression: 2
A.(B+C’)
c)Write the equivalent Canonical Sum of Product for the following Product of Sum 1
Expression: F(X,Y,Z)= (1,3,6,7)
d)If F(a,b,c,d) =(0,1,3,4,5,7,8,9,11,12,13,15), obtain the simplified form using K-Map. 3
Ques.7.a)What was the role of ARPANET in the Computer Network? 2
b)Which of the following units measures the speed with which data can be transmitted from one node to another node of a network? Also, give the expansion of the suggested unit. 1
(i) KMph (ii) Mbps (iii) MGps
c)Write the full forms of the following: 1
(i) FTP (ii) FSF
d) “Vidya for All” is an educational NGO. It is setting up its new campus at Jaipur for its web based activities. The campus has four buildings as shown in diagram below: 4
Center to center distances between various buildings as per architectural drawings (in meters) is as follows:
Main Building to Resource Building
120m
Main Building to Training Building
40m
Main Building to Accounts Building
135m
Resource Building to Training Building
125m
Resource Building to Accounts Building
45m
Training Building to Accounts Building
110m
Expected number of Computers in each building is as follows:
Main Building
15
Resource Building
25
Training Building
250
Accounts Building
10
(i)Suggest a cable layout of connection between the buildings.
(ii)Suggest the most suitable place( i.e building) to house the server of this NGO. Also provide a suitable reason for your suggestion.
(iii)Suggest the placement of the following devices with justification:
i.Repeater
ii.Hub/Switch
(iv)The NGO is planning to connect its International office situated in Delhi. Which out of following wired communication links, will you suggest for very high speed connectivity?
i) Telephone Analog Line ii) Optical Fibre iii) Ethernet Cable
e)What are cookies? 1
f)What do you mean by FLOSS? 1
COMPUTER SCIENCE (Theory)
Class-XII
Time Allowed: 3hours Maximum Marks: 70
Note. (i) All questions are compulsory.
(ii) Programming Language: C+ +
Ques. 1.a)What is the difference between Run Type error and Syntax error? Give one example of each. 2
b)Name the header files that shall be needed for the successfully execution of following code: 1
void main()
{
char Word[]=”Exam”;
cout<<setw(20)<<Word;
}
c)Rewrite the following program after removing syntactical error(s) if any. Underline each correction. 2
#include “iostream.h”
Class MEMBER
{
int Mno;
float Fees;
PUBLIC:
void Register ( )
{cin>>Mno>>Fees;}
void Display( )
{cout<<Mno<<" : "<<Fees<<endl;}
};
void main()
{
MEMBER delete;
Register();
delete.Display();
}
d) Give the output of the following program segment (Assuming all required header files are included in the program): 2
void main()
{
char *NAME=”a ProFiLe!”;
for(int x=0;x<strlen(NAME);x++)
if(islower(NAME[x]))
NAME[x]=toupper(NAME[x]);
else
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
cout<<NAME<<endl;
}
e)Find the output of the following program. 3
#include<iostream.h>
void Withdef(int HisNum=30)
{
for(int I=20;I<=HisNum;I+=5)
cout<<I<<”,”;
cout<<endl;
}
void Control(int &MyNum)
{
MyNum+=10;
Withdef(MyNum);
}
void main()
{
int YourNum=20;
Control(YourNum);
Withdef();
cout<<”Number=”<<YourNum<<endl;
}
f)In the following program, find the correct possible output(s) from the options. Justify your answer. 2
#include<iostream.h>
#include<stdlib.h>
void main( )
{
randomize( );
int p=99,q=999;
int x=random(3)+4;
int y=random(2)+2;
for(int i=0;i<x;i++)
cout<<’#’;
cout<<p<<’-’;
for(i=0;i<y;i++)
cout<<’@’;
cout<<q<<endl;
}
i.##99-@999
ii.##99-@@999
iii.######99-@@999
iv.####99-@@@
Ques. 2.a)When will you make function inline and why? 2
b)Answer the questions (i) and (ii) after going through the following class: 2
class WORK
{
int WorkID;
char WorkType;
public:
~WORK( ) // Function 1
{
cout<<”Un-Allocated”<<endl;
}
void status( ) // Function 2
{
cout<<WorkID<<”;”<<WorkType<<endl;
}
WORK( ) // Function 3
{
WorkID=10;
WorkType=’T’;
}
WORK(WORK &W) // Function 4
{
WorkID=W.WorkID+12;
WorkType=W.WorkType+1;
}
};
(i)Which member function out of function1, function2, function3 and function4 shown in the above example of class WORK is called automatically, when the scope of an object gets over? Is it known as Constructor OR Destructor OR Overloaded Function OR Copy Constructor?
(ii)WORK W; //Statement 1
WORK Y (W); //Statement 2
Which member function out of Function1, Function2, Function3 and Function4 shown in above definition of class WORK will be called on execution of statement written as Statement 2? What is this function specifically known as out of Destructor or Copy Constructor or Parameterized Constructor?
c)Define a class Stock in C+ + with the following description: 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)
A member function FindDisc( ) to calculate discount as per the following rule:
If Qty<=50 Discount is 0
If Qty (51 and100) Discount is 5
If Qty>100 Discount is 10
Public Members:
A constructor to assign all values with 0 and null respectively
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 userto view the content of all the data members.
d)Answer the questions (i)to (iv) based on the following: 4
class FacetoFace
{
char CenterCode[10];
public:
void Input( );
void Output( );
};
class Online
{
char Website[50];
public:
void Sitein( );
void Siteout( );};
class Training : public FacetoFace, private Online
{
long Tcode;
float Charge;
int Period;
public:
void Register( );
void Show ( );
};
(i)Which type of inheritance is shown in the above example?
(ii)Write names of all member functions accessible from Show( ) function of class Training.
(iii)Write names of all the members accessible through an object of class Training.
(iv)Is the function Output( ) accessible inside the function SiteOut( )? Justify you answer.
Ques. 3.a)Write a function in C++ to find and return the sum of elements from all alternate elements of a two dimensional array passed as argument with size, starting from [0][0]. For eg 3
If the following is the content of the array
B[0][0]
B[0][1]
B[0][2]
4
5
1
B[1][0]
B[1][1]
B[1][2]
2
8
7
B[2][0]
B[2][1]
B[2][2]
9
6
3
The function should add elements B[0][0], B[0][2], B[1][1], B[2][0] and B[2][2].
b)An array T[50][20] is stored in the memory along the column with each element occupying 4 bytes. Find out the base address and address of element T[30[15], if an element T[25][10] is stored at the memory location 9800. 4
c)Write a function in C++ to delete an element from a dynamically allocated Queue where each node contains a real number as data. 3
Assume the following definition of MYNODE for the same.
struct MYNODE
{
float NUM;
MYNODE *Link;
};
d)Convert the following infix expression to its equivalent postfix expression Showing stack contents for the conversion: 2
(A+B)*(C^(D-E)+F)-G
e)Evaluate the following postfix notation of expression: 2
(Show status of stack after each operation)
True, False, NOT, OR, False, True, OR, AND
Ques. 4.
a)Observe the program segment given below carefully and fill the blanks marked statement 1 and statement 2 using seekg( ) and tellg( ) function for performing the required task. 1
#include<fstream.h>
class Employee
{
int Eno;
char Ename[30];
public:
//Function to count the total number of records
int Countrec( );
};
int Employee:: Countrec( )
{
fstream File;
File.open(“Emp.Dat”,ios::binary|ios::in);
___________ // Statement 1
int Bytes = ________________ // Statement 2
int count = Bytes/sizeof(Employee);
File.close( );
return count;
}
b)Assume a text file “coordinate.txt” is already created. Using this file create a C++ function to count the number of .words having first character capital. 2
Example:
Do less Thinking and pay more attention to your heart. Do Less Acquiring and pay more Attention to what you already have. Do Less Complaining and pay more Attention to giving. Do Less criticizing and pay more Attention to Complementing. Do less talking and pay more attention to SILENCE.
Output will be : Total words are 16
c)Given a binary file PHONE.DAT, containing records of the following class type 3
class Phonlist
{
char name[20];
char address[30];
char areacode[5];
char Phoneno[15];
public:
void Register()
void Show();
void CheckCode(char AC[])
{
return(strcmp(areacode,AC);
}
};
Write a function TRANSFER( ) in C++, that would copy all those records which are having areacode as “DEL” from PHONE.DAT to PHONBACK.DAT.
Ques. 5.a)What are DDL and DML Commands? Give one example of each. 2
b)Consider the following tables Stationary and Consumer. Write SQL commands for the statement (i) to (iv) and output for SQL queries (v) to (viii): 6
Table: Stationary
S_ID
StationaryName
Company
Price
DP01
Dot Pen
ABC
10
PL02
Pencil
XYZ
6
ER05
Eraser
XYZ
7
PL01
Pencil
CAM
5
GP02
Gel Pen
ABC
15
Table: Consumer
C_ID
ConsumerName
Address
S_ID
01
Good Learner
Delhi
PL01
06
Write Well
Mumbai
GP02
12
Topper
Delhi
DP01
15
Write & Draw
Delhi
PL02
16
Motivation
Banglore
PL01
(i)To display the details of those consumers whose Address is Delhi.
(ii)To display the details of Stationary whose Price is in the range of 8 to 15. (Both Value included)
(iii)To display the ConsumerName, Address from Table Consumer, and Company and Price from table Stationary, with their corresponding matching S_ID.
(iv)To increase the Price of all stationary by 2.
(v)SELECT DISTINCT Address FROM Consumer;
(vi)SELECT Company, MAX(Price), MIN(Price), COUNT(*) from Stationary GROUP BY Company;
(vii)SELECT Consumer.ConsumerName, Stationary.StationaryName, Stationary.Price FROM Strionary, Consumer WHERE Consumer.S_ID=Stationary.S_ID;
(viii)Select StationaryName, Price*3 From Stationary;
Ques.6.a)Verify the following algebraically 2
(A’+B’).(A+B)=A’.B+A.B’
b)Draw a logical Circuit Diagram for the following Boolean Expression: 2
A.(B+C’)
c)Write the equivalent Canonical Sum of Product for the following Product of Sum 1
Expression: F(X,Y,Z)= (1,3,6,7)
d)If F(a,b,c,d) =(0,1,3,4,5,7,8,9,11,12,13,15), obtain the simplified form using K-Map. 3
Ques.7.a)What was the role of ARPANET in the Computer Network? 2
b)Which of the following units measures the speed with which data can be transmitted from one node to another node of a network? Also, give the expansion of the suggested unit. 1
(i) KMph (ii) Mbps (iii) MGps
c)Write the full forms of the following: 1
(i) FTP (ii) FSF
d) “Vidya for All” is an educational NGO. It is setting up its new campus at Jaipur for its web based activities. The campus has four buildings as shown in diagram below: 4
Center to center distances between various buildings as per architectural drawings (in meters) is as follows:
Main Building to Resource Building
120m
Main Building to Training Building
40m
Main Building to Accounts Building
135m
Resource Building to Training Building
125m
Resource Building to Accounts Building
45m
Training Building to Accounts Building
110m
Expected number of Computers in each building is as follows:
Main Building
15
Resource Building
25
Training Building
250
Accounts Building
10
(i)Suggest a cable layout of connection between the buildings.
(ii)Suggest the most suitable place( i.e building) to house the server of this NGO. Also provide a suitable reason for your suggestion.
(iii)Suggest the placement of the following devices with justification:
i.Repeater
ii.Hub/Switch
(iv)The NGO is planning to connect its International office situated in Delhi. Which out of following wired communication links, will you suggest for very high speed connectivity?
i) Telephone Analog Line ii) Optical Fibre iii) Ethernet Cable
e)What are cookies? 1
f)What do you mean by FLOSS? 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
- Andhra Pradesh Board Class 12 Physics 2005
- CBSE Board Class 9 Social Science 2010
- CBSE Board Class 11 Computer Science 2010
- Madhya Pradesh Board Class 10 Social Science 2013-SET-2
- CBSE Board Class 10 Math 2008
- Tamilnadu Board Class 12 Biology Sample Paper Of 2011
- CBSE Board Class 11 Biology 2008
- CBSE Board Class 10 English Core 2010
- CBSE Board Class 11 Political Science 2009
- CBSE Board Class 12 Sample Paper of Math For 2007
Previous Year Paper
- CBSE Board Class 12 Computer Science 2005
- CBSE Board Class 12 Psychology 2007
- CBSE Board Class 11 Biology 2011
- CBSE Board Class 12 English Elective 2010
- CBSE Board Class 12 Fashion Studies 2007
- CBSE Board Class 11 Political Science 2007
- CBSE Board Class 11 Geography 2009
- CBSE Board Class 11 English Elective 2009
- CBSE Board Class 11 Accountancy 2007
- CBSE Board Class 12 Computer Science 2011
Syllabus
- Gujarat Board Class 11 Political Science
- Himachal Pradesh Board Class 10 Introductory Information Technology
- Himachal Pradesh Board Class 12 Accountancy
- West Bengal Board Class 11 Syllabus For Accountancy
- Himachal Pradesh Board Class 12 Physical Education
- Madhya Pradesh Board Class 12 Economics
- Madhya Pradesh Board Class 12 Business Economics
- Madhya Pradesh Board Class 12 Kannada
- Madhya Pradesh Board Class 12 Sociology
- CBSE Board 12th Business Studies Syllabus



