CBSE India | CBSE AIEEE Sample Papers | CBSE Class X | CBSE Class XII | CBSE Results | CBSE Syllabus | CBSE Sample Papers | CBSE Datesheet | CBSE Exams | CBSE Schools in India | CBSE Guess Papers | CBSE PMT

» Computer Science : CBSE Sample Question Papers

CBSE Computer Science Sample Question Paper - Year 2000

Computer Science Class XII (CBSE)
You are on questions 1 to 3

Max Marks : 75
Time allowed : 3 hrs

Q 1. (a) Illustrate the concept of function overloading with the help of an example?

Q 1 (b) Name the header file, to which following built-in function belong:

(i)isupper( )
(ii)setw( )
(iii)exp( )
(iv)strcmp( )

Q 1 © Will the following program execute successfully? If not, state the reason(s).
#include
void main()
{
int s1,s2,num;
s1=s2=0;
for(x=0;x<11;x++)
{
cin< 0) s1+=num; else s2=/num;
}
cout< }

Q 1 (d) Give the output of the following program segment (Assuming all required header files are included in the program):
char *NAME="a ProFiLe";
for(int x=0;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<

Q 1 (e) Write the output of the following program:
#include
int func (int &x, int y=10)
{
if(x%y==0) return ++x; else return y–;
} void main()

{
int p=20,q=23;
q=func(p,q);
cout<
p=func(q);
cout< q=func(p);
cout< }

Q 1 (f) Write a function seqsum( ) in C++ with two arguments, double x and int n. The function should return a value of type double and it should find the sum of the following series:

Image no.1

Q 2(a) Why is a destructor function required in classes? Illustrate with the help of an example.

Q 2(b) Define a class worker with the following specifications:

Private members of class worker

wno

integer

wname

25characters

hrwrk,wgrate

totwage

calcwg( )

Public members of the class worker

 

in_data( )

A function to accept values for wno, wname,hrwrk,wgrateand invoke calcwg(
) to calculate totpay.

out_data( )

A function to display all the data members on the screen.You should
give definitions of functions.

Q 2©Consider the following and answer the following questions given below:
class School
{
int A;
protected:
int B,C;
public:
void INPUT(int);
void OUTPUT( );
} ;
class Dept:protected School
{
int X,Y;
protected:
void IN(int, int);
public:
void OUT( );
};
class Teacher:public Dept
{
int P;
void DISPLAY(void);
public:
void ENTER( );
};

(i)Name the base class and derived class of the class Dept.
(ii) Name the data member(s) that can be accessed from function OUT( ).
(iii) Name the private member function(s) of class Teacher.
(iv) Is the member function OUT( ) accessible by the objects of Dept?

Q 3. (a)Suppose A, B, C are arrays of integers of size M, N and M+N respectively. The members in array A appear in ascending order while the members in array B appear in descending order. Write a user defined function in C++ to produce third array C by merging arrays A and B in ascending order. Use A, B and C as arguments in the function.

Q 3 (b) An array VAL[1……15][1……10] is stored in the memory with each element requiring 4 bytes of storage. If the base address of array VAL is 1500, determine the location of VAL[12][9] when the array VAL is stored (i) Row wise (ii) Column wise.

Q 3 © Write a user-defined function in C++ to find and display the sum of both the diagonal elements of a two dimensional array MATRIX[6][6] containing integers.

Q 3 (d) Evaluate the following postfix expression using a stack. Show the contents of stack after execution of each operation:
20, 8, 4, /, 2, 3, +, *, -
(e) Give necessary declaration for a queue containing float type numbers; also write a user defined function in C++ to insert a float type number in the queue. You should use linked representation of queue.

Q 4 (a)Name two member functions of ofstream class.

Q 4 (b) Assuming the class DRINKS defined below, write functions in C++ to perform the following:

(i)Write the objects of DRINKS to a binary file.
(ii) Read the objects of DRINKS from binary file and display them on screen when DNAME has value “INDY COLA".
class DRINKS
{
int DCODE;
char DNAME[13]; //Name of the drink
int DSIZE; //Size in liters float DPRICE;public:

void getdrinks( ) {cin>>DCODE>>DNAME>>DSIZE>>DPRICE;}
void showdrinks( )
{cout< char *getname( ){return DNAME;} };

Q 5. (a) What is the need for normalistion? Define third normal form.

Write SQL commands for (b) to (e) and write the outputs for (g) on the basis of table CLUB.

Table: CLUB

COACH_ID

COACHNAME

AGE

SPORTS

DATOFAPP

PAY

SEX

1

KUKERJA

35

KARATE

27/03/1996

1000

M

2

RAVINA

34

KARATE

20/01/1998

1200

F

3

KARAN

34

SQUASH

19/02/1998

2000

M

4

TARUN

33

BASKETBALL

01/01/1998

1500

M

5

ZUBIN

36

SWIMMING

12/01/1998

750

M

6

KETAKI

36

SWIMMING

24/02/1998

800

F

7

ANKITA

39

SQUASH

20/02/1998

2200

F

8

ZAREEN

37

KARATE

22/02/1998

1100

F

9

KUSH

41

SWIMMING

13/01/1998

900

M

10

SHAILYA

37

BASKETBALL

19/02/1998

1700

M

Q 5 (b) To show all the information about the swimming coaches in the club.

Q 5 ©To list names of all the coaches with their date of appointment (DATOFAPP) in descending order.

Q 5 (d) To isplay a report showing coachname, pay, age, and bonus (15% of pay) for all the coaches.

Q 5 (e) To insert a new row in the CLUB table with the following data: 11, “PRAKASH",37, “SQUASH",{25/02/1998},2500, “M”

Q 5 (f) Give the output of following SQL statements:

(i)Select COUNT (distinct SPORTS) from CLUB;
(ii) Select MIN(AGE) from CLUB where SEX="F";
(iii) Select AVG(PAY) from CLUB where SPORTS="KARATE";
(iv) Select SUM(PAY) from CLUB where DATOFAPP>(31/01/98);

Q 5 (g)Assume that there is one more table COACHES in the database as shown below:

Table: COACHES

SPORTS PERSON SEX COACH_NO
AJAY M 1
SEEMA F 2
VINOD M 1
TANEJA F 3

What will be the output of the following query: SELECT SPORTS PERSON, COACHNAME
FROM CLUB, COACHES
WHERE COACH_ID=COACH_NO;

Q 6. (a)State Absorption Laws. Verify one of the Absorption Laws using a truth table.

Q 6 (b) Prove X’.Y+Y’.Z=X’.Y.Z+X’.Y’.Z’+X.Y’.Z+X’.Y’.Z algebraically.

Q 6 © Obtain simplified form for a boolean expression
F(x,y,z,w)= å(1,3,4,5,7,9,11,12,13,15) using Karnaugh Map.

Q 6 (d) Draw the logic circuit for a half adder.

Q 6 (e) Represent the Boolean expression X’Y+Y’Z with the help of NAND gates only.

Q 6 (f) Write the Sum of Products form of the function G(U,V,W). Truth table representation of G is as follows:

U V W G
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1

Q 7 (a) What are Routers?

Q 7(b) What is the purpose of using a Modem?

Q 7 © Write two advantages and two disadvantages of Bus Topology in network.

Q 7 (d) What is the difference between LAN and WAN?

CBSE Computer Science Sample Question Paper - Year 1999

Computer Science Class XII (CBSE)
You are on questions

Q 1 (a) Why main function is so special. Give two reasons?

Q 1 (b) Name the header file of C++ to which following functions belong:
(i) strcat() (ii) scanf() (iii) getchar() (iv) clrscr()

Q 1 © Find the syntax error(s), if any, in the following program:
#include
main()
{
int x[5],*y,z[5];
for(i=0;i<5;i++)
{
x[i]=i;
z[i]=i+3;
y=z;
x=y;
}
}

Q 1 (d) Give the output of the following program.

#include
void main()
{
char *p="Difficult";
char c;
c=*p++;
printf("%c",c);
}

Q 1 (e) Write the output of the following program.

#include
static int i=100;
void abc()
{
static int i=8;
cout< <"first="< }
main()
{
static int i=2;
abc();
cout<<"second="< }

Q 1 (f) Write a C++ function that converts a 2-digit octal number into binary number and prints the binary equivalent.

Q 2 (a) What do you understand by visibility modes in class derivations? What are these modes?

Q 2 (b) Define a class Teacher with the following class specification:
private members:
name 20 characters
subject 10 characters
Basic, DA, HRA float
salary float
Calculate() function computes the salary and returns it.
salary is sum of Basic, DA and HRA
public members:
ReadData() function accepts the data values and invoke the calculate function.
DisplayData() function prints the data on the screen.

Q 2 © Consider the following declarations and answer the questions given below:
class vehicle
{
int wheels;
protected:
int passanger;
public:
void inputdata(int,int);
void outputdata();
};
class heavy_vehicle:protected vehicle
{
int diesel_petrol;
protected:
int load;
public:
void readdata(int,int);
void writedata();
};

class bus:private heavy_vehicle
{
char make[20];
public:
void fetchdata(char);
void displaydata();
};
(i) Name the base class and derived class of the class heavy_vehicle.
(ii) Name the data member(s) that can be accessed from function displaydata.
(iii) Name the data member(s) that can be accessed by an object of bus class.
(iv) Is the member function outputdata accessible to the objects of heavy_vehicle class?

Q 3 (a) Suppose a one dimensional array AR containing integers is arranged in ascending order. Write a user defined function in C++ to search for one integer from AR with the help of binary search method, returning an integer 0 to show absence ofthe number and integer 1 to show presence of the number in the array. The function should have three parameters: (1) an array AR (2) the number to be searched and (3) the number of elements N in the array.

Q 3 (b) An array A[10][20] is stored in the memory with each element requiring 2 bytes of storage. If the base address of array in the memory is 400, determine the location of A[8][13] when the array is stored as (1) Row major (2) Column major.

Q 3 © Write a user defined function in C++ to display the multiplication of row element of two dimensional array A[4][6] containing integer.

Q 3 (d) Evaluate the following postfix expression using a stack and show the contents of the stack after execution of each operation 5,11,-,6,8,+,12,*,/

Q 3 (e) Give the necessary declaration of a linked list implemented queue containing float type elements. Also write a user defined function in C++ to delete a float type number from the queue.

Q 4 (a) Differentiate between functions read() and write().

Q 4 (b) Assuming the class FLOPPYBOX, write a function in C++ to perform following:
(i) Write the objects of FLOPPYBOX to a binary file.
(ii) Reads the objects of FLOPPYBOX from binary file and display them on screen.

class FLOPPYBOX

{
int size;
char name[10];
public:
void getdata(){cin>>size;gets(name);}
void showdata(){cout< };

Q 5.(a) What is normalisation? Define second normal form.
Write SQL commands for (b) to (g) and write output for (h) on the basis of Teacher relation given below:

Relation : Teacher

No. Name Age Department Date of join Salary Sex
1 Jugal 24 Computer 10/01/97 12,000 M
2 Shamila 21 History 24/03/98 20,000 F
3 Sandeep 22 Maths 12/12/96 30,000 M
4 Sangeeta 25 History 01/07/97 40,000 F
5 Rakesh 22 Maths 05/09/97 25,000 M
6 Shyam 30 History 27/06/98 30,000 M
7 Shiv Om 34 Computer 25/02/97 21,000 F
8 shalakha 23 Maths 31/07/97 20,000 F

Q 5 (b) To show all information about the teacher of History department.

Q 5 © To list names of female teachers who are in Hindi department.

Q 5 (d) To list names of all teachers with their date of joining in ascending order.

Q 5(e) To display student’s Name, Fee, Age, for male teachers only.

Q 5 (f) To count the number of teachers with age>23.

Q 5 (g) To insert a new row in the TEACHER table with the following data: 9, “Raja", 26, “Computer", {13/05/95}, 2300, “M”

Q 5 (h) Give the output of following SQL statements:
(i) Select COUNT(distinct department) from TEACHER;
(ii) Select MAX(Age) from TEACHER where Sex="F";
(iii) Select AVG(Fee) from TEACHER where Dateofjoin< {12/07/96};
(iv) Select SUM(Fee) from TEACHER where Dateofjoin< {12/07/96};

Q 6.(a) State the distributive law. Verify the law using truth table.

Q 6 (b) Prove x+x’y=x+y algebraically.

Q 6 © Write the dual of the Boolean expression (x+y).(x’+y’)

Q 6 (d) Minimise F(w,x,y,z) using Karnaugh map.
F ( w,x,y,z) = S (0,4,8,12)

Q 6 (e) Draw the logic circuit for a half-adder.

Q 6 (f) Represent the Boolean expression (x+y)(y+z)(z+x) with the help of NOR gates only.

Q 6 (g) Write sum of product form of the function F(x,y,z). The truth table representation for the function F is given below:

x
0
0
0
0
1
1
1
1
y
0
0
1
1
0
0
1
1
z
0
1
0
1
0
1
0
1
f
0
1
0
0
1
0
1
1

Q 7 (a) What is a bridge?

Q 7(b) What is the purpose of using FTP?

Q 7 © Give two advantages and disadvantages of following network topologies:
(i) Bus (ii) Tree

Q 7 (d) What is the difference between WAN and MAN.

CBSE Computer Science Sample Question Paper - Year 1998

Computer Science Class XII (CBSE)
You are on questions

Q no. 1 (a) Define the following terms: (i) Inheritance (ii) Encapsulation.

Q no. 1 (b) Name the header files, to which the following built-in-functions belong to:
(i) cos() (ii) setw() (iii) toupper() (iv) strcpy()

Q no. 1 © Find the syntax error(s), if any, in the following program:
include
void main( )
{
int R;W=90;
while W>60
{
R=W-50;
switch(W)
{
20: cout< <"Lower Range"< 30: cout<<"Middle Range"< 40: cout<<"Higher Range"< }
}
}

Q no. 1 (d) Give the output of the following program segment:
char *NAME="IntRAneT";
for(int x=0;x if(islower(NAME[x]) )
NAME [ x] = toupper ( NAME [x]);
else
if(isupper(NAME [x] ) )
if( x%2==0)
NAME [x] = tolower ( NAME [x] );
else
Name [x] = NAME [ x - 1 ];
puts(NAME);

Q no. 1 (e) Write the output of the following program:
#include
void Execute(int &X, int Y=200)
{
int TEMP=X+Y;
X+=TEMP;
if (Y!=200)
cout< }

void main ( )
{
int A=50, B=20;
Execute (B);
cout<< A< Execute( A, B);
cout < }

Q no. 1 ( f ) Write a C++ function having two value parameters X and N with result type float to find the sum of series given
below:

Image no.1

Q no. 2 (a) What is a copy constructor? What do you understand by constructor overloading?

Q no. 2 (b) Define a class student with the following specifications:

admno
sname
eng, math, science
total
ctotal()

integer
20 character
float
float
A function to calculate eng+math+science with float return type

public member functions of class student

Takedata()

Showdata()

function to accept values for admno, sname, eng, math, science and
invoke ctotal to calculate total.

function to display all the data members on the screen

Q no. 2 © Consider the following declarations and answer the questions given below:
class PPP
{

int H;
protected:
int S;

public:
void INPUT(int);
void OUT( );
};

class QQQ: private PPP
{
int T;
protected:
int U;
public: void INDATA(int, int);
void OUTDATA();
};
class RRR: public QQQ
{
int M;
public:
void DISP(void);
};

(i) Name the base class and derived class of the class QQQ.
(ii) Name the data member(s) that can be accessed from function DISP().
(iii) Name the member function(s), which can be accessed from the objects of class RRR.
(iv) Is the member function OUT() accessible by the objects of the class QQQ?

Q no. 3 (a) Suppose an array P containing float is arranged in ascending order. Write a user defined function in C++ to search for one float from P with the help of binary search method. The function should return an integer 0 to show absence of the number and integer 1 to show presence of the number in the array. The function should have the parameters as (1) an array P (2) the number DATA to be searched (3) number of elements N.

Q no. 3 (b) An array T[15][10] is stored in the memory with each element requiring 2 bytes of storage. If the base address of T is 2000, determine the location of T[7][8] when the array is stored by (i) Row major (ii) Column major.

Q no. 3 © Write a user defined function in C++ to display the sum of column elements of a two dimensional array R[7][7] containing integers.

Q no. 3 (d) Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation: 50, 40, +, 18, 14, -, 4, *, +

Q no. 3 (e) Give the necessary declaration of a linked implemented stack containing integer type numbers; also write a user defined function in C++ to pop a number from this stack.

Q no. 4 (a) Write name of two member functions belonging to fstream class.

Q no. 4 (b) Assuming the class EMPLOYEE given below, write functions in C++ to perform the following:
(i) Write the objects of EMPLOYEE to a binary file.
(ii) Read the objects of EMPLOYEE from binary file and display them on the screen.
class EMPLOYEE
{
int ENO;
char ENAME[10];
public:
void GETIT( )
{
cin>>ENO;
gets(ENAME);
}
void SHOWIT( )
{
cout< < ENO< }
};

Q No.5 (a) What is a relation? What is the difference between a tuple and an attribute?
NOTE: Write SQL commands for (b) to (g) and write the outputs for (h) on the basis of table HOSPITAL

No. Name Age Department DatoFadm Charges Sex
1 Arpit 62 Surgery 21/01/98 300 M
2 Zareena 22 ENT 12/12/97 250 F
3 Kareem 32 Orthopedic 19/02/98 200 M
4 Arun 12 Surgery 11/01/98 300 M
5 Zubin 30 ENT 12/01/98 250 M
6 Ketaki 16 ENT 24/02/98 250 F
7 Ankita 29 Cardiology 20/02/98 800 F
8 Zareen 45 Gynecology 22/02/98 300 F
9 Kush 19 Cardiology 13/01/98 800 M
10 Shilpa 23 Nuclear Medicine 21/02/98 400 F

(b) To select all the information of patients of cardiology department.
© To list the names of female patients who are in ENT department.
(d) To list names of all patients with their date of admission in ascending order.
(e) To display Patient’s Nae, Charges, Age for only female patients.
(f) To count the number of patients with Age<30.
(g) To insert a new row in the HOSPITAL table with the following data: 11, “Aftab", 24, “Surgery", {25/02/98}, 300, “M”
(h) Give the output of the following SQL statements:
(i) Select COUNT(DISTINCT charges) from HOSPITAL;
(ii) Select MIN(Age) from HOSPITAL where Sex="F";
(iii) Select SUM(Charges) from HOSPITAL where Department="ENT";
(iv) Select AVG(Charges) from HOSPITAL where Datofadm< {12/02/98};

Q no. 6 (a) State Demorgan’s laws. Verify one of the Demorgan’s laws using truth tables.

Q no. 6 (b) Prove X+Y’Z=(X+Y’+Z’)(X+Y’+Z)(X+Y+Z) algerbraically.

Q no. 6 © Write the dual of the Boolean expression (U+W)(V’U+W)

Q no. 6 (d) Obtain a simplified form for a Boolean expression:F( U, V, W,Z) = S ( 0,1,3,5,7,9,10,11,12,13,14,15)

Q no. 6 (e) Draw the logic circuit for a half-adder.

Q no. 6 (f) Represent the Boolean expression X+Y.Z’ with the help of NOR gates only.

Q no. 6 (g) Write the Product of Sum form of the function H(U,V,W), truth table representation of H is as follows:

U V W H
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1

Q No. 7 (a) What are repeaters?

Q no. 7 (b) What is the difference between LAN and MAN?

Q no. 7 © Describe the following in brief: (i) MOSAIC (ii) Usenet

Q no. 7 (d) What do you understand by a backbone network?