# CBSE Board Class 12 Computer Science Previous Year Question Papers 2008

## CBSE Board Previous Year Question Papers 2008 for Class 12 Computer Science

Previous Paper – 2008
Class – XII
Subject – Computer Science

Time allowed :3 hours      Maximum Marks:70

General Instructions:
1.All questions are compulsory.
3.Attempt all parts of questions together.
Q1.(a) What is the difference between Actual Parameter and Formal Parameters?  2

(b) Write the name of the header files to which the following belong:   1

(i) frexp ( )   (ii) isalnum

(c) Rewrite the following program after removing the syntactical errors (if any) . Underline each correction.          2

# include<iostream.h>
struct Pixels
{
int Color, Style;
}
void ShowPoint(Pixels P)
{
cout<<P.Color,P.Style<<endl;
}
void main ()
{
Pixels Point1=(5,3);
ShowPoint(Point1);
Pixels Point2=Point1;
Color.Point1 +=2;
ShowPoint(Point2);
}

(d)Find the output of the following program:       3

#include<iostream.h>
void Changethecontent(int Arr[],int Count)
{
for(int C=1;C<Count;C++)
Arr[C-1] +=Arr[C];
}
void main()
{
int A[]= {3,4,5}, B[]={10,20,30,40}, C[]={900,1200};
Changethecontent(A,3);
Changethecontent(B,4);
Changethecontent(C,2);
for(int L=0;L<3;L++) cout<<A[L]<<’#’;
cout<<endl;
for(L=0;L<4;L++) cout<<B[L]<<’#’;
cout<<endl;
for(L=0;L<2;L++) cout<<C[L]<<’#’;
}

(e) Find the output of the following program:      2

# include <iostream.h>
Stuct Game
{
Cha Magic[20];int Score;
};
Void main ( )
{
Game M= {“Tiger”,500};
char= *choice
Choice =M.Magic;
Choice[4]=P;
Choice[2]=’L’;
M.Score +=50;
Count << M.Magic<<M.Score<<endl;
Game N=M;
N.Magic[0]=’A’; N.Magic[3]=’J’
N.Score - =120;
Cout<< N.Magic<<N.Score<<endl;
}

(f)In th following  program, if the value of N given by the user is 20, what  is the maximum and minimum value s of the program could possibly display?    2

Q2(a). Differentiate between private and protected visibility modes in content of Object Oriented programming using a suitable example illustrating both.    2

(b)Answer the questions(i) and (ii) after going through the following program:  2

# include<iostream.h>
#include<string.h>
Class Mall
{
char Type[20];
char Product[20];
int Qty;
float Price;
Mall ( )  //function 1
{
strcpy(Type, “Electronic”)’
strcpy(Product,”Laptop”);
Qty =20;
Price =32500;
}
Public:
Void Display ( )   //function 2
{
cout << Type < “-“ <<Product <<”.”<<Qty<<”@”;
cout << Price << endl;
}
};
Void main( )
{
Mall M;  //statement 1
M.Display ( );  //statement 2
}

(i)Will statement 1 initialize all the data members for object M with the values given in the function 1?( Yes or No). Justify your answer suggesting the correction(s) to be made in the above code.

(ii)What will be the possible output when the program gets executed?
(Assuming, if required – the suggested correction(s) are made in the program)

(c) Define a class Garments in C++ with the following descriptions:   4
Private Members
GCode   of type string
GType   of type string
GSize   of type string
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
TROUSER 3000
SHIRT  2000
For the value of GFabric other than “COTTON” the above mentioned GPrice gets reduced by 25%
Public Members
A constructor to assign initial values of GCode,GType and GFabric with the word “NOT ALLOTED” and GSize and GPrice with 0.
A function Input ( ) to input the values of the data members GCode,GType, GSize and GFabric and invoke the Assign ( ) function.
A function Display ( ) which displays the content of all the data members for a Garment.

(d) Answer the questions (i) to (iv) based on the following  code:    4
class Toys
{
char  Tcode[5];
protected:
float price;
void calcprice(float);
public:
Toys( );
Void Tinput( );
Void Tshow( );
};
Class SoftToys : public Toys
{
char STName[20];
foat weight;
Public:
SoftToys( );
Void STinput( );
Void STshow( );
};
Class Electronic Toys : public Toys
{
char ETName[20];
char Battery Type[10];
int Batteries;
public:
Electronic Toys( );
Void ETinput ( );
voidETshow( );
};

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

(ii) How many bytes will be required by an object of the class Electronic Toys?

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

(iv) Write name of all the member functions accessible by an object of the class Electronic Toys.

Q3.(a) Write a function in C++ to merge the contents  of two sorted arrays A &B into third array C. Assuming array A and B are sorted in ascending order and the resultant  array C is also required to be in ascending order.       3

(b) An  array S[40] [30] is stored in the memory along the row with each of the element occupying 2 bytes, find out the memory location for the element S[20] [10],if the Base Address of the array is 5000.        3

(c) Write the function in C++ to perform Insert operation in a dynamically allocated Queue containing  name of students.        4

(d) Write a  function in C++ to find the sum of both  left and right diagonal elements from a two dimensional array (matrix)        2

(e)Evaluate the following postfix notation of expression:     2
20, 30,+, 50, 40,-,*

Q4 (a) Observe the program segment given below  carefully, and answer the  question that follows:           1

class student
{
long sid;  // student’s id
char Name [30]; //student’s name
float score;  //student’s score
public:
void Enroll( );
void Disp ( );
void MarkScore( );  // function to change score
long R_Sid ( ) {return Sid;}
};
Void Scoreupdate (long id)
{
fstream File;
File.open(“STUD.DAT”, ios:: binary | ios : : in | ios : : out);
Student S;
int record = 0 ,found = 0;
while (!found && file.read( (char *) &S,sizeof (S)))
{
If (id == S.R_Sid( ))
{
Cout<<”Enter new score “;
S.MarkScore( );
--------------------------------------------  //statement 1
-------------------------------------------  //statement 2
Found =1;
}
Record ++;
If(found ==1)
Cout << “\nrecord update”;
File.close( );
}
}

Write the statement 1 to position the file Pointer at the beginning of the record for which the student’s Id marches with the argument passed, and statement 2 to Write the updated records at the position.

(b) Write a function in C++ to count the number of lower case alphabets in a text file “TRY.TXT”.           2

(c) Write the function in C++ to add new objects at the bottom of a binary file   3

“STUDENT.DAT”, assuming the binary file is containing the objects of the following class:
Class STUD
{
int Rno;
char Name[20];
public:
void Enter( ) {cin>> Rno;gets(Name);}
void Display( ) {cout<< Rno<<Name <<endl;}
};

Q5(a) What do you understand by Primary key and Candidate Keys?   2

Consider the following tables  EMPLOYEE and SALGRADE and answer (b) and ( c ) parts of this questions:
TABLE :EMPLOYEE
ECODE
NAME
DESC
DOJ
DOB
11
AMIT
EXECUTIVE
S003
23-03-2003
13-01-1980
12
RAM SHARMA
S002
12-02-2010
22-07-1987
13
CHITRA
RECEPTIONIST
S003
24-06-2009
24-07-1983
14
NARESH
GM
S002
11-08-2006
03-03-1984
18
PRIYA
CEO
S001
29-12-2004
19-01-1982
SALARY
HRA
S001
56000
18000
S002
32000
12000
S003
24000
8000

(b) Write SQL commands for the following statements:     4

1.To display NAME and DESC of those EMPLOYEEs, whose  SALGRADE is either S002 or S003.

2.To display the details of all EMPLOYEEs in descending order of DOJ.

3.To display the content of the EMPLOYEEs table, whose DOJ is in between ’09-02-2006’ and ’08-08-2009’.

4.To add a new row with the following:

(c) Give the output of the following  SQL queries:      2

IV.SELECT MIN(DOB),MAX(DOJ)FROM  EMPLOYEE;

Q6.(a)State and verify De Morgan’s law in Boolean Algebra.    2

(b)  Draw a Logical Circuit Diagram for the following  Boolean Expression:  2
A’. (B’+C)

(c) Convert the following Boolean expression into its equivalent Canonical Sum of Product from (SOP).           1

(d) Reduce the following Boolean expression using K-Map:     3
F(A,B,C,D)=∑ (0,2,3,4,6,7,810,12)

Q7(a)Define the term Bandwidth. Give  any one unit of Bandwidth.   1

(b) When do you prefer XML over HTML and why?     1

(c)How firewall protect our Network?       1

(d) What is the importance of URL in networking?      1

(e)How is a Cracker different from Hacker?       1

(f)What do you mean by Open Source Software?      1

(g)G.S University is setting up its Academic School at Pragati Nagar and planning to set up a network. The university has 3 academics schools and one administration center as shown in the diagram below:          4

Center to center distances between various buildings is as follows:
60 M
Law school to Technology  School
90 M
115 M
25 M
40 M
45M
Number of Computers in each of the school /center  is follows;
125
Technology School
50
35
Law School
25
I.Suggest the most suitable place (i.e school/center) to install the server of this university with suitable reason.
II.Suggest an ideal layout for connecting these school/center for  a wired connectivity.
III.Which device will you suggest to be placed/installed in each of these schools/center to  efficiently connect all the computers with in these schools/center?
IV.The university is planning to connect its admission office in the closest big city, which is more then 350km from the university .Which type of network out of LAN,MAN,OR WAN will  be formed? Justify your answer.

## 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.