Вы находитесь на странице: 1из 8

Roll No.

I Code No. 1207

Second Pre-Board Examination January-2009


Time: 3 Hours
General Instructions (i) (ii) Q.l :-

Class - XII Sub. : Computer Science

M.M. 70

A!1 questions are compulsory Programming language: C++

(a) _PolYplophism is one of the major properties of OOP. How it is implemented in C++?
(b)

2 1

Name the header files that shall be needed for the following code: void mainO char a[20]; gets(a); coutsetw(30)a; getch();

(c)

Rewrite the following program afterremoving the syntactical(s) if any. Underline each correction.

$ include <stream.h>
voidmainO
{

chara[20]; Gets(a); ifstream file("ram.txt'); file>a; close.fileO;

(d)

Find the output ofthe following program: #include <iostream.h> int &exam( int &x, int &y) if(x>y) retumy;

Class - XII - Sub. : Computer Science (2) else return x;


voidmainO int a=20, b=30; exam( a,b)= -1;

cout cout

"A = "a

" B ="Bendl; " B ="b--endl; B ="bendl;

exam(b,a)=7;

"A = "a++

exam(a,b)=3; cout "A = "a" (e)

Find the output of the following program: #indude <iostream.h>


c1assexam

public:
examO;

-examO;
void getdata(); void putdataO;
};

exam: :examO
{

cout"Function
}

1H;

exam::~examO cout"function
void mainO

2";

examel,e2; cout" Object crea"; exame3; cout" 1 END";

Class - XII - Sub. : Computer Science (3)


( JC'\.

I.'

In the following program, find the correct possible output(s) from the options: #include <stdlib.h> #include <iostream.h> void main()
{

randomize( ); char exam [] [10]= { "PRE 1", "PRE II", PRE III", "MAIN"}; . , int f; fore int 1=2; 1>0; --I)
{

f == random(2) + I; coutexam[f]" : ";


}

Outputs:j) PRE ii) PRE iij) PRE iv) PRE Q.2 (a) (b)

I : PRE II : PRE III : II: PRE III: PRE II: II: PRE III: MAIN: III: PRE II : PRE II :

Differentiate Multiple and multilevel inheritance in context of OOP using a suitable example illustrating each. Answer the questions (i) and (ii) after going through the following program: class match int time; public: match( int y) { time = t; } II constructor 1 match( match & t); II constructor 2 i) create an object such that it invokes constructor 1 ii) Write complete definition of constructor 2

2 2

(c)

Define a class Teacher with the following class specification: private members: name 20 characters subject 10 characters Basic, DA, HRA float salary float CalculateO function computes the salary and returns it. salary is sum of Basic, DA and HRA

Class - XII - Sub. : Computer Science (4) public members: ReadDataO function accepts the data values and invoke the calculate function. DisplayDataO function prints the data on the screen. (d) Consider the following declarations and answer the questions given below: class vehicle 4

int wheels; protected: int passanger; public: void inputdata(int,int); void outputdataO;
};

class heavy _ vehicle:protected vehicle


{

int diesel_petrol; protected: int load; public: void rcaddata(int,int); void writedataO;
};

class bus: private heavy_vehicle


{

charmake[20]; public:"void fetchdata(char); void displaydataO;


};

(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 display'data. (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? .

Class - XII - Sub. : Computer Science (5) Q.3 (a) Write a function in C++, which accepts an integer array and its size as parameters and swap the first half of the array with second half. Example: if an array on six elements initially contains the elements as 4, 6, 9, 1, 3, 7 then the function should rearrange the elements as 1,3,7,4,6,9. (b) An array arr[35][15] is stored in the memory along the row with each element occupying 4 bytes. Find out the base address and the address of an element arr[20] [15], if the location arr[2] [2] is stored at the address 3000. Write a function in C++ to insert an element into a dynamically allocated stack where each node contains a name as data. Assume the following definition of stack for the same. ' struct stack char ename[20]; stack* link;
};

(c)

(d)

Write a function in C++ to print the product of each row of a 2D integer array passed as the argument of the function.
2

Example: IiI 2DI Then the output should appear as: Product of Row 1: 8 Product of Row 2: 18 Product of Row 3: 24 (e)

~rrontr~ I

Evaluate the following postfix expression using a stack and show the contents of the stack after execution of each operation 2

5,11,j,8,+, 12,*,/
Q.4 (~) (b) Differentiate seekg( ) function and tellg( ) function. Write a function in C++ to print the number of lines in a text file Exam.dat, starting with letter'S'.
-~,
~,

'i .~

~.

Class - XII - Sub. : Computer Science (6)

(c)

Given a binary file student.dut containing records of the following structure

~~
struct student char sname[20]; int roll; char dassname[ 5];
};

Write a function in C++ that would read content from the file student.dat and create a file c1ass.dat copying only those records from student.dat where the c1assname is either IX, X or XI. Q.5 (a)
~

Differentiate between cardinality and Degree of a table. Consider the following tables. \Vrite SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii) TABLE: ITElVI ITEMNO ITEMNAME RA.M3450 FLOPPY HDISK00 25 2 ITEMPRICE 2350 3500 1500 ITEMQTY

(b)

TABLE: BILLNO 1101 52 1103 45 RAM CUST_CITY 60 ITEMNO JAIPUR 1102 46 23 PARUL MUKESH RAMESH SHIVBARODA SHIV KANPUR SIKAR 34 CUST_NAME PURQTY

BILL

(i) (ii)

To display the name of all customers from BARODA. To display the itemname, itemqty from table item and purqty, cusCname from table BILL, with their corresponding matching itemno.

(iii) To display the details of all items whose itemprice is in range of 2000 and 3000. (iv) To increase the itemprice by 20% of all items. (v) SELECT DISTINCT CITY FROM BILL;

Class - XII - Sub. : Computer Science (7) (vi) SELECT COUNT(*), SUM(PURQTY) FROM BILL GROUP BY CUST _CITY; \VHERE .(vii) SELECT ITE!\1NAME, ITENIQTY, lTEMPRICE*4 FROlVl ITEM; (viii) SELECTITEMQTY,CUST~~ftJvlEFROMITEM,BILL
ITEM.ITEIV1NO

= BILL.ITEr'v1L~O.;
law in Boolean algebra.

Q.6

(a)

State and verify Distributive

(b)

Drm\! a logical circuit diagram for the following Boolean expression

a. ( b' + c')
(c) Convert the following expression into its equivalent Canonical product form(SOP) sum of 2 3

(A'+B+C')(A'+B+C)(A'
(d)
e) d)

+B' +C')

Reduce the following Boolean expression using K-Map F(x,y.z.w) ~(1,2,4,5,6,12,13) Define the term Bandwidth. Give unit of Bandwidth. Expand the following terminologies:

b)

Q.7

a) c)

1 1 1

(i)

HTh1L

(i

i)

XlViL

Define the term ficcwalL What is the importance of URL in networking?

r--'-- ---' --.


I I
I

Exam lndustries has set up its new center at Kaka Nagar for its office and web based activities. The company compound has 4 buildings as shown in the diagram below:

~~

?'.
/~~

'~
i

(Raj i1 II ~Uildin~J
II

~i!d~ II ~ Fazz

1L1~I~ .
Ii BU~~i~

If'" Jazz

...

~~

'"

I, Building '

I
I

Center to center distances between various buildings is as follows:

I
I

Harsh -Building'-'. to Raj' Building'0 , Raz Building to Fazz Building

,I

SOm

l
I I

I I

+'

60m

Fazz Buildi:g to Jazz Bui!din~

25m

_ Ha!sh Buil~ing Harsh Building ~! JazzBuilding to to ~'azzBlllidifig Building to Raj Jazz Building I
L--~ ~

I 125m ~ I 190m __ '=_~. ~. ,~ I .:.........L_"' ... ,~.

--~l

Class - XII - Sub. : Computer Science (8)

Number of Computers in each of the buildings is follows: 25 15 150 Harsh Building

ding lding

e 1) e2)

Suggest a cable layout of connections between the buildings. Suggest the most suitable place (i.e. building) to house the server of this or2:anisation with a suitable reason. u Suggest the placement of the following devices with justification: (i) Internet Connecting Device/Modem Oi) Switch

1
1

e3)

e4)

The organisation is planning to link its sale counter situated in various parts of the same city, which type of network out of LAN, MAN or WAN will be formed? Justify your answer. ,"

( I

V
c.
'.

KVS(AR)

Вам также может понравиться