Sei sulla pagina 1di 12

r---

-"" !':,c'

Downloaded From: http://www.cbseportal.com


I

Series 50S
I I

Code
I I I I I I

No.

91.

Roll

No.

Candidates must write the Code on the title page of the answer-book.

. .
.
. .

Please check that this question paper contains 12 printed pages.


Code number given on the right hand side of the question paper should be written on the title page of the answer-book by the candidate.

Please check that this question paper contains 7 questions.


Please write down

the

Serial

Number

of

the

question

before

attempting

it.

15 minutes time has been allotted to read this question paper. The question paper will be distributed at 10.15 a.m. From 10.15 a.m. to 10.30 a.m., the students will read the question paper only and will not write any answer on the answer script during this period.

COMPUTER

SCIENCE

Time

allowed:

hours

Maximum

Marks:

70

Instructions:

(i)
(ii)

All
Programming

questions

are compuls9ry.
Language: C++

1.

(a) (b)

What
conversion?

is the difference
Also, give

between
a suitable

Type
C++

Casting
code to

and Automatic
illustrate both.

Type
2

Write
required

the
to

names
run/execute

of

the
the

header
following

files,
C++

which
code:

is/are

essentially
1

void
{

main()

char
for i.f

CH,Text[]="+ve (int (Text 1=O;Text[1] [I] ==' ')

Attitude"; !='\O';1++)

coutendl;

else
{

CH=toupper(Text[1]);

coutCH; } }
91

Downloaded From:1 http://www.cbseportal.com

P.T.D.

:..,~-~-"'_.~~"

-~~

Downloaded From: http://www.cbseportal.com


(c) Rewrite the following program after removing the syntactical

errors (if any). Underline each correction.


include <iostream.h>

typedef

char[80]

Stringi

void

main()

String

S="Peace"

:::'

int

L=strlen

(S)

coutS'

has

'L'

characters'endli

(d)

Find

the

output

of

the

following

program:

#include void

<iostream.h> SwitchOver(int

A[],

Oint

N,

int

Split)

{
for (int K=OiK<NiK++) 1 if (K<Split) 1

1 j

[K]

+=1<i

.j

.1

else

*=K.

, A

void

Display(int

A[.],int

N)

{
for (int K=OiK<NiK++)

(K%2=:==O) ?coutA [K]


}

"%":

coutA [K].

endl

void

main()

:.

int

H[]={30,40,SO,20,lO,.S}i

SwitchOver(H,6,3)i

Display(H,6)i }

91

Downloaded From: http://www.cbseportal.com

--

,,--~

--

Downloaded From: http://www.cbseportal.com


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

#include void { int main()

<iostream.h>

*Queen,Moves[]={11,22,33,44};

Queen=Moves;

Moves[2]+=22;
cout"Queen *Queen-=11; Queen+=2;
cout"Now @"*Queenendl;

@"*Queenendl;

Queen++; cout"Finally cout"New }


(f) Go through the C++ code shown below, and find out the possible

@"*Queenendl; Origin @"Moves [0] endl;

output

or

outputs

from

the

suggested

Output

Options

(i)

to

(iv).

Also,

write

the

minimum

and

maximum

values,

which

can

be

assigned

to

the

variable

MyNum.

#include

<iostream.h>

#include void
{

<stdlib.h> main()

randomize();

int

MyNum,Max=5;

.MyNum=20+random(Max);

t
}

for

(int
coutN"*"i

N=MyNum;N<=25iN++)

(i)
-I
'"

2 0 * 21 * 2 2 * 2 3 * 2 4 * 2 5

" i

(ii) (III ) ... (iv) 91

22 * 2 3 * 2 4 * 2 5 * 23 * 24 * 21*22*23*24*25

'",

Downloaded From: http://www.cbseportal.com


3
p.T.a.

Downloaded From: http://www.cbseportal.com


2.
(a)
(b)

and Destructor
mming.

fun

c++ code. Also, write amming used in the functions [I] to [IV] :
*include void { for (int L=1;L<=80;L++) cout"-"; Line() <iostream.h> //Function

coutendl; }
void Line(int N) //Function [II]

{ for (int

L=l;L<=N;L++)

cout"*";

coutendl; } void { for (int L=l;L<=N;L++) coutC; coutendl; }


void Line(int M,int N) //Function [IV]

Line(char

C,int

N)

//Function

[III]

for

(int

L=l;L<=N;L++)coutM*L;

coutendl;
} ., . . ~;t:~

vold

maln

'.~,~:;;,,;

{"I

lnt

A=9, B=4, C=3;

~~j. 'c'
,

. -

char K='#';-'
Line (K, B) ;

Line
}

(A, C) ;

91

Downloaded From: http://www.cbseportal.com


~ 4

..

Downloaded From: http://www.cbseportal.com


(c) Define a class Applicant
Private Members

in C++ with following

description:

data

member

ANo

(Admission

Number)

of

type

long

data

member

Name

of

type

string

data

member

Agg

(Aggregate

Marks)

of

type

'float

data

member

Grade

of

type

char

member

function

GradeMe()

to

find

the

Grade

as

per

the

Ii

Aggregate
Aggregate Marks

Marks
range

obtained
and the

by
respective

student.
Grades

Equivalent
are shown

as

follows:

Aggregate

Marks

Grade

>=80

less

than

80

and

>=65

less

than

65

and

>=50

less

than

50

Public
. A

Members
function ENTER() to allow user to enter values for ANo, .

Name,

Agg

&

call

function

GradeMe()

to

find

the

Grade.

function

RESULTO

to

allow

user

to

view

the

content

of

all

the

data

members.

..
I

(d)

Answer

the questions

(i) to (iv) based 'on the following:

class
{

Student

int

Rollno;

char

SName[20];

float
protected:

Marksl

void

Result();

public:

Student();
f
void Enroll();void Display();

I'

class

Teacher

Downloaded From: http://www.cbseportal.com


! 91 5 P.T.O. I ,

--:-J'-

Downloaded From: http://www.cbseportal.com


r

{ long
char
protected:

TCode;
I

TName[20];

float

Salary;

public:

Teacher();

':.:

void
void } ; class

Enter
Show();

() ;

Course:

public

Student,

private

Teacher

{
long char public: Course(); CCode[lO];char StartDate[8],EndDate[8]; CourseName[50];

void
void }; (i)

Commence();

CDetail();

Write
from objects

the names
of class

of member
Course.

functions,

which

are accessible

(ii)

Write
accessible

the

names
from member

of all

the
function

data

members,
Commence

which
of

is/are
class

Course.

(iii)

Write from

the

names

of all .the members,

which

are accessible

objects

of class Teacher.

(iv)

Which type of Inheritance is illustrated code?

in the above C++

Downloaded From: http://www.cbseportal.com


91 6

Downloaded From: http://www.cbseportal.com


I

3.
.

(a)

Write

Get2From1()

function

in

C++

to

transfer

the

content

from

one
I Odd[]

array
array

ALL[]
should ) of ALL[]

to

two

different

arrays

Odd[]

and

Even[].

The

contain

the

values

from

odd

positions

(1,3,5,

and

Even[]

array

should

cont'ain

the

values

from

even

positions

(0,2,4,

) of ALL[].

Example:
If the ALL[] array contains

12,34,56,67,89,90
,

The

Odd[]

array

should

contain

34,67,90

And

the

Even[]

array

should

contain

12,56,89

(b)

An

array

G[50][20]

is

stored

in

the

memory

along

the

row

with

each

G[10][15], stored ifG[O][O]at is


of its elements occupying 8 bytes. 4200. a function in C++ to perform allocated Queue containing Members the following definition of NODE:

Find

out

the

location

of

(c)

Write

Delete

operation

on

dynamically

details

as

given

in

~truct

NODE

long

Mno;

//Member

Number

char

Mname[20];

//Member

Name

NODE

*Link;

i,

(d)

Write

DSUM()

function

in

C++

to.

find

sum

of

Diagonal

Elements

from

NxN

Matrix.

(Assuming

that

the

is

odd

number)

(e)

Evaluate

the

following

postfix

notation

of

expression:

True,

False,

NOT,

AND,

True,

True,

AND,

OR

Downloaded From: http://www.cbseportal.com


91 7 P.T.D.

-I

11'1111111 Downloaded From: http://www.cbseportal.com


w:,c~

,.p:

-given 1 and

c:::~;

"",

4.

(a)

Observe

the

program

segment

below

carefully

and

fill

the

blanks

marked

as

Statement

Statement

using

seekg(),

seekp(),

tellp()

and

tellg()

functions

for

performing

the

required

task.

#include

<fstream.h>

class
. {

ITEM

int

Ino;char

Iname[20];float

Price;

public:

void

ModifyPrice();//The

function

is

to

modify

price

of

particular

ITEM

;
Item::ModifyPrice()

void

fstream

File;

File.

open

("ITEM.

DAT",

ios:

binary

ios:

in

ios:

out)

int

CIno;

cout"Item

No

to

modify

price:

";

cinCIno;

while

(File.read((char*)this,sizeof(ITEM)

if

(CIno==Ino)

"c"~~'""

c"""

cout"Present

Price:

"Priceendl;

r-

2~"'~""

".

:1

:!

'!c;i;

;",.1

cout"Changed

Prlce:";clnPrlce;

int

FilePos=

//Statement

/IStatement \

File.write((char*)this, liRe-writing }

sizeof(ITEM); the recQrd

File.close();

Downloaded From: http://www.cbseportal.com


,,'i'j' .,. ":. 91 8 i

ii:};;:'

;;j

L':I

"-

--

--

-~

~~

c~

Downloaded From: http://www.cbseportal.com


(b) Write a function in C++ to count the no. of "He" or "She" words'

present
If the file

in
"STORY.

a text

file
TXT"

"STORY.
content

TXT".
is as follows: 2

He

is

playing

in

the

ground.

She

is

playing

with

her

dolls.

The

output

of

the

function

should

be

Count

of

He/She

in

file:

(c)

Write

function

in

C++

to

search

for

camera

from

binary

file

"CAMERA.DAT"

containing

the

objects

of

class

CAMERA

(as

defined

below).

The

user

should

enter

the

Model

No

and

the

function

should

search

and

display

the

details

of

the

camera.

class
{

CAMERA
ModelNo;
MegaPixel; ,; ;

long
float

int
char
public:

Zoom;
Details[120];

void

Enter()

{cinModelNoMegaPixelZoom;

gets(Details);}

void

Display()

{coutModelNoMegaPixelZoom

Detailsend1;]

long
} ;

GetModelNo()

{return

ModelNo;}

5.

(a)

What

do

you

understand

by

Selection

&

Projection

operations

in

relational
Consider the

algebra?
following tables EMPLOYEE and SALGRADE and

answer

(b)

and

(c)

parts

of

this

question:

Table:

EMPLOYEE

ECODE

NAME

DESIG

SGRADE

DOJ

DOB

101

Abdul

Ahmad

EXECUTIVE

S03

23-Mar-2003

13-Jan-1980

102

Ravi

Chancier

HEAD-IT

S02

12-Feb-2010

22-Jul-1987

103
105

John
Nazar

Ken
Ameen

RECEPTIONIST
GM

S03
S02

24-Jun-2009
11-Aug-2006

24-Feb-1983
03-Mar-1984

108

Priyam

Sen

CEO

SOl

29-Dec-2004

19-Jan-1982

Downloaded From: http://www.cbseportal.com


91 9 P.T.D.

. Downloaded From: http://www.cbseportal.com


Table: SALGRADE

, "" ;c,,'

SGRADE

SALARY

HRA

SOl

56000

18000

32000 24000
.

12000 8000
the following statements:
EMPLOYEEs in descending

(b)

Write (i)

SQL

commands

for

To
order

display
of
display

the
DOJ.
NAME

details

of

all

(ii)

To

and

DESIG

of

those

EMPLOYEEs,

whose

SALGRADE

is

either

S02

or

S03.

(iii)

To
DOJ

display
is in

the content of
between '09-Feb-2006' a new row with the

all

the

EMPLOYEEs

table,

whose

and

'08-Aug-2009'.

(iv)

To

add

following:

109,

'Harish

Roy','HEAD-IT','S02','09-Sep-20b7','21-Apr-1983'

(c)

Give

the

output

of

the

following

SQL

queries:

(i)

SELECT

COUNT(SGRADE),SGRADE

FROM

EMPLOYEE

GROUP

BY

SGRADE;

(ii)

SELECT

MIN(DOB),MAX(DOJ)

FROM

EMPLOYEE;

(iii)

SELECT

NAME,
S WHERE

SALARY

FROM

EMPLOYEE

E,

SALGRADE

E.SGRADE=

S.SGRADE

AND

E.ECODE<103;

(iv)

SELECT

SGRADE,SALARY

+HRA

FROM

SALGRADE

WHERE

SGRADE='S02';

6.

(a)

Verify

the following

using

Truth

Table:

x+y.z=(x+Y).

(x+Z)

(b)

Write

the equivalent Boolean Expression for the following Logic


p
Q

Circuit:

Downloaded From: http://www.cbseportal.com


91 10

---

--

--

Downloaded From: http://www.cbseportal.com


(c) Write the SOP form of a Boolean function F, which is represented

in a truth
U

table

as follows:
V W F

0 0 0 1 1 1 1
(d) Reduce the following

0 1 1 0 0 1 1
Boolean

1 0 1 0 1 0 1
Expression using

0 0 1 0 0 1 1
K-Map : 3

F B, D) (A,C, =L
(0,1,2,4,5,6,8,10) what is between XML is WEB2.0 ?

7.

(a)

In

networking,

WAN

How

is

it

different

from

LAN

(b)

Differentiate

and

HTML.

(c)

What

(d)

Out

of

the

following,

identify

client

side

script(s)

and

server

side

script(s).

(i)

javascript

(ii)

ASP

(iii)

vbscript

(iv)

JSP

(e)

Great

Sudies

University

is

setting

up

its

Academic

schools

at

Sunder

Nagar

and

planning

to

set

up

network.

The

university

has

academic

schools

and

one

administration

center

as

shown

in

the

diagram

below:

8
r(:::::{~~1 ~~~~~~J i 91 f f ,

Business School

Technology School

r;::::~~~1

li=~~~~~

Downloaded From: http://www.cbseportal.com


11 P.T.O.

r ,

- l,

Downloaded From: http://www.cbseportal.com


Center to center
follows:
Law School to Business School '

~""::~.II

'~~~~-'";III.c_!!

distances

between

various

buildings

is as

60

Law

School

to

Technology

School

90

Law

School

to

Admin

Center

115

Business'

School

to

Technology

School

40

.'

'

Business

School

to Admin

Center

45

Technology

School

to

Admin

Center

25

Number
follows:

of

Computers

in

each

of

the

Schools/Center

is

Law

School

25

Technology
Admin Center

School
125

50

Business

School

35

(i) (ii) (iii)

Suggest the most suitable place (i.e. Schools/Center) to install the server of this university with a suitable reason. Suggest an ideal layout for connecting these schools/center for a wired connectivity. Which device will you suggest to be placed/installed in each of these schools/center to efficiently connect all the
computers within
is

these schools/center?
planning to connect its admission office in

(iv)

The

university

the

closest

big

city,

which

is

more

than

350

km

from

the

university.

Which

type

of

network

out

of

LAN,

MAN

or

WAN

will

be

formed?

Justify'

your

answer.

(f)

Compare

Open

Source

Software

and

Proprietary

Software.

(g)

What are cookies?

Downloaded From: http://www.cbseportal.com


91 12 73,000