Guess Paper Computer Science (Set-2)

  CBSE You are here

COMPUTER SCIENCE (THEORY)

CLASS – XII

TIME: 3 HOURS MAX MARKS: 70

General instructions:- (i)All questions are compulsory (ii) Programming language: C++

  1. (a) Name the Header file to which the following belong: (1)

i) atoi() ii) strcat()

(b) Illustrate the use of inline function in C++ with the help of an example. (2)

(c) Correct the errors in the program given below. Rewrite the program after removing syntactical errors and underline it. (2)

# include <iostream.h>

void main()

{

struct STUDENT

{

char stu_name[20];

char stu_grade;

int stu_age=17;

int marks

} stud;

gets(stu_name);

gets(stu_grade);

cin>>marks;

}

(d) Give the output of the following program segment (Assume all required header files are included in the program); (2)

char *s = “GOODLUCK”;

for(int x=strlen(s-1) ; x >=0 ; x --)

{

for( int y = 0 ; y < x ; y++)

{

cout<< s [y];

}

cout<<endl;

}

(e) Rewrite the following program after removing the syntactical errors(if any); (3)

Underline each correction.

# include<iostream.h>

CLASS STUDENT

{

int admno;

float marks;

public:

STUDENT() { admno=0; marks=0.0; }

void input() { cin>>admno>>marks; }

void output() { cout<<admno<<marks; }

} }

void main()

{

STUDENT S;

Input(S);

}

  1. (a) Define Multilevel and Multiple Inheritance in context of Object Oriented Programming. Give suitable example to illustrate the same. (2)

(b) What do you mean by data encapsulation? How is it implemented? (2)

(c) Answer the questions (i) and (ii) after going through the following class: (2)

class Interview

{

int month;

public:

Interview(int y)

{

month=y;

} };

    1. In the class Interview the member function Interview is known as.

    2. Create an object, such that it invoke the member function Interview.

(d) Define a class Travel in C++ with the following description: (4)

Private members:

TravelCode of type integer

Place of type character array

NoofTravellers of type integer

Noofbuses of type integer

Public members:

A function NewTravel() which allows user to input TravelCode, Place, NoofTravellers and assigns the value of Noofbuses as per the following conditions:

NoofTravellers

Noofbuses

Less than 20

01

More than 20

02

A function ShowTravel() to display the content from all the data members on screen.

(e) Answer the question (i) to (iv) based on the following code: (4)

Class Medicines

{

char Category[10];

char Dateofmanufacture[10];

char Company[20];

public:

Medicines();

void entermedicinedetails();

void showmedicinedetails();

} ;

class Capsules : public Medicines

{

protected:

char capsulename[30];

char volumelabel[20];

public:

float Price;

Capsules();

void entercapsuledetails();

void showcapsuledetails();

} ;

class Antibiotics : public Capsules

{

int Dosageunits;

char sideeffects[20];

int Usewithindays;

public:

Antibiotics();

void enterdetails();

void showdetails();

} ;

  1. How many bytes will be required by an object of class Medicines and an object of class Antibiotics respectively?

  2. Write names of all the member functions accessible from the object of class Antibiotics.

  3. Write names of all the members accessible from member functions of class Capsules.

  4. Write names of all the data members which are accessible from objects of class Antibiotics.

  1. (a) Consider the following class declaration: (4)

class student

{

int roll;

char name[20];

float mark;

public:

void getdata()

{

cin>>roll>>name>>mark;

}

void displaydata()

{

cout<<roll<<name<<mark;

}

float returnmark()

{

return(mark);

} };

Give function definitions to perform the following;

    1. Write the objects of student to a binary file “STDNT.DAT”.

    2. Read the objects of student from a binary file “STDNT.DAT” and display all the objects on the screen in which marks are more than 75.

(b) Write a C++ program, which reads one line at a time from the text file TEST.TXT and displays it to a monitor. Your program has to read all the contents of the file. Assume the length of the line not to exceed 80 characters. You have to include all the header files if required. (2)

  1. (a) Let A[N X M] be a two dimensional array. Write a function in C++ to find the sum of all the positive elements. For example, for the matrix shown below, your function should output 31 = (4 + 5 + 12 + 3 + 7). (2)

(b) An array MAT[20][10] is stored in the memory along the row with each element occupying 4 bytes of memory. Find out the base address and the address of element MAT[10][5], if the location of MAT[3][7]is stored at the address 1000. (4)

(c) The number (80, 20, 31, 56, 20, 64, 48) are required to be sorted using insertion sort showing , how the list would appear at the end of each pass. (2)

(d) Evaluate the following postfix notation of expression showing the status of stack at every step: 20 10 + 5 2 * + 10 * (2)

(e) Convert the following infix expression into its equivalent postfix expression using stack and show the status of stack after each step: (4)

A + B * C + D * N ^ E / G – H

(f) What is priority queue? (1)

(g) What is the drawback of linear queue? (1)

  1. Write SQL commands for (a) to (f) and write the output of the (g) on the basis of the table SUPPLIER.

S#

PName

SName

Qty

Price

City

S1

Bread Britannia

150

8.00

Delhi

S2

Cake Britannia

250

20.00

Mumbai

S3

Coffee Nescafe

170

45.00

Mumbai

S4

Chocolate Amul

380

10.00

Delhi

S5

Sauce Kissan

470

36.00

Jaipur

S6

Maggi Nestle

340

10.00

Kolkata

S7

Biscuit Marie

560

21.00

Chennai

S8

Jam Kissan

220

40.00

Delhi

S9

Pizza

345

5.00

Kolkata
      1. Display data for all products whose quantity is between 170 and 370. (1 x 6 = 6)

      2. Display data for all products sorted by their quantity.

      3. Find all the products that have no supplier.

      4. Give SName for that entire product whose name starts with “C”.

      5. To list SName, PName, Price for all the products whose quantity is <200.

      6. To display S#, PName, SName, Qty in reverse order of qty from the SUPPLIER table.

      7. Give the output of the following SQL commands: ( ½ x 4 = 2)

        1. Select AVG(Price) from SUPPLIER where Price < 30;

        2. Select MAX(Price) from SUPPLIER where Price > 30;

        3. Select SUM(Price * Qty) from SUPPLIER where Qty < 10;

        4. Select COUNT(DISTINCT City) from SUPPLIER;

  1. (a) State and verity DeMorgan’s law algebraically. (3)

(b) Represent the Boolean expression x.y’ + y.z’ with the help of NAND gates only. (1)

(c) Obtain simplified form for following Boolean expression using K-Map. (3)

F(w, x, y, z) = ?? (1, 3, 4, 5, 7, 9, 11, 12, 13, 15)

(d) Write the POS form of a Boolean function F(u, v, w) which is represented in a truth table

as follows: (1)

U

V

W

F

0

0

0

0

0

0

1

0

0

1

0

1

0

1

1

0

1

0

0

1

1

0

1

0

1

1

0

1

1

1

1

1

  1. (a) Name any two transmission media for networking. (1)

(b) Expand the following: ( ½ x 4=2)

    1. CDMA

    2. XML

    3. ARPANET

    4. GSM

(c) What is WWW? (1)

(d) Jawahar Navodaya Vidyalaya in Sambalpur is setting up the network in the campus. There are 4 buildings named as School Building, Shivalik, Aravali, Nilgiri. (4)

Distance between various buildings are as given:

School building to Shivalik 100 m
School building to Nilgiri 200m
School building to Aravali 400 m
Shivalik to Nilgiri 300 m
Shivalik to Aravali 100 m
Nilgiri to Aravali 450 m

Number of Computers in the buildings:

School Building 40
Shivalik 10
Nilgiri 08
Aravali 12

  1. Suggest a cable layout of connections between the blocks and topology.

  2. Suggest the most suitable building to place the server a suitable reason.

  3. Suggest the placement of Hub / Switch in the network.

  4. Name the building to place the modem so that all the building can share internet connection.



  « Guess Paper Computer Science (Set-1) Sample Paper MS 01 Management Functions and Behaviour – 1 »  

  Posted on Thursday, December 25th, 2008 at 11:10 PM under   CBSE | RSS 2.0 Feed