CBSE Board Class 12 Computer Science Previous Year Question Papers 2009


CBSE Board Previous Year Question Papers 2009 for Class 12 Computer Science

Previous Paper – 2009
CLASS - XII
SUBJECT – COMPUTER SCIENCE (SET A)
Duration : 3 Hours       Maximum Marks : 70

General Instructions :

(i) All questions are compulsory. (ii) Programming Language C++
Q1. a. What is difference between Actual parameter and Formal parameter? Give an example in C++ to illustrate both type of parameters.    [2]
b. Which C++ header file(s) will be essentially required to be included to run / execute the following C++ code?        [1]
void main()
{
int rno=24; char name[]=”Anil Singhal”;
cout<<setw(10) <<rno<<setw(20) << name<<endl;
}

(c) Rewrite the following C++ program code after removing syntax error(s) if any. Underline each correction.         [2]
include<iostream.h>
class FLIGHT
{ long Fcode; char Description[25];
FLIGHT() { Fcode=0;}
public
void getinfo()
{cin>>Fcode; gets(Description); }
void show()
{ cout<<Fcode<<” “ <<Description<<endl; } };
void main()
{
FLIGHT F;
getinfo.F(); show.F(); }

(d)  Find the output of the following program:      [3]
#include<iostream.h>
void main( )
{
int Array[]={4,6,10,12}; 
int *pointer=Array; 
for(int I=1;I<=3;I++)

cout<<*pointer<<”#”;   pointer++; } 
cout<<endl;
for(I=1;I<=4;I++)
{  (*pointer)*=3;  --pointer;   }
for(I=1;I<5;I++)
cout<<Array[I-1]<<”@”;    cout<<endl;  }

(e ) Find the output of the following program: (Assuming all header files are included)            [2]
void Mycode(char Msg[],char C)
{ for(int i=0;Msg[i]!=’\0’;i++)
{ if(Msg[i]>=’B’ && Msg[i]<=’H’)
Msg[i]=tolower(Msg[i]);
else if(Msg[i]==’A’ || Msg[i]==’a’)
Msg[i]=C;
else
if(i%2==0)
Msg[i]=toupper(Msg[i]);
else  Msg[i]=Msg[i-1];  } }
void main() { char text[]=”ApaCHeSeRvEr”;
Mycode(Text,’#’); cout<<” New Line = “<<text;}

(f) Study the following program and select the possible output from it with justification:            [2]
#include<iostream.h>
#include<stdlib.h>
const int NUM=3;
void main()
{ randomize(); int N;
N=random(NUM)+50;
for(int i=50;I <=N;i++)
cout<<i<<”*”;
cout<<endl; }
(i)50*51*52*  (ii) 52*51*50*  (iii) 50* 51* (iv) 50*51*52*53*

Q.2 a. How does invoking of constructor differ in inheritance and containership?  Give example.           [2]
b. Answer the questions (i) and (ii) after going through the following class:  [2]
class Seminar
{
int Time;
public:
Seminar() //Function 1
{ Time=30;cout<<"Seminar starts now"<<endl;}
void Lecture() //Function 2
{ cout<<"Lectures in the seminar on"<<endl;
}
Seminar(int Duration) //Function 3
{ Time=Duration;cout<<"Seminar starts now"<<endl; }
~Seminar()  //Function 4
{ cout<<"Vote of thanks"<<endl;}
};
i) In Object Oriented Programming, what is Function 4 referred as and when does it get invoked/called?
ii) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions.
(c ) Define a class Applicants with the following information:
Private members
a.rollno of type int
b.Name of type character with size as 30
c.Category of type character (‘G’ for general , ‘S’ for Schedule caste , ‘T’ for Schedule Tribe)
d.Fees of type Float
Public members
A constructor to initialise category as a blank character and fees as 0.
A function to input Roll number , name and category of the student, and to calculate fees of the student on the basis of category entered as :
Category ‘G’ then Fees is 12000
Category ‘S’ then Fees is 4000
Category ‘T’ then Fees is 3500
A function to display all the information of the applicant.
d. Answer the questions (i) to (iv) based on the following:     [4]
class Regular
{ char School Code [10];
public :
void InRegular(); void outRegular(); };
class Distance
{ char StudyCentreCode[5];
public :
void Indistance ( );
void OutDistance ( ); };
class Course: public Regular, private Distance
{ char Code[5];
float Fees ;  int Duration;
public:
void InCourse (); void Out Course ();  };
(i) Which type of Inheritance is shown in the above example ?
(ii) Write names of all the member functions accessible from OutCourse function of class Course.
(iii) Write name of all the members accessible through an object of class Course.
(iv) Is the function InRegular() accessible inside the function InDistance() ? Justify your answer.

3. (a) Write a function SORTSCORE() in C++ to sort an array of structure Examinee in descending order of Score using Bubble Sort.      [3]
Note : Assume the following definition of structure Examinee.
struct Examinee
{ long RollNo;
char Name[20];
float Score;};

(b) An array T[50][20] is stored in the memory along the column with each of the elements 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.  [3]

(c) Write a function QUEDEL() in C++ to display and delete an element from a dynamically allocated Queue containing nodes of the following given structure : [4]
struct NODE
{ int Itemno;
char Itemname[20]; NODE *Link; };

(d) Define a function SWAPARR() in C++ to swap (interchange) the elements of the alternate rows for a two dimensional integer array passed as the argument of the function.           [3]
Example : If the two dimensional array contains
5 6 3 2
1 2 4 9
2 5 8 1
9 7 5 8
After swapping of the contents, it should be as follows :
2 5 8 1
9 7 5 8
5 6 3 2
1 2 4 9
(e) Convert the following infix expression to its equivalent postfix expression showing stack contents for the conversion:     [2]
A + B *(C – D) / E ^ F

Q4. a. Observe the program segment given below and fill the gaps as staements1 and statement 2 using seekp() and tellg() functions.       [1]
   # include<fstream.h>
class employee
{ int eno; char Ename[20];
public:
int counter();
};

int employee : : counter ()
{ 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. Write a function in C++ to count the words “This” and “These” present in a text file “NOTES.TXT”.           [2]
c. Write a function in c++ to search and display details of all trains , whose destination is “Delhi” from a binary file “TRAIN.DAT”. Assuming the binary file is containing the objects of the following class:      [3]
class TRAIN { int Tno; // Train Number
char From[20]; // Train Starting Point
char To[20] //Train destination
public:
char *getfrom() { return From;}
char *getto() { return To; }
void Input() { cin>>Tno; gets(From); gets(To); }
void Show() { cout<<Tno<<”:”<<From <<“:” <<To<<endl; }};

5. (a) What are candidate keys in a table ? Give s suitable example of candidate keys in a table.           [2]
(b) Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).  [6]
Table : GARMENT
GCODE
DESCRIPTION
PRICE
FCODE
READYDATE
10023
PENCIL
SKIRT
1150
F03
19–DEC–08
10001
FORMAL
SHIRT
1250
F01
12–JAN–08
10012
INFORMAL
SHIRT
1550
F02
06–JUN–08
10024
BABY
TOP
750
F03
07–APR–07
10090
TULIP
SKIRT
850
F02
31–MAR–07
10019
EVENING
GOWN
850
F03
06–JUN–08
10009
INFORMAL
PANT
1500
F02
20–OCT–08
10007
FORMAL
PANT
1350
F01
09–MAR–08
10020
FROCK
850
F04
09–SEP–07
10089
SLACKS
750
F03
20–OCT–08
Table : FABRIC
FCODE
TYPE
F04
POLYSTER
F02
COTTON
F03
SILK
F01
TERELENE
(i) To display GCODE and DESCRIPTION of a each dress in descending order of GCODE.
(ii) To display the details of all the GARMENTs, which have READYDATE in between 08–DEC–07 and 16–JUN–08 (inclusive of both the dates).
(iii) To display the average PRICE of all the GARMENTs, which are made up of FABRIC with FCODE as F03.
(iv) To display FABRIC wise highest and lowest price of GARMENTs from DRESS table. (Display FCODE of each GARMENT along with highest and lowest price)
(v) SELECT SUM (PRICE) FROM GARMENT WHERE FCODE= ‘F01’;
(vi) SELECT DESCRIPTION, TYPE FROM GARMENT, FABRIC WHERE
GARMENT.FCODE = FABRIC. FCODE AND GARMENT. PRICE>=1260;
(vii) SELECT MAX (FCODE) FROM FABRIC;
(viii) SELECT COUNT (DISTINCT PRICE) FROM FABRIC;

6. (a)Verify X’Y + X.Y’ + X’Y’ = (X’ + Y’) using truth table.     [2]
(b) Draw the equivalent logic circuit diagram for the following Boolean Expression using NAND gates only.           [2]
XY’ + X’Z
(c) Write the POS form of a Boolean function H, which is represented in a truth table as follows:            [1]

(d) Reduce the following Boolean Expression using K–Map:    [3]
F(P, Q, R, S) = ∑ (1, 2, 3, 5, 6, 7, 9, 11, 12, 13, 15)

Q7. (a). What do you understand by the term Firewall. What is it used for? [1]
(b). Expand the following terminologies :       [1]
(i) WLL    (ii) TCP/IP
(c ) What is the significance of cookies in Internet surfing?    [1]
(d) Differentiate between technologies of Optical Fibre and Coaxial Cable. [1]
(e ) Explain the following terms : (i) GNU   (ii) FLOSS     [2]
(f) The premises of a school building is divided into blocks ADM, A,B,C  and D as shown in the following figure:         [4]

Centre to Centre Distance between different blocks are as follows:
Block A to Block B
100 m
Block A to Block C
120 m
Block A to Block D
220 m
Block B to C
60 m
Block B to D
100 m
Block C to D
100 m
Block ADM to A
120 m
Block ADM to B
30 m
Block ADM to C
40 m
Block ADM to D
100 m
Each of the above blocks has following number of computers :
ADM
10
A
25
B
30
C
25
D
40
a.Suggest a cable layout between the different blocks.
b.Suggest the most suitable place to house the server of the school , giving suitable reasons.
c.Suggest the placement of the following devices with proper justification:
(i)Hub/Switch(ii) repeater
d.If the school needs to link up to its governing office , which is in a neighbouring city (approximately 100 Km away), suggest the best way for the connection, provided price is not a factor.