You are on page 1of 12

Std. 12 Time : 3 hrs.

23-9-2016 Half Yearly Examination in COMPUTER SCIENCE (Set - 1) M. Marks : 70

1. Write difference between (give two points) [2]

a) Private and protected access specifier


b) Protected and public visibility mode

2. a) Which of following header files are NOT necessary to run the program given: [1]

#include <iostream.h>

#include<iomanip.h>

#include <stdio.h>

#include <string.h>

#include <conio.h>

void main()

{ char STR[80] ;

cout<<"\n Enter any string";

gets (STR) ;

puts (strrev (STR) ) ;

b) Find the output of the following C++ program: [3]

#include<iostream.h>

#include<conio.h>

#include<ctype.h>

class Class

{ int Cno , total ;


char section;

public:

Class(int no=1)

{ Cno=no;

section='A';

total=30;

void addmission(int c=20)

{ section++;

total+=c;

void ClassShow()

{ cout<<Cno<<":"<<section<<":"<<total<<endl;

};

void main()

Class C1(5),C2;

C1.addmission(25);

C1.ClassShow();

C2.addmission();

C1.addmission(30);

C2.ClassShow();

C1.ClassShow();

}
c) Rewrite the following program after removing syntactical error(s) if any. Underline each

correction. [3]

#include<iostream.h>
#define MIN = 50 ;
class Help
{ int h_code;
char name[10];
public:
void IN()
{ cin>>h_code>>name;
}
void OUT()
{ cout<<h_code<<name;
}
void main()
{ Help H[MIN] ;
Help H1 = (10,Library) ;
H.h_code++;
OUT(H1);
}

d) Suggest the possible output out of the options given after the program: [2]

What is the minimum and maximum value of digit?

#include<iostream.h>
#include<stdlib.h>
const int MAX = 3;
void main( )
{ randomize ( );
int digit;
digit =80 + random (MAX );
for ( int R = digit ; R >= 80 ; R )
cout << R << $ ;
cout<<endl;
}
Possible Output Options :
(i) 83$ 82$ 81$ 80$
(ii) 80$ 81$ 82$
(iii) 80$ 81$
(iv) 81$ 80$
3. a) Define a class Fashion_Hub in C++ with the following descriptions : [4]

Private members :

Branch of type string

Dress_code of type integer

Style of type string

Size of type integer

Price of type float

A function Calc_Price() which calculates and assigns the value of Price as follows:

Style Price (Rs.)

Ethnic_kurti 3000

Top 1500

Jeans 2500

Others(neither of the above) 1000

Public Members :

A function Enter() to input the values of the data members Branch, Dress_code, Style,
Size and invoke the Calc_Price().
A function Show() which displays the content of all the data members of class
Fashion_Hub.

b) Consider the following class definitions and answer the questions given below : [9]

class Company

{ char Name[20];

protected :

double revenue;

public:

Company();
char country[15];

void enterdata();

void displaydata();

};

class Franchise : protected Company

{ int manpower;

char F_id[4];

char city[15];

protected:

void setup();

public:

Franchise();

void add();

void show();

};

class Outlet: public Franchise

{ int outlet_no;

public:

Outlet();

void enter();

void output();

};

i) Write the names of the members, which are accessible from the object of class Outlet.
ii) Write the names of the data member, which are accessible from the function enter() of class
Outlet.
iii) How many bytes will be consumed by the object of class Outlet?
iv) Write the order of execution of constructers.
v) Write the names of the data member, which are accessible from the function enter() of class
Outlet if the class Company is privately inherited.
vi) Can we invoke enterdata() function of class company from add() function defined in
Franchise class. Justify your answer.
vii) Write the name of inheritance used above.
viii) What will be the name of inheritance if one more class named ShowRoom is defined as
shown below:-
class ShowRoom : Franchise
{ .... };
ix) What will be the visibility mode of class Franchise shown in part viii

c) Answer the questions after going through the following C++ class:

class Stream

{ int StreamCode ;

char Streamname[20];

float fees;

public:

Stream( ) //Function 1

{ cout<<\n Function 1 invoked \n;

StreamCode=1;

strcpy (Streamname,"DELHI");

fees=1000;

void display( ) //Function 2

{ cout<<StreamCode<<":"<<Streamname<<":"<<fees<<endl;

~Stream( ) //Function 3

{ cout<<"End of Stream Object"<<endl;

}
Stream ( int SC , char S[ ] , float F ) //Function 4

{ cout<<\n Function 4 invoked \n;

StreamCode=SC ;

strcpy ( Streamname , S );

fees=F ;

Stream ( Stream &S ); //Function 5

};

i) In Object Oriented Programming, what are Function 1, Function 4 and Function5 combined
together referred as?
[]
ii) Write definition of function 5 outside the class. Also the statement to invoke it.
[1]
iii) What is the difference between the following statements?
[1]
Stream S(11,Science,8700); // Statement 1
Stream S=Stream(11,Science,8700); // Statement 2
iv) What is the name of function 3 and when it will be invoked?
[1]
v) Write output if the main is written as shown below :-
[1]
void main( )
{ Stream S , S1(12,Arts,6700);
}

4. a) An array Z[40][30] is stored in memory along the column with each of the elements occupying
4 bytes. Find out the base address and the address of the element Z[20][15], if an element
Z[15][10] is stored at the memory location 7200. [2]

b) Write a function in C++ that takes an integer array and its size as arguments and replaces all
multiples of 10 with 100 and the rest of the elements are changed to 0. The function should return
the resultant array.
[2]
For example, if
A[10]={ 9, 56, 50, 80, 25, 4, 457, 350, 99, 100}
then the resultant array will contain
{ 0, 0, 100, 100, 0, 0, 0, 100, 0, 100}
c) Write a function REVERSE (int DVD[][5] , int P, int Q) that displays a new array R_DVD[][5] that
contains the elements of array DVD[][5] with each column in reverse order. The arrays may contain
any number of rows and columns. For example, if the content of the array DVD[4][5] is

[3]

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

16 17 18 19 20

Then the content of R_DVD[4][5] will be

16 17 18 19 20

11 12 13 14 15

6 7 8 9 10

1 2 3 4 5

5. a) Convert the following Infix expression to postfix showing stack status at each step. [2]

XY/(Z+U)*V

b) Evaluate the following postfix using stack & show the content of the stack after the execution
of each: 20 , 43 , + , 51 , - , 8 , 2 , / , 10 , * , < [2]

6. a) Observe the following Table and answer the parts (i) and (ii) accordingly

Table : MEMBER

Mno Name Qty PurchaseDate

101 Pen 102 12-12-2011

102 Pencil 201 21-02-2012

102 Eraser 90 09-08-2010


109 Sharpener 90 31-08-2012

113 Clips 900 08-08-2011

(i) In the above table, can we take Mno as Primary Key ? (Answer in YES/NO only). Justify your
answer with a valid reason. [1]
(ii) What is the degree and the cardinality of the above table ? [1]

b) Consider the following tables STATIONARY and CONSUMER. Write SQL commands for the
statement (i) to (v) and output for SQL queries (vi) to (viii) :
[8]

Table : STATIONARY

S_ID StationaryName Company Price

DP01 Dot Pen ABC 10

PL02 Pencil XYZ 6

ER05 Eraser XYZ 7

PL01 Pencil CAM 5

GP02 Gel Pen ABC 15

Table : CONSUMER

C_ID ConsumerName Address S_ID

01 Good Learner Delhi PL01

06 Write Well Mumbai GP02

12 Topper Delhi DP01

15 Write and Draw

(i) To display the details of those consumers who are not living in Delhi and whose consumer
name starts with letter W
(ii) To display the details of Stationary whose Price is in the range of 8 to 15. (Both values
included)
(iii) To display the ConsumerName , Address , Company and Price whose address is not
entered
(iv) Print the total number of stationary items along with maximum price per company
(v) To increase the Price of all stationary by 2 .
(vi) SELECT DISTINCT Address FROM CONSUMER ;
(vii) SELECT count(*), count(Address) , count(DISTINCT address)
FROM STATIONARY ;

(viii) SELECT company , Sum(price) from stationary


group by stationaryName

having stationaryName LIKE %en% and count(*)>1 ;

7 a) State and verify the De-Morgans Theorem (Any One) algebraically . [2]

b) Write the equivalent Boolean expression for the following logic circuit :- [1]

c) Write the Sum of Product form and Product of Sum form of the function F(P,Q,R) for

the following truth table representation of F : [2]

P Q R F

0 0 0 1

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0
1 0 1 0

1 1 0 1

1 1 1 1

d) Obtain a simplified form for a Boolean expression :- [3]

F(u,v,w,x) = (0,1,3,5,7,9,10,11,12,13,14,15)

e) Draw the circuit diagram for F = ABC + CE using NAND gates only. [2]

8. a) What is LAN and WAN? [1]

b) State two reasons for which you may like to have a network of computers instead of

having stand alone computers. [1]

c) When a person does a crime using computer, then the person can be tracked through [1]

i) IP address

ii) MAC address

iii) Residence Address

d) Which out of the following does not come under Cyber Crime ? [1]

i) Stealing a mouse from someones computer.

ii) Operating someones Internet banking account , without his permission or knowledge.

iii) Entering in someones remotely and copying data , without seeking his permission

e) East and West Public Ltd. Has decided to network all its offices spread in five buildings of

C.P (number of computers are shown in [ ] in each building diagram) :- [4]


Building2 Building3
[45] [110]

Building1
[40]
Building5 Building4
[70] [60]

The distances between buildings are given below :-

Between 1 & 2 20 Mts

Between 3 & 5 70 Mts

Between 2 & 3 50 Mts

Between 1 & 5 65 Mts

Between 3 & 4 120 Mts

Between 2 & 5 50 Mts

Between 4 & 5 30 Mts

(i) Suggest cable layout(s) for connecting the buildings.


(ii) Suggest the most suitable building to install the server of this organization with a suitable
reason, with justification .
(iii) Building 3 is used for many critical operations. It is planned to provide that PC maximum
possible dedicate bandwidth. Which network device should be used for this ?
(iv) The company has another office in the same city , but at a distant location about 25-30 kms
away. How can link be established with this building 1 (suggest the transmission medium) ?

f) Name two websites which are prominent in social networking. [1]

g) What is cyber crime ? [1]