285
1 COMPUTER SCIENCE (083) Class XII Blue Print(Theory) S.N o. UNIT VSA SA I SA II LA TOTA L (1 Mark) (2 Marks) (3 Marks) (4 Marks) 1 Review of C++ covered in Class XI 1 (1) 8 (4) 3 (1) 12 (6) 2 Object Oriented Programming in C++ a Introduction to OOP using C++ 2 (1) 4 (1) 6 (2) b Constructor & Destructor 2 (1) 2 (1) c Inheritance 4 (1) 4 (1) 3 Data Structure & Pointers a Address Calculation 3 (1) 3 (1) b Static Allocation of Objects 2 (1) 3 (1) 5 (2) c Dynamic Allocation of Objects 4 (1) 4 (1) d Infix & Postfix Expressions 2 (1) 2 (1) 4 Data File Handling in C+ + a Fundamentals of File Handling 1(1) 1 (1) b Text File 2 (1) 2 (1) c Binary Files 3 (1) 3 (1) 5 Database and SQL a Database Concepts 2(1) 2 (1) b Structured Query Language 2 (1) 4(1) 6(2) 6 Boolean Algebra a Introduction to 2 (1) 2

· Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

  • Upload
    vudien

  • View
    225

  • Download
    1

Embed Size (px)

Citation preview

Page 1: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

1

COMPUTER SCIENCE (083)

Class XII Blue Print(Theory)

S.No.

UNIT VSA SA I SA II LA TOTAL

(1 Mark)

(2 Marks)

(3 Marks)

(4 Marks)

1 Review of C++ covered in Class XI 1 (1) 8 (4) 3 (1) 12 (6)2 Object Oriented Programming in

C++a Introduction to OOP using C++ 2 (1) 4 (1) 6 (2)b Constructor & Destructor 2 (1) 2 (1)c Inheritance 4 (1) 4 (1)

3 Data Structure & Pointersa Address Calculation 3 (1) 3 (1)b Static Allocation of Objects 2 (1) 3 (1) 5 (2)c Dynamic Allocation of Objects 4 (1) 4 (1)d Infix & Postfix Expressions 2 (1) 2 (1)

4 Data File Handling in C++a Fundamentals of File Handling 1(1) 1 (1)b Text File 2 (1) 2 (1)c Binary Files 3 (1) 3 (1)

5 Database and SQLa Database Concepts 2(1) 2 (1)b Structured Query Language 2 (1) 4(1) 6(2)

6 Boolean Algebraa Introduction to Boolean Algebra

& Laws2 (1) 2 (1)

b SOP & POS 1(1) 1 (1)c Karnaugh Map 3 (1) 3 (1)D Basic Logic Gates 2 (1) 2(1)

7 Communication & Open Source Conceptsa Introduction to Networking 2(1) 2 (1)b Media, Devices, Topologies &

Protocol4(1) 4 (1)

c Security 1(1) 1 (1)d Web Servers 1(1) 1(1)e Open Source Terminologies 1(1) 1(1)f Cloud Computing 1(1) 1(1)

Page 2: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

2

SAMPLE PAPER SET-1Subject - Computer Science (065) Class: XIITime Allowed: 3hours Maximum Marks: 70

Instructions: (i) All questions are compulsory.

(ii) Programming Language: C+ +

Ques 1 a) Identify invalid identifiers from the following:- goto loop bReak auto 12class class12 class 12

2

b) Name the header files, to which following inbuilt function belong to:a) isdigit( )b) random( )

1

c) Identify the errors in the following program code:#include<iostream.h>class int{

int I,j;public:

int(int a, int b){

I=a; j=b;}

};class class2{

int I,j;Public:

class2(int a, int b){

I=a; j=b;}

};int main( ){

int x(10,20);class2 y;x=y;

}

2

d) Give the output of the following program:#include<iostream.h>int global=10;void func(int &x, int y){ x=x-y ;y=x*10 ;

cout<<x<<’,’<<y <<”\n”;}void main(){ int global=7 ;

func( ::global,global) ;cout<<global<<’,’<<::global<<”\n”;func(global,::global) ;

2

Page 3: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

3

cout<<global<<’,’<<::global<<”\n”;}

e) Find the output of the following program :#include<iostream.h>#include<string.h>#include<ctype.h>void Change(char Msg[], int Len){

for(int Count=0;Count<Len; Count++){

if(islower(Msg[Count])) Msg[Count]=toupper(Msg[Count]);else if(isupper(Msg[Count])) Msg[Count]=tolower(Msg[Count]);else if(isdigit(Msg[Count])) Msg[Count]=Msg[Count]+1;else Msg[Count]=’*’;

}}

void main(){

char Message[]=”2012 Happy New Year”;int Size=strlen(Message);Change(Message,Size);cout<<Message<<endl;for(int C=0,R=Size-1;C<=Size/2;C++,R--){

char Temp=Message[C];Message[C]=Message[R];Message[R]=Temp;

}cout<<Message<<endl;

}

3

f) Study the following program and select the possible output from it:. Also justify your answer.

#include<iostream.h>#include<stdlib.h>const int Max=3;void main( ){

randomize( );int Div;Div=1+random(Max);for(int N=1;N<5;N++){

cout<<100%Div<<”#”;}

}i) 0#0#0#0#ii) 1#1#1#1#

2

Page 4: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

4

iii) 2#2#2#2#iv) 3#3#3#3#

Ques 2. a) What is Function Overloading? Give an example in C++ to illustrate the same. 2b) Answer the questions (i) and (ii) after going through the following program:

#include<iostream.h>#include<string.h>class AirIndia{

char flno;int Nop;

public:AirIndia() //function1{

strcpy(flno,” ”);Nop=0;

}AirIndia( chat *str,int n) //function2{

strcpy(flno,str);Nop=n;

}void input //function3{

cin>>flno;cin>>Nop;

}~AirIndia() //function4{

cout<<”counter closed”<<endl;}

};(i) In Object Oriented Programming, which concept is illustrated by Function1

and Function2 together? (ii) Write the statement to call these functions (Function 1 and Function 2).

2

c) Define a class cricket in C++ with the following description:

Private members: Target_score of type integer Overs_bowled of type integer Extra_time of type integer Penalty of type integer Cal_penalty() a member function to calculate penalty as follows:

If Extra_time<=10, Penalty=1If Extra_time>10 but <=20 Penalty=2, otherwise, Penalty=5

Public members: A fuinction Extradata () to allow user to enter values for Target_score,

Over_bowled, Extra_time. A function DspData( ) to allow user to view the contents of all data

members.

4

Page 5: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

5

d) Consider the following and answer the questions given below:class MNC{

char Cname[25];protected:

char Hoffice[25];public:

MNC();char Country[25];void EnterDate ( );void DisplayData ( );

};class Branch:public MNC{

long NOE:char Ctry[25];

protected:void Association( );

public:Branch( );void Add( );void Show( );

};class Outlet: public Branch{

char State[25];public:

Outlet( );void Enter ();void Output();

};i) Which class’s constructor will be called first at the time of declaration of an object

of class Outlet?ii) How many bytes an object belonging to class Outlet require?iii) Name the member function(s), which are accessed from the object(s) of class Outlet.iv) Name the data member(s), which are accessible from the object(s) of class Branch

4

Ques.3 a) Write a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to be a square matrix with odd dimension, i.e., 3x3, 5x5, etc..]Example, if the array contents is 5 4 36 7 81 2 9Output through the function should be :Diagonal One : 5 7 9Diagonal Two: 3 7 1

3

b) An array Arr[15][20] is stored in the memory along the row with each element occupying 4 bytes. Find out the Base Address and address of the element Arr[3][2], if the element [5][2] is stored at the address 1500

3

c) Give the necessary declaration of queue containing integer. Write a user defined function in C++ to delete an integer from the queue. The queue is to be implemented as a linked list

4

d) Write a function in C++ to print the sum of all the values which are either divisible by 2 or 2

Page 6: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

6

are divisible by 3 present in a two-dimensional array passed as the argument to the function.

e) Evaluate the following postfix notation of expression: 10, 20, +, 25, 15, -, *, 30, /

2

Ques 4. a) Observe the program segment given below carefully and fill the blanks marked statement 1 and statement 2 using seekg( ) and tellg( ) function for performing the required task.

#include<fstream.h>class Employee{

int Eno;char Ename[30];

public://Function to count the total number of records int Countrec( );

};int Employee:: Countrec( ){

fstream File;File.open(“Emp.Dat”,ios::binary||ios::in);___________ // Statement 1int Bytes = ________________ // Statement 2int count = Bytes/sizeof(item);File.close( );return count;

}

1

b) Write a function in C++ to count the number of alphabets present in a text file “Para.Txt”. 2

c) Write a function in C++ to add new objects at the bottom of a binary file “Student.Dat”, assuming the binary file is containing the object of the following class

class STUD{

int Rno;char Name[20];

public:void Enter (){ cin>>Rno;

gets(Name);}void Display(){ cout<<Rno<<Name<<endl;}};

3

Ques5 d) What do you mean by Candidate Key and Foreign Key? 2e) Consider the following tables STORE and SUPPLIERS a. Write SQL commands for the

statements (i) to (iv) and give outputs for SQL queries (v) to (viii).Table: STORE

6

Page 7: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

7

Table: SUPPLIERSScode Sname

21 Premium Stationary

23 Soft Plastics

22 Tetra Supply

i) To display details of all the items in the Store table in ascending order of LastBuy.

ii) To display Itemno and item name of those items from store table whose rate is more than 15 rupees.

iii) To display the details of those items whose supplier code is 22 or Quantity in store is more than 110 from the table Store.

iv) To display minimum rate of items for each Supplier individually as per Scode from the table Store.

v) SELECT COUNT(DISTINCT Scode) FROM STORE;vi) SELECT Rate*Qty FROM STORE WHERE Itemno=2004;vii) SELECT Item,Sname FROM STORE S, SUPPLIER P WHERE

S.Scode=P.Scode AND ItemNo=2006.viii) SELECT MAX(LastBuy)FROM STORE;

Ques6 a) State and verify Associative Law. 2b) Write the equivalent expression for the following Logic Circuit: 2

c) Convert the following three function F denoted by expression F=∑(0,1,2,5) into its Canonical Sum of Product of Sum Form

1

d) Reduce the following Boolean Expression using K-Map: 3

ItemNo Item Scode Qty Rate LastBuy

2005 Sharpner Classic 23 60 8 31-Jun-09

2003 Ball Pen 0.25 22 50 25 01-Feb-10

2002 Gel Pen Premium 21 150 12 24-Feb-10

2006 Gel Pen Classic 21 250 20 11-Mar-09

2001 Eraser Small 22 220 6 19-Jan-09

2004 Eraser Big 22 110 8 02-Dec-09

2009 Ball Pen 0.5 21 180 18 03-Nov-09

Page 8: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

8

F(P,Q,R,S)= ∑ (0,3,5,6,7,11,12,15)Ques 7 a) What is Repeater? 1

b) Expand the following terms: i) XML ii) GSM

1

c) Differentiate between Hackers and Crackers? 1d) Indian Public School in Darjeeling is setting up the network between the different wings.

There are 4 wings names as Senior(S), Junior(J), Admin(A) and Hostel(H).

Distance between various wings Numbers of computers

i) Suggest a suitable Topology for Networking the computer of all wingsii) Name the wing where the server is to be installed. Justify your answer.iii) Suggest the placement of Hub/Switch in the network.iv) Mention an economic technology to provide internet accessibility to all

wings.

4

e) What do you mean by Cyber law? 1

f) What do you mean by free software? 1

g) What is a platform in cloud computing? 1

Wing A to Wing S 100m Wing A 10

Wing A to Wing J 200m Wing S 200

Wing A to Wing H 400m Wing J 100

Wing S to Wing J 300m Wing H 50

Wing S to Wing H 100m

Wing J to Wing H 450m

Page 9: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

9

SAMPLE PAPER 1Class – XII

Subject - Computer Science (065)MARKING SCHEME

Ques 1 a) goto auto 12class class 12(1/2 Mark for each invalid identifier)

2

b) a) isdigit( ) – ctype.hb) random( )-stdlib.h

(1/2 Mark for mentioning name of each header file)

1

c) Identify the errors in the following program code:#include<iostream.h>class class1{

int I,j;public:

class1(int a, int b){

I=a; j=b;}

};class class2{

int I,j;public:

class2(int a, int b){

I=a; j=b;}

};int main( ){

class1 x(10,20);class2 y(20,30);x=y;return 0   ;

}(1/2 Mark for correcting each error)OR(1 Mark for identifying all the 4 errors with no correction)

2

d) 3,307,34,404,3

( ½ Mark for each correct line of output)OR(½ mark for partial answers i.e, upto two correct numbers in each line)

Note: Deduct ½ Mark for not showing , in the output

2

Page 10: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

Deduct ½ Mark for not considering endle) 3123*hAPPY*nEW*yEAR

RAEy*WEn*YPPAh*3123 (1 Mark for writing all alphabets at correct positions)

(1/2 Mark for writing * at correct position OR(½ mark for partial answers in each line for any two sets of strings )

3

f) Possible Answer is i) 0#0#0#0#ii) 1#1#1#1#(1 Mark for each line of correct output)OR(½ mark for partial answers i.e, upto two correct numbers in each line)Note: Deduct ½ marks for not considering # from the total marks obtained in this question.

2

Ques 2. a) Function Overloading: A function name having several definitions that are differentiable by the numbers or types of their arguments, is known as function overloading.

float area(float a){Return a* a;}float area(float a, float b){ return a*b;}

(1 Mark for each definition and explanation)OR(Full 2 marks for explaining both with the help of an example)

2

b) i) Constructor OverloadingORFunction OverloadingORPolymorphism(1 mark for mentioning any of the above or similar term)OR(Only ½ mark for mentioning just as Constructor)

ii) AirIndia A;AirIndia A(“Boeing ”, 100);(½ mark for each statement)

2

c) class cricket{

int Target_Score;int Overs_bowled;int Extra_time;

int Penalty;void Cal_penalty();

public:void Extradata();void DspData();

};void cricket::Cal_penalty(){

4

Numbers/Types of arguments

Function overloading

Page 11: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

if (extra_time<=10) Penalty=1; else if (extra_time>10) && (extra_time<=20) Penalty=2; else Penalty=5;}void cricket::Extradata(){

cout<<”Target Score :”;cin>>Target_score;cout<<”Over Bowled :”;cin>>Over_bowled ;cout<<”Extra Time :”;cin>>Extra_time;Cal_penalty();

}void cricket::DspData(){

cout<<”Target Score :”<<Target_score<<endl;cout<<”Over Bowled :”<<Over_bowled<<endl;cout<<”Extra Time :”<<Extra_time<<endl;;cout<<”Penalty :”<<Penalty<<endl;;

} (1 Mark for correctly declaring Data Members)

(1 Mark for correctly defining Cal_penalty())( ½ Mark for correctly defining Extradata())( ½ Mark for calling Cal_penalty() from ExtradataE())( ½ Mark for correctly defining DspData())( ½ Mark for correct syntax of class)

d) i) First of All constructor of class MNC will be called, then Branch, at last Outletii) 129iii) MNC::EnterData(), MNC::DisplayData(), Branch::Add(), Branch::show(),

Outlet::Enter(), Outlet::Outputiv) MNC::Country

( 1 Mark for each correct answer)

4

Ques.3 a) void Diag(int A[N][N],int N){

cout<<”Diagonal One :”; for (int I=0;I<N;I++) {

cout<<A[I][I]<<” “; }

cout<<”\nDiagonal Two :”; for (int I=0;I<N;I++) {

cout<< A[I][N-I-1]<<” “; }

}( ½ Mark for initialization of desired variables)( ½ Mark for correct formation of loop)( 1 Mark for statement to add left diagonal elements)( 1 Mark for statement to add right diagonal elements)

3

b) Given,W=4N=15

3

Page 12: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

M=20Loc(ArrS[5][2])=1500

Row Major Formula:Loc(Arr[I][J]) =Base(Arr)+W*(M*I+J)Loc(Arr[5][2]) =Base(Arr)+4*(20*5+2)

1500 =Base(Arr)+4*(100+2)Base(Arr) =1500- 408Base(Arr) =1092

Loc(ArrS[3][2]) =1092+4*(20*3+2)=1092+4*(60+2)=1092+248=1340

(1/2 Mark for correct formula/substitution of values in formula)(1 ½ Mark for correctly calculating Base Address) (1 Mark for correctly calculating address of desired location)

c) struct NODE{Int num;NODE *Link;

};class QUEUE{

NODE *R,*F;public:

QUEUE();void Insert();void Delete();

};void QUEUE::Delete(){

NODE *ptr;if (f==NULL){ cout<<”Queue Empty”; return;}else{ ptr=f; f=f->link; delete(ptr);}}

( ½ Mark for appropriate function header)( ½ Mark for declaring a Temporary pointer - ptr)(1 Mark for correct use of input/assignment of Temporary pointer- ptr) (1 Mark for checking FRONT f as NULL and displaying empty queue) (1 Mark for connecting f to link part of f and deleting ptr)

4

d) void sumArrElements(int A[][20], int r, int c){ int I, j, sum=0;

for(i=0;i<r;i++)for(j=0;j<c;j++)

if (A[i][j]%2==0)sum+=A[i][j];

2

Page 13: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

else if (A[i][j]%3==0)sum+=A[i][j];

cout<<”The Sum is : “<<sum<<endl;}

( ½ Mark for initialization of desired variables)( ½ Mark for correct formation of loop)( ½ Mark for statement to add Elements divisible by 2)( ½ Mark for statement to add Elements divisible by 3)

e) Step 1:Push

10

Step 2: Push

20

10

Step 3: +Push

Pop Pop

Op2=20 Op1=10

Op2=20

10 30

Step 4: Push

25

30

Step 5: Push

15

25

30

Step 6: -

2

Page 14: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

PushPop Pop

Op2=15 Op1=25

25 Op2=15 10

30 30 30

Step 7: *Push

Pop Pop

Op2=10 Op1=30

Op2=10

30 300

Step8: Push

30

300

Step 9: /Push

Pop Pop

Op2=30 Op1=300

Op2=30

300 10

Step 10: Pop

Result

10

( ¼ Mark for showing stack position for each operation +,-, *and /)( 1 Mark for correctly evaluating the final result)

Ques 4. a) File.seekg(0,ios::end);File.tellg();( ½ Marks for Correct Syntax)

1

b) int countalpha(){ifstream fin(“Para.Txt”);char ch;int count=0;

2

Page 15: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

while(!fin.eof()){fin.get(ch);if(isalpha(ch))count++;}

fin.close();return count;}

( ½ mark for opening the file)( ½ mark for initializing the variable for counting lines to 0)( ½ mark for reading each letters)( ½ mark for incrementing and displaying/returning value of variable)

c) void WriteObject(){fstream fout(“Student.Dat”, ios::app|ios::binary);STUD St;St.Enter();fout.write((char *)&St, sizeof(St));fout.close();}

( ½ mark for correct syntax of function header and body) ( ½ mark for opening the file in ‘app’ mode)( ½ mark for correct object creation from class STUD)( ½ mark for calling correct function from class object of STUD )( ½ mark for correct write function to file of class STUD)( ½ mark for closing the file)

3

Ques5 a) Candidate Key: All attribute combination inside a relation that can serve as Primary Key. Foreign Key: A non-key attributes whose values are derived from the primary key of some other table.

(1 mark for definition of Degree)(1 mark for definition of Cardinality)

2

b) i) Select * from store order by LastBuy asc;ii) Select Itemno, item from store where rate>15;iii) Select * from store where scode=22 or qty>110;iv) Select Min(Rate) from store group by scode;v) 3vi) 880vii) Gel Pen Classis, Premiumviii) 24-Feb-10(1 marks for each SQL Syntax)( ½ Marks for each correct output)

6

Ques6 a) State and verify Associative Law. The Associative Laws states

(i) X+(Y+Z)=(X+Y)+Z(ii) X(YZ)=(XY)Z

Showing the results through Truth Table(1 mark for stating the correct law)

(1 mark for the appropriate verification using truth table OR algebraic method)

2

b) F=(AC)’+(BA)’+(BC)’ (Full 2 marks for obtaining the correct Boolean Expression for the Logic Circuit)

OR

2

Page 16: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

(1 mark correctly interpreting SUM terms)c) F=m0+m1+m2+m5

m0=000=X’Y’Z’m1=001=X’Y’Zm2=010=X’YZ’m5=101=XY’Z

S-O-P: X’Y’Z’+X’Y’Z+X’YZ’+XY’Z(1 mark for correct POS representation)

1

d) There are 1 quad, 2 pairs and 2 blocksQuad(m3+m7+m15+m11) =RSPair(m5+m7)=P’QSPair(m7+m6)=P’QRBlock m0=P’Q’R’S’Block m12=PQR’S’Hence the final expression is F=RS+P’QS+P’QR+P’Q’R’S’+PQR’S’

(1 mark for correctly drawing K-Map with 1s represented on right places)( ½ mark for minimizing Quad) ( ½ mark for minimizing Pair and Block) (1 mark for writing the complete Boolean Expression)

3

Ques 7 a) Repeater- Repeater receive signals from one network segment and amplify , and retransmit those signals to another network segment

( 1 mark for correct definition)

1

b) Expand the following terms: XML =eXtensible Markup LanguageGSM =Global System for Mobile

(½ mark each expansion)

1

c) Hackers: Programmers who gain knowledge about computer system for playful leisure and having intention to gain benefit from itCrackers: Programmers who break into secure systems ( ½ marks for mentioning the correct Definition)

1

d) i) Star Topologyii) Server at Wing S as it has maximum number of computers.iii) Hub/Switch required at all the wings.iv) Using Proxy server at Wing S and connect to the internet.

(1 mark for suggesting the appropriate economic way)

4

e) Cyber law is a generic term, which refer to all the legal and regulatory aspects of Internet and World wide Web. ( 1 mark for mentioning the correct Definition)

1

f) Free software means the software is freely accessible and can be freely used, changed, improved, copied and distributed by all who wish to do so.? ( 1 mark for mentioning the correct Definition)

1

g) Web work as a platform in Cloud computing.( 1 mark for mentioning the correct Definition)

1

Page 17: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

SAMPLE PAPER SET-II

COMPUTER SCIENCE (083)

1 A What is the difference between static and dynamic memory allocation? Explain giving example. [2]B Write the names of the header files which are essentially required to run the following C++ code

void main( ){

char String[ ] = “ Anna Hazare” ;cout<<setw(12) <<String ;

}

[1]

C Rewrite the following program after removing the syntactical errors (if any). Underline each correction

#include [iostream.h]class PAYITNOW {

int Charge;PUBLIC:

void Raise() { cin>>Charge; }void Show { cout<<Charge; }

};void main() {

PAYITNOW P;P.Raise();Show();

}

[2]

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

struct PLAY{ int Score, Bonus;};void Calculate(PLAY &P, int N=10){ P.Score++;P.Bonus+=N;}void main( ){

PLAY PL={10,15};Calculate(PL,5);cout<<PL.Score<<”:”<<PL.Bonus<<endl;Calculate(PL);cout<<PL.Score<<”:”<<PL.Bonus<<endl;Calculate(PL,15);cout<<PL.Score<<”:”<<PL.Bonus<<endl;

}

[3]

E In the following program, what will be the output? Justify.#include <stdlib.h>

#include <iostream.h>void main(){ randomize();

int score [ ] = {25, 20, 34, 56, 72, 63}, myscore;myscore = score[2 + random(2)];cout << myscore <<endl;

[2]

Page 18: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

}i) 25 ii) 56 iii) 20 iv) None of these

F Find the output of the following program . #include<iostream.h>

void main( ){

int *Q, M[]={11, 22, 33, 44}; Q=M; M[2] += 22; cout<<” Queen @ “<<*Q <<endl; *Q - = 11; Q += 2; cout<<” Now @”<< *Q <<endl; Q++; cout<<”Finally @”<< *Q <<endl; cout<<”New Value @”<<M[0] <<endl;

}

[2]

2 A What do you understand by Data Encapsulation and Data Hiding? [2]B Answer the questions (i) and (ii) after going through the following program:

class Match{ int Time;public:

Match() //Function 1{ Time=0;

cout<<”Match commences”<<end1;}

void Details() //Function 2{

cout<<”Inter Section Basketball Match”<<end1;}

Match(int Duration) //Function 3{ Time=Duration;

cout<<”Another Match begins now”<<end1;}

Match(Match &M) //Function 4{ Time=M.Duration;

cout<<”Like Previous Match ”<<end1;}

};

i) Which category of constructor - Function 4 belongs to and what is the purpose of using it?ii) Write statements that would call the member Functions 1 and 3

[2]

C Define a class TEST in C++ with following description: Private Members

TestCode of type integer Description of type string NoCandidate of type integer CenterReqd (number of centers required) of type integer A member function CALCNTR() to calculate and return the number of centers

as (NoCandidates/100+1)

[4]

Page 19: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

Public Members A function SCHEDULE() to allow user to enter values for TestCode, Description,

NoCandidate & call function CALCNTR() to calculate the number of CentersA function DISPTEST() to allow user to view the content of all the data members

D Given the following class definition, answer the questions that follow: class Medicines

{ char Category[10];char mfg_date[10];char Company;

public:void Medicines ();void entermedicinedetails();void showmedicinedetails();

};class Capsules : public Medicines{protected :

char capsule_name[30];char vol_label[20];

public:float Price ;Capsules();void entercapsuledetails();void showcapsuledetails();

};class Antibiotics: public Capsules{ int Dosage_units;

char side_effects[20];int Use_within_days;

public:Antibiotics();void enterdetails();void showdetails();

}; i) What will be the size of an object (in bytes) of class Medicines and an object of class Antibiotics respectively?ii) Name the members functions which can be accessed from the object of class Antibioticsiii) Name the members which can be accessible by the member function of class Capsules. iv) Name all the data members which are accessible from objects of class Antibiotics

[4]

3 A Write a function in C++ to merge the contents of two arrays A and B into third array C. The resultant array C is required to be in ascending order.

[3]

B An array A[1..15][1..8] is stored in the memory column wise with each of its element occupying 4 bytes. Find out he base address and the address of the element at A[3][2], If the location of A[5][7] isstored at address 2500.

[3]

C Define a function Stackpush( ) in C++ to insert node and StackPop( ) to delete a node, for linked list implementation of a stack having the following structure .

struct Node{

char name[20]; int age;Node *Link;

} ;class STACK{

Node *Top, *newptrpublic :

[4]

Page 20: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

void STACK( ) { Top=NULL; }void Stackpush( ) ;void StackPop( );~ STACK( );

};D Write a function in C++ to find the sum of both left and right diagonal elements from a two

dimensional array (Assuming 2D Array to be a square matrix with odd dimension matrix (i.e 3x3, 5x5,7x7….etc).

If the array is 2 3 11 5 3

6 7 8The Output should be The Sum of Diagonal 1: 15

The Sum of Diagonal 2: 12

[2]

E Translate into Postfix form A + [ (B + C) + (D +E) * F ] / G

[2]

4 A Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task.

#include <fstream.h>class Employee{ int Eno; char Ename[20];public:

int Countrec(); //Function to count the total number of records};int Employee::Countrec(){ fstream File;

File.open(“EMP.DAT”,ios::binary|ios::in);

________________________ //Statement 1int Bytes = ______________________ //Statement 2

int Count = Bytes / sizeof(Item);File.close();

return Count;}

[1]

B Write a function to count the number of alphabets present in a text file “NOTES.TXT”. [2]C Write a function in C++ to search for a BookNo from a binary file “BOOK.DAT”, assuming the binary

file is containing the objects of the following class.class BOOK{

int Bno;char Title[20];

public:int RBno() {return Bno; }void Enter() {cin>>Bno; gets(Title); }void Display() {cout<<Bno<<Title<<endl; }

};

[3]

5 A Differentiate between DDL and DML? Give examples. [2]B Consider the following tables ACTIVITY and COACH.

Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)Table: ACTIVITY

[6]

Page 21: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

ACode ActivityName ParticipantsNum

Prize

Money

ScheduleDate

1001 Relay 100x4 16 10000 23-Jan-2004

1002 High jump 10 12000 12-Dec-2003

1003 Shot Put 12 8000 14-Feb-2004

1005 Long Jump 12 9000 01-Jan-2004

1008 Discuss Throw 10 15000 19-Mar-2004

Table: COACHPCode Name ACode

1 Ahmad Hussain 1001

2 Ravinder 1008

3 Janila 1001

4 Naaz 1003

(i) To display the name of all activities with their Acodes in descending order.(ii) To display sum of PrizeMoney for each of the Number of participants groupings (iii) To display the coach’s name and ACodes in ascending order of ACode from the table COACH(iv) To display the content of the ACTIVITY table whose ScheduleDate earlier than 01/01/2004 in ascending order of ParticipantsNum.(v) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;(vi) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY;(vii) SELECT SUM(PrizeMoney) FROM ACTIVITY;(viii) SELECT DISTINCT ParticipantsNum FROM ACTIVITY;

6 A State and algebraically verify Absorption Laws. [2]B Write the equivalent Boolean Expression for the following circuit [2]

C Convert (X '+ Y+ Z') . (X '+ Y+ Z) . (X '+ Y'+ Z) . (X '+ Y'+ Z') into canonical Sum of Products (SOP) form [1]D Reduce the Boolean Expression using K-Map

F (A,B,C,D)= Σ ( 0,2,3,4,6,7,8,10,12)[3]

7 A What is the significance of ARPANET in the network? [1]B Expand the following terminologies:

(i) CDMA (ii) GSM(iii) TCP/IP (iv) HTTP

[1]

C Differentiate between XML and HTML. [1]D What is the purpose of using a Web Browser? Name any 2 commonly used Web Browser. [1]E Knowledge Supplement Organisation has set up its new center at Mangalore for its office [3]

Page 22: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

and web based activities. It has 4 blocks of buildings as shown in the diagram below:

Center to center distances between various blocksBlack A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

Block A to Block C 90 m

Number of ComputersBLOCK No of Computers

Black A 25

Block B 50

Block C 125

Block D 10

e1) Suggest a cable layout of connections between the blocks.e2) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable reason.e3) Suggest the placement of the following devices with justification (i) Repeater (ii) Hub/Switch

F Name two Proprietary softwares along with their application [1]

G How Trojan Horses are different from Worms? Mention any one difference. [1]H Out of the following, identify client side script(s) and server side script(s).

i) java script ii) ASP iii) vb script iv) PHP[1]

Page 23: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

Page 24: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

24

Group-11

MARKING SCHEME

COMPUTER SCIENCE (083)

1 A What is the difference between static and dynamic memory allocation? Explain giving example.

[2]

Ans

In the static memory allocation, the amount of memory to be allocated is decided at the time of compiling a program. In the dynamic memory allocation, the amount of memory is allocated during run-time of a program as and when required.(1Mark for each definition)

B Write the names of the header files which are essentially required to run the following C++ codevoid main( ) {

char String[ ] = “ Anna Hazare” ;cout<<setw(12) <<String ;

}

[1]

Ans iostream.h , iomanip.hC Rewrite the following programafter removing the syntactical errors (if any).

Underline each correction#include [iostream.h]class PAYITNOW {

int Charge;PUBLIC:

void Raise() { cin>>Charge; }void Show { cout<<Charge; }

};void main() {

PAYITNOW P;P.Raise();Show();

}

[2]

Ans#include <iostream.h>class PAYITNOW{int Charge;public: void Raise(){cin>>Charge;} void Show(){cout<<Charge;}};void main(){PAYITNOW P;P.Raise();P.Show();

Page 25: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

25

} (1/2 Mark for correcting each error)OR(1 Mark for identifying all the 4 errors with no correction)

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

struct PLAY{ int Score, Bonus;};void Calculate(PLAY &P, int N=10){ P.Score++;P.Bonus+=N;}void main( ){

PLAY PL={10,15};Calculate(PL,5);cout<<PL.Score<<”:”<<PL.Bonus<<endl;Calculate(PL);cout<<PL.Score<<”:”<<PL.Bonus<<endl;Calculate(PL,15);cout<<PL.Score<<”:”<<PL.Bonus<<endl;

}

[3]

Ans 11:2012:3013:45 (1 Mark for each correct line of output)

Note:Deduct ½ Mark for not showing : in the outputDeduct ½ Mark for not considering endl

E In the following program, what will be the output? Justify.#include <stdlib.h>

#include <iostream.h>void main(){ randomize();

int score [ ] = {25, 20, 34, 56, 72, 63}, myscore;myscore = score[2 + random(2)];cout << myscore <<endl;

}i) 25 ii) 56 iii) 20 iv) None of these

[2]

Ans : ii) 56 correct explanationF Find the output of the following program .

#include<iostream.h>void main( ){

int *Q, M[]={11, 22, 33, 44}; Q=M; M[2] += 22; cout<<” Queen @ “<<*Q <<endl;

[2]

Page 26: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

26

*Q - = 11; Q += 2; cout<<” Now @”<< *Q <<endl; Q++; cout<<”Finally @”<< *Q <<endl; cout<<”New Value @”<<M[0] <<endl;

}

Ans Queen @ 11NOW @ 55Finally@ 44Now @ (1/2 mark for each statement)

2 A What do you understand by Data Encapsulation and Data Hiding? [2]Ans Data Encapsulation: Wrapping up of data and function together in a single unit is

known as Data Encapsulation. In a class, we wrap up the data and function together in a single unit.Data Hiding: Keeping the data in private visibility mode of the class to prevent it from accidental change is known as Data Hiding.class Computer{ char CPU[10]; int RAM;public: void STOCK(); void SHOW();};(1 Mark for each definition)

B Answer the questions (i) and (ii) after going through the following program:

class Match{ int Time;public:

Match() //Function 1{ Time=0;

cout<<”Match commences”<<end1;}void Details() //Function 2{ cout<<”Inter Section Basketball

Match”<<end1;}Match(int Duration) //Function 3{ Time=Duration;

cout<<”Another Match begins now”<<end1;}Match(Match &M) //Function 4{ Time=M.Duration;

cout<<”Like Previous Match ”<<end1;}

};

i) Which category of constructor - Function 4 belongs to and what is the purpose of using it?ii) Write statements that would call the member Functions 1 and 3

[2]

Page 27: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

27

Ans i) Copy Constructor, it is invoked when an object is created and initialized with values of an already existing object.

ii) Match M1; //for Function 1 Match M2(90); //for Function 3

C Define a class TEST in C++ with following description:Private Members

TestCode of type integer Description of type string NoCandidate of type integer CenterReqd (number of centers required) of type integer A member function CALCNTR() to calculate and return the

number of centers as (NoCandidates/100+1) Public Members

A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres

A function DISPTEST() to allow user to view the content of all the data members

[4]

Ans class TEST{

int TestCode;char Description[20];int NoCandidate,CenterReqd;void CALCNTR();

public:void SCHEDULE();void DISPTEST();

};void TEST::CALCNTR(){

CenterReqd=NoCandidate/100 + 1;}void TEST::SCHEDULE(){

cout<<”Test Code :”;cin>>TestCode;cout<<”Description :”;gets(Description);cout<<”Number :”;cin>>NoCandidate;CALCNTR();

}void TEST::DISPTEST(){

cout<<”Test Code :”<<TestCode<<endl;cout<<”Description :”<<Description<<endl;cout<<”Number :”<<NoCandidate<<endl;;cout<<”Centres :”<<CenterReqd<<endl;;

}D Given the following class definition, answer the questions that follow:

class Medicines{ char Category[10];

char mfg_date[10];char Company;

public:void Medicines ();void entermedicinedetails();void showmedicinedetails();

[4]

Page 28: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

28

};class Capsules : public Medicines{protected :

char capsule_name[30];char vol_label[20];

public:float Price ;Capsules();void entercapsuledetails();void showcapsuledetails();

};class Antibiotics: public Capsules{ int Dosage_units;

char side_effects[20];int Use_within_days;

public:Antibiotics();void enterdetails();void showdetails();

}; i) What will be the size of an object (in bytes) of class Medicines and an object of class Antibiotics respectively?ii) Name the members functions which can be accessed from the object of class Antibioticsiii) Name the members which can be accessible by the member function of class Capsules. iv) Name all the data members which are accessible from objects of class Antibiotics

Ans i) 40 bytes & 118 bytes respectively(ii) Medicines( ),entermedicinedetails( ), showmedicinedetails( ),Capsules( ), entercapsuledetails( ),showcapsuledetails( ), Antibiotics( ),enterdetails( ), showdetails( ).(iii) Data Members:capsule_name,volume_label,price Member Functions:Medicines( ),entermedicinedetails( ),

showmedicinedetails( ),capsules( ), entermedicinedetails( ),showcapsuledetails( ).(iv) Price

3 A Write a function in C++ to merge the contents of two arrays A and B into third array C. The resultant array C is required to be in ascending order.

[3]

Ans void func(int A[], int s1, int B[], int s2){

int *C=new int [s1 * s2];int i, j=0for(i=0; i<s1; i++){C[i]=A[i];}for(I; i<(s1+s2); i++)

{C[i]=B[j];j++;}

Page 29: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

29

// now sort the third array or could use merge sort technique.

B An array A[1..15][1..8] is stored in the memory column wise with each of its element occupying 4 bytes. Find out he base address and the address of the element at A[3][2], If the location of A[5][7] is stored at address 2500

[3]

Ans A[I][J]=B+W((I-LR)+NR(J-LC))A[5][7]=B+4((5-1)+15(7-1))B=2500-376=2124A[3][2]=2124+4((3-1)+15(2-1))Answer= 2192

C Define a function Stackpush( ) in C++ to insert node and StackPop( ) to delete a node, for linked list implementation of a stack having the following structure .

struct Node{

char name[20]; int age;Node *Link;

} ;class STACK{

Node *Top, *newptr;public :

void STACK( ) { Top=NULL; }void Stackpush( ) ;void StackPop( );~ STACK( );

};

[4]

Ans void STACK:: Stackpush(){STACK s;s.newptr=new Node;cout<<”\n Enter Name”;gets(s.newptr->name);cout<<”\nEnter age”;cin>> s.newptr->age;s.newptr->link=NULL;if(s.top==NULL)s.top=s.newptr;else{s.newptr->link=s.top;s.top=s.newptr;}void STACK:: Stackpop(){STACK s;Node *save;Save=s.top;if(s.top==NULL)cout<<”\n Under flow”;else{s.top=s.top->link;}delete save;

Page 30: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

30

}D Write a function in C++ to find the sum of both left and right diagonal elements

from a two dimensional array (Assuming 2D Array to be a square matrix with odd dimension matrix

(i.e 3x3, 5x5,7x7….etc).

If the array is 2 3 11 5 3

6 7 8The Output should be The Sum of Diagonal 1: 15

The Sum of Diagonal 2: 12

[2]

Ans void DiagSum(int A[100][100],int N){int SumD1=0,SumD2=0;

for (int I=0;I<N;I++){

SumD1+=A[I][I];SumD2+=A[N-I-1][I];

} cout<<”Sum of Diagonal 1:”<<SumD1<<endl; cout<<”Sum of Diagonal 2:”<<SumD2<<endl;}

E Translate into Postfix form A + [ (B + C) + (D +E) * F ] / G

[2]

Ans correct Postfix form ABC+DE+F*+G/+4 A Observe the program segment given below carefully and fill the blanks marked as

Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task.

#include <fstream.h>class Employee{ int Eno; char Ename[20];public:

int Countrec(); //Function to count the total number of records};int Employee::Countrec(){ fstream File;

File.open(“EMP.DAT”,ios::binary|ios::in);________________________ //Statement 1

int Bytes = ______________________ //Statement 2int Count = Bytes / sizeof(Item);File.close();

return Count;}

[1]

Ans File.seekg(0,ios::end); //Statement 1File.tellg(); //Statement 2

B Write a function to count the number of alphabets present in a text file “NOTES.TXT”.

[2]

Ans void CountAlphabet(){

ifstream FIL(“NOTES.TXT”);

Page 31: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

31

int CALPHA=0;char CH=FIL.get();while (!FIL.eof()){

if (isalpha(CH)) CALPHA++;CH=FIL.get();

}cout<<”No. of Alphabets:”<<CALPHA<<endl;

FIL.close();}

C Write a function in C++ to search for a BookNo from a binary file “BOOK.DAT”, assuming the binary file is containing the objects of the following class.

class BOOK{

int Bno;char Title[20];

public:int RBno() {return Bno; }void Enter() {cin>>Bno; gets(Title); }void Display() {cout<<Bno<<Title<<endl; }

};

[3]

Ans void BookSearch(){ fstream FIL;

FIL.open(“BOOK.DAT”,ios::binary|ios::in);BOOK B;int bn,Found=0;cout<<”Enter Book Num to search…”;cin>>bn;while (FIL.read((char*)&S,sizeof(S))) if (B.RBno()==bn)

{ B.Display();Found++;

}if (Found==0) cout<<”Sorry! Book not found!!!”<<endl; FIL.close();

}5 A Differentiate between DDL and DML ? Give examples [2]

Ans DDL- Data Definition Language(It is use to create or alter tables in MySQL) ex: create, alterDML-Date Manipulation Language (DML commands are used to manipulate the records of table ex: select, update, insert, and delete etcs.

B Consider the following tables ACTIVITY and COACH. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)

Table: ACTIVITYACode ActivityName ParticipantsNum PrizeMoney ScheduleDate

1001 Relay 100x4 16 10000 23-Jan-2004

1002 High jump 10 12000 12-Dec-2003

1003 Shot Put 12 8000 14-Feb-2004

[6]

Page 32: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

32

1005 Long Jump 12 9000 01-Jan-2004

1008 Discuss Throw 10 15000 19-Mar-2004

Table: COACHPCode Name ACode

1 Ahmad Hussain 1001

2 Ravinder 1008

3 Janila 1001

4 Naaz 1003

(i) To display the name of all activities with their Acodes in descending order.(ii) To display sum of PrizeMoney for each of the Number of participants groupings (iii) To display the coach’s name and ACodes in ascending order of ACode from the table COACH(iv) To display the content of the ACTIVITY table whose ScheduleDate earlier than 01/01/2004 in ascending order of ParticipantsNum.(v) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;(vi) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY;(vii) SELECT SUM(PrizeMoney) FROM ACTIVITY;(viii) SELECT DISTINCT ParticipantsNum FROM ACTIVITY;

Ans i) SELECT ActivityName, ACode FROM ACTIVITY ORDER BY Acode DESC;ii) SELECT SUM(PrizeMoney),ParticipantsNum FROM ACTIVITY GROUP

BY ParticipantsNum;iii) SELECT Name, ACode FROM COACH ORDER BY ACode;iv) SELECT * FROM ACTIVITY WHERE ScheduleDate<’01-Jan-2004’ ORDER

BY ParticipantsNum;v) 3vi) 19-Mar-2004 12-Dec-2003vii) 54000viii) 16

1012

6 A State and algebraically verify Absorption Laws [2]Ans Algebraic proof in steps

B Write the equivalent Boolean Expression for the following circuit [2]

Ans x' + y’z’C Convert (X '+ Y+ Z') . (X '+ Y+ Z) . (X '+ Y'+ Z) . (X '+ Y'+ Z') into [1]

Page 33: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

33

canonical Sum of Products (SOP) form

Ans x’y’z’+ x’y’z + x’yz’+ x’yz + xy’z

D Reduce the Boolean Expression using K-MapF (A,B,C,D)= Σ ( 0,2,3,4,6,7,8,10,12)

[3]

Ans C’D’+A’C+B’D’7 A What is the significance of ARPANET in the network? [1]

Ans The first evolution of network was jointly designed by The Advanced Research Projects Agency (ARPA) and Department of Defence (DoD) in 1969 and was called ARPANET. It was an experimental project, which connected a few computers of some of the reputed universities of USA and DoD. ARPANET allowed access and use of computer resource sharing projects. Later Defence Data Network (DDN) was born in 1983.

B Expand the following terminologies:(i) CDMA (ii) GSM(iii) TCP/IP (iv) HTTP

[1]

Ans (i) CDMA Code Division Multiple Access (ii) GSM Global System for Mobile Communications(iii) TCP/IP Transmission Control Protocol/ Internet Protocol(iv) HTTP Hyper Text Transfer Protocol

C Differentiate between XML and HTML. [1]Ans Any two difference between XML and HTML

XML was designed to describe data and to focus on what data is, HTML was designed to display data and to focus on how data looks.XML is not a version of HTML.HTML is about displaying information while XML is about describing information.

D What is the purpose of using a Web Browser? Name any 2 commonly used Web Browser.

[1]

Ans The Web Browser fetches the page requested, interprets the text and formatting commands that it contains, and displays the page properly formatted on the screen. Example of a Web Browser:Mozilla Firefox OR Internet Explorer OR Netscape Navigator OR Safari OR OPERA

E Knowledge Supplement Organisation has set up its new center at Mangalore for its office and web based activities. It has 4 blocks of buildings as shown in the diagram below:

Center to center distances between various blocksBlack A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

[3]

Page 34: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

34

Block A to Block C 90 m

Number of ComputersBLOCK No of Computers

Black A 25

Block B 50

Block C 125

Block D 10

e1) Suggest a cable layout of connections between the blocks.e2) Suggest the most suitable place (i.e. block) to house the server of this organisation with a suitable reason.e3) Suggest the placement of the following devices with justification

(i) Repeater (ii) Hub/Switch

Ans e1)

e2) The most suitable place / block to house the server of this organisation would be Block C, as this block contains the maximum number of computers, thus decreasing the cabling cost for most of the computers as well as increasing the efficiency of the maximum computers in the network.e3) For Layout 1, since the cabling distance between Blocks A and C, and that between B and C are quite large, so a repeater each, would ideally be needed along their path to avoid loss of signals during the course of data flow in these routes

For layout 2, since the distance between Blocks A and C is large so a repeater would ideally be placed in between this path

Page 35: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

35

In the layouts, a hub/switch each would be needed in all the blocks, to interconnect the group of cables from the different computers in each block:

F Name two Proprietary softwares along with their application [1]

Ans Correct Defn with their application

G How are Trojan Horses are different from Worms? Mention any one difference. [1]Ans Correct DifferenceH Out of the following, identify client side script(s) and server side script(s).

i) java script ii) ASP iii) vb script iv) PHP

[1]

Ans client side are – java script , vb scriptserver side are – ASP, PHP

Page 36: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

36

SET III

COMPUTER SCIENCE (Theory)

Class XII - Code : 083

Blue P rint

S.No. UNIT VSA(1 Mark)

SA I(2 Marks)

SA II(3 Marks)

LA(4 Marks)

TOTAL

1 Review of C++ covered in Class XI 1 (1) 8 (4) 3 (1) 12 (6)

2 Object Oriented Programming in C++

a) Introduction to OOP using C++

b) Constructor & Destructor

c) Inheritance

2 (1)

2 (1)

4 (1)

4 (1)

6 (2)

2 (1)

4 (1)

3 Data Structure & Pointers

a) Address Calculation 3 (1) 3 (1)

b) Static Allocation of Objects 2 (1) 3 (1) 5 (2)

c) Dynamic Allocation of Objects 4 (1) 4 (1)

d) Infix & Postfix Expressions 2 (1) 2 (1)

4 Data File Handling in C++

a) Fundamentals of File Handling 1 (1) 1 (1)

b) Text File 2 (1) 2 (1)

c) Binary Files 3 (1) 3 (1)

5 Databases and SQL

a) Database Concepts 2 (1) 2 (1)

b) Structured Query Language 2 (1) 4 (1) 6 (2)

Page 37: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

37

6 Boolean Algebra

a) Introduction to Boolean Algebra & Laws

b) SOP & POS

c) Karnaugh Map

d) Basic Logic Gates

2 (1) 2 (1)

1 (1) 1 (1)

3 (1) 3 (1)

2 (1) 2 (1)

7 Communication & Open Source Concepts

a) Introduction to Networking

b) Media,Dvices,Topologies & Protocols

c) Security

d) Webservers

e) Open Source Terminologies

2 (2) 2 (2)

4 (1) 4 (1)

2 (2) 2 (2)

1 (1) 1 (1)

1 (1) 1 (1)

TOTAL 9 (9) 26 (13) 15 (5) 20 (5) 70 (32)

Page 38: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

38

SET III

CLASS 12

SUBJECT:-Computer Science (083)

SAMPLE PAPER

Max. Marks: 70 Duration: 3 Hours

Note: All questions are compulsory.1.

(a) What is the difference between Object Oriented Programming and Procedural Programming? 2

(b) Write the names of the header files to which the following belong:1

(i) strcpy() (ii) setw()

(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction.

2

#include <iostream.h>

struct Pixels

{ int Color,Style;}

void ShowPoint(Pixels P)

{ cout<<P.Color,P.Style<<endl;}

void main()

{

Pixels Point1=(5,3);

ShowPoint(Point1);

Pixels Point2=Point1;

Color.Point1+=2;

ShowPoint(Point2);

}

(d) Find the output of the following program:3

#include <iostream.h>

Page 39: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

39

void Changethecontent(int Arr[], int Count)

{

for (int C=1;C<Count;C++)

Arr[C-1]+=Arr[C];

}

void main()

{

int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200};

Changethecontent(A,3);

Changethecontent(B,4);

Changethecontent(C,2);

for (int L=0;L<3;L++) cout<<A[L]<<’#’;

cout<<endl;

for (L=0;L<4;L++) cout<<B[L] <<’#’;

cout<<endl;

for (L=0;L<2;L++) cout<<C[L] <<’#’;

}

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

#include <iostream.h>

struct Game

{

char Magic[20];int Score;

};

void main()

{

Game M={“Tiger”,500};

char *Choice;

Choice=M.Magic;

Choice[4]=’P’;

Choice[2]=’L’;

M.Score+=50;

Page 40: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

40

cout<<M.Magic<<M.Score<<endl;

Game N=M;

N.Magic[0]=’A’;N.Magic[3]=’J’;

N.Score-=120;

cout<<N.Magic<<N.Score<<endl;

}

(f) In the following program, if the value of N given by the user is 20, what maximum and minimum values the program could possibly display?

2

#include <iostream.h>#include <stdlib.h>void main(){

int N,Guessnum; randomize(); cin>>N; Guessnum=random(N-10)+10; cout<<Guessnum<<endl;

}2.

(a) What do you understand by Polymorphism? Give a suitable example of the same. 2

(b) Answer the questions (i) and (ii) after going through the following program: 2

class Match

{

int Time;

public:

Match() //Function 1

{

Time=0;

cout<<”Match commences”<<end1;

}

void Details() //Function 2

{

cout<<”Inter Section Basketball Match”<<end1;

}

Page 41: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

41

Match(int Duration) //Function 3

{

Time=Duration;

cout<<”Another Match begins now”<<end1;

}

Match(Match &M) //Function 4

{

Time=M.Duration;

cout<<”Like Previous Match ”<<end1;

}

};

i) Which category of constructor - Function 4 belongs to and what is the purpose of using it?ii) Write statements that would call the member Functions 1 and 3.

(c) Define a class in C++ with following description:4

Private Members

a. A data member Flight number of type integerb. A data member Destination of type stringc. A data member Distance of type floatd. A data member Fuel of type floate. A member function CALFUEL() to calculate the value of Fuel as per the following criteria

Distance Fuel

<=1000 500

more than 1000 and <=2000 1100

more than 2000 2200

Public Members

A function FEEDINFO() to allow user to enter values for Flight Number, Destination, Distance & call function CALFUEL() to calculate the quantity of Fuel

A function SHOWINFO() to allow user to view the content of all the data members

(d) Answer the questions (i) to (iv) based on the following:4

class CUSTOMER

{

int Cust_no;

Page 42: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

42

char Cust_Name[20];

protected:

void Register();

public:

CUSTOMER();

void Status();

};

class SALESMAN

{

int Salesman_no;

char Salesman_Name[20];

protected:

float Salary;

public:

SALESMAN();

void Enter();

void Show();

};

class SHOP : private CUSTOMER , public SALESMAN

{

char Voucher_No[10];

char Sales_Date[8];

public:

SHOP();

void Sales_Entry();

void Sales_Detail();

};

i. Write the names of data members which are accessible from objects belonging to class CUSTOMER.

ii. Write the names of all the member functions which are accessible from objects belonging to class SALESMAN.

iii. Write the names of all the members which are accessible from member functions of class SHOP.iv. How many bytes will be required by an object belonging to class SHOP?

Page 43: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

43

3.

(a) Write a function in C++ to combine the contents of two equi-sized arrays A and B by computing their corresponding elements with the formula 2*A[i]+3*B[i]; where value i varies from 0 to N-1 and transfer the resultant content in the third same sized array.

3

(b) An array P[20][30] is stored in the memory along the column with each of the element occupying 4 bytes, find out the memory location for the element P[5][15], if an element P[2][20] is stored at the memory location 5000.

3

(c) Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real numbers.

4

(d) Write a function in C++ to find sum of rows from a two dimensional array.2

(e) Evaluate the following postfix notation of expression:2

True, False, AND, True, True, NOT, OR, AND

4.

(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task.

1

#include <fstream.h>

class Employee

{

int Eno;char Ename[20];

public:

//Function to count the total number of records

int Countrec();

};int Item::Countrec()

{

fstream File;

File.open(“EMP.DAT”,ios::binary|ios::in);

Page 44: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

44

______________________ //Statement 1

int Bytes = ______________________ //Statement 2

int Count = Bytes / sizeof(Item);

File.close();

return Count;

}

(b) Write a function in C++ to count the number of alphabets present in a text file “NOTES.TXT”. 2

(b) Write a function in C++ to add new objects at the bottom of a binary file “STUDENT.DAT”, assuming the binary file is containing the objects of the following class.

3

class STUD

{

int Rno;

char Name[20];

public:

void Enter(){cin>>Rno;gets(Name);}

void Display(){cout<<Rno<<Name<<endl;}

};

void Addnew()

{

fstream FIL;

FIL.open(“STUDENT.DAT”,ios::binary|ios::app);

STUD S;

char CH;

do

{

S.Enter();

FIL.write((char*)&S,sizeof(S));

Page 45: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

45

cout<<”More(Y/N)?”;cin>>CH;

}

while(CH!=’Y’);

FIL.close();

}

5.

(a) What do you understand by Primary Key & Alternate Keys? 2

(b) Consider the following tables GAMES and PLAYER. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)

6

Table: GAMES

GCode GameName Number PrizeAmt ScheduleDate

101 Carom Board 2 5000 23-Jan-2004

102 Cricket 2 12000 12-Dec-2003

103 Table Tennis 4 8000 14-Feb-2004

105 Kho Kho 2 9000 01-Jan-2004

108 Lawn Tennis 4 25000 19-Mar-2004

Table: PLAYER

PCode Name Gcode

1 Nabi Ahmad 101

2 Ravi Sahai 108

3 Jatin 101

4 Nazneen 103

(i) To display the name of all Games with their Gcodes

(ii) To display details of those games which are having PrizeMoney more than 7000.

(iii) To display the content of the GAMES table in ascending order of ScheduleDate.

Page 46: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

U

V

46

(iv) To display sum of PrizeAmt for each of the Number of participation groupings (as shown in column Number 2 or 4)

v. SELECT COUNT(DISTINCT Number) FROM GAMES;

(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;

(vii) SELECT SUM(PrizeAmt) FROM GAMES;

(viii) SELECT DISTINCT Gcode FROM PLAYER;

6.

(a) State and algebraically verify Absorbtion Laws.2

(b) Write the equivalent Boolean Expression for the following Logic Circuit` 2

(c) Write the SOP form of a Boolean function G, which is represented in a truth table as follows:1

P Q R G

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

Page 47: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

47

1 1 1 1

(d) Reduce the following Boolean Expression using K-Map:3

F(U,V,W,Z)=(0,1,2,4,5,6,8,10)

7. a) Define the term Bandwidth. Give unit of Bandwidth.1

b) Expand the following terminologies:1

(i) HTML (ii) XML

c) Define the term firewall.1

d) What is the importance of URL in networking?1

e)Ravya Industries 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:

Center to center distances between various buildings is as follows:

Harsh Building to Raj Building 50 m

Raz Building to Fazz Building 60 m

Fazz Building to Jazz Building 25 m

Jazz Building to Harsh Building 170 m

Harsh Building to Fazz Building 125 m

Raj Building to Jazz Building 90 m

Number of Computers in each of the buildings is follows:

Raj Building

Fazz

Building

Harsh Buildi

ng

Jazz

Building

Page 48: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

48

Harsh Building 15

Raj Building 150

Fazz Building 15

Jazz Bulding 25

e1) Suggest a cable layout of connections between the buildings.1

e2) Suggest the most suitable place (i.e. building) to house the server of this organisation with a suitable reason.

1

e3) Suggest the placement of the following devices with justification:1

(i) Internet Connecting Device/Modem(ii) Switch

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.

1

f ) What is spam mail ? 1

g) What is firewall ? 1

-----xx-----

SET-III

Computer Science(083)

Marking Scheme

Max. Marks: 70 CLASS 12Duration: 3 Hours

1. (a) What is the difference between Object Oriented Programming and Procedural Programming? 2

Answer:

Object Oriented Programming Procedural Programming

Emphasis on Data Follows Bottom-Up approach in

program design Data hiding feature prevents accidental

change in data

Emphasis on doing things (functions) Follows Top-down approach in

program design Presence of Global variables

increase chances of accidental change in data

Such features are not available

Page 49: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

49

Features like data encapsulation, polymorphism, inheritance are present

(1/2 Mark for each point of difference – to maximum of 2 marks)

(b) Write the names of the header files to which the following belong:1

(i) strcpy() (ii) setw()

Answer:

(i) string.h (ii) iomanip.h

(1/2 Mark for mentioning name of each header file)

(e) Rewrite the following program after removing the syntactical errors (if any). Underline each correction.

2#include <iostream.h>

struct Pixels

{ int Color,Style;}

void ShowPoint(Pixels P)

{ cout<<P.Color,P.Style<<endl;}

void main()

{

Pixels Point1=(5,3);

ShowPoint(Point1);

Pixels Point2=Point1;

Color.Point1+=2;

ShowPoint(Point2); }

Answer:

#include <iostream.h>

struct Pixels

{ int Color,Style;};

void ShowPoint(Pixels P)

{ cout<<P.Color<<P.Style<<endl;}

void main()

Page 50: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

50

{

Pixels Point1={5,3};

ShowPoint(Point1);

Pixels Point2=Point1;

Point1.Color+=2;

ShowPoint(Point2);

}

(1/2 Mark for correcting each error)

OR

(1 Mark for identifying all the 4 errors with no correction)

(d) Find the output of the following program:3

#include <iostream.h>

void Changethecontent(int Arr[], int Count)

{

for (int C=1;C<Count;C++)

Arr[C-1]+=Arr[C];

}

void main()

{

int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200};

Changethecontent(A,3);

Changethecontent(B,4);

Changethecontent(C,2);

for (int L=0;L<3;L++) cout<<A[L]<<’#’;

cout<<endl;

for (L=0;L<4;L++) cout<<B[L] <<’#’;

cout<<endl;

for (L=0;L<2;L++) cout<<C[L] <<’#’;

}

Page 51: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

51

Answer:

7#9#5#

30#50#70#40#

2100#1200#

(1 Mark for each correct line of output)

Note:

Deduct ½ Mark for not showing : in the output

Deduct ½ Mark for not considering endl

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

#include <iostream.h>

struct Game

{

char Magic[20];int Score;

};

void main()

{

Game M={“Tiger”,500};

char *Choice;

Choice=M.Magic;

Choice[4]=’P’;

Choice[2]=’L’;

M.Score+=50;

cout<<M.Magic<<M.Score<<endl;

Game N=M;

N.Magic[0]=’A’;N.Magic[3]=’J’;

N.Score-=120;

cout<<N.Magic<<N.Score<<endl;

}

Answer:

TiLeP550

AiLJP430

Page 52: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

52

(1 Mark for each line of output)

(f) In the following program, if the value of N given by the user is 20, what maximum and minimum values the program could possibly display?

2

#include <iostream.h>#include <stdlib.h>void main(){

int N,Guessnum; randomize(); cin>>N; Guessnum=random(N-10)+10; cout<<Guessnum<<endl;

}

Answer:

Maximum Value: 19 Minimum Value: 10

(1 Mark for writing correct minimum value)

(1 Mark for writing correct maximum value)

2. (a) What do you understand by Polymorphism? Give a suitable example of the same. 2

Answer:

Polymorphism: It is a method of using the same operator or function (method) to work using different sets of input. Function overloading is one of the example of polymorphism, where more than one function carrying same name behave differently with different set of parameters passed to them.

void Display()

{

cout<<”Hello!”<<endl;

}

void Display(int N)

{

cout<<2*N+5<<endl;

}

Page 53: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

53

(1 Mark for definition)

(1 Mark for example)

OR

(Full 2 marks for explaining both with the help of an example)

(b) Answer the questions (i) and (ii) after going through the following program:2

class Match

{

int Time;

public:

Match() //Function 1

{

Time=0;

cout<<”Match commences”<<end1;

}

void Details() //Function 2

{

cout<<”Inter Section Basketball Match”<<end1;

}

Match(int Duration) //Function 3

{

Time=Duration;

cout<<”Another Match begins now”<<end1;

}

Match(Match &M) //Function 4

{

Time=M.Duration;

cout<<”Like Previous Match ”<<end1;

Page 54: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

54

}

};

(i) Which category of constructor - Function 4 belongs to and what is the purpose of using it?

Answer:

Copy Constructor, it is invoked when an object is created and initialised with values of an already existing object.

( ½ Mark for mentioning “Constructor”)

( ½ Mark for correctly answering to remaining part of the question)

(ii) Write statements that would call the member Functions 1 and 3.Answer:

Match M1; //for Function 1

Match M2(90); //for Function 3

( ½ Mark for each example)

(c) Define a class in C++ with following description:4

Private Members

a. A data member Flight number of type integerb. A data member Destination of type stringc. A data member Distance of type floatd. A data member Fuel of type floate. A member function CALFUEL() to calculate the value of Fuel as per the following criteria

Distance Fuel

<=1000 500

more than 1000 and <=2000 1100

more than 2000 2200Public Members:

A function FEEDINFO() to allow user to enter values for Flight Number, Destination, Distance & call function CALFUEL() to calculate the quantity of Fuel

A function SHOWINFO() to allow user to view the content of all the data membersAnswer:

class FLIGHT

Page 55: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

55

{

int Fno;

char Destination[20];

float Distance, Fuel;

void CALFUEL();

public:

void FEEDINFO();

void SHOWINFO();

};

void FLIGHT::CALFUEL()

{

if (Distance<1000)

Fuel=500;

else

if (Distance<2000)

Fuel=1100;

else

Fuel=2200;

}

void FLIGHT::FEEDINFO()

{

cout<<”Flight No :”;cin>>Fno;

cout<<”Destination :”;gets(Destination);

cout<<”Distance :”;cin>>Distance;

CALFUEL();

}

void FLIGHT::SHOWINFO()

{

cout<<”Flight No :”<<Fno<<endl;

cout<<”Destination :”<<Destination<<endl;

cout<<”Distance :”<<Distance<<endl;;

cout<<”Fuel :”<<Fuel<<endl;;

Page 56: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

56

}

(1 Mark for correctly declaring Data Members)

(1 Mark for correctly defining CALFUEL())

( ½ Mark for correctly defining FEEDINFO())

( ½ Mark for calling CALFUEL() from FEEDINFO())

( ½ Mark for correctly defining SHOWINFO())

( ½ Mark for correct syntax of class)

(d) Answer the questions (i) to (iv) based on the following:4

class CUSTOMER

{

int Cust_no;

char Cust_Name[20];

protected:

void Register();

public:

CUSTOMER();

void Status();

};

class SALESMAN

{

int Salesman_no;

char Salesman_Name[20];

protected:

float Salary;

public:

SALESMAN();

void Enter();

void Show();

};

class SHOP : private CUSTOMER , public SALESMAN

Page 57: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

57

{

char Voucher_No[10];

char Sales_Date[8];

public:

SHOP();

void Sales_Entry();

void Sales_Detail();

};

(i) Write the names of data members which are accessible from objects belonging to class CUSTOMER.(ii) Write the names of all the member functions which are accessible from objects belonging to class

SALESMAN.

(iii) Write the names of all the members which are accessible from member functions of class SHOP.

(iv) How many bytes will be required by an object belonging to class SHOP?Answer:

(i) None of data members are accessible from objects belonging to class CUSTOMER.(ii) Enter(), Show()(iii) Data members: Voucher_No, Sales_Date, Salary Member function: Sales_Entry(), Sales_Details(), Enter(), Show(), Register(), Status()

(iv) 66

( 1 Mark for each correct answer)

Note:

No marks to be given for partial answers

3.

(a) Write a function in C++ to combine the contents of two equi-sized arrays A and B by computing their corresponding elements with the formula 2*A[i]+3*B[i]; where value i varies from 0 to N-1 and transfer the resultant content in the third same sized array.

3

Answer:

void AddNSave(int A[],int B[],int C[],int N)

{

for (int i=0;i<N;i++)

C[i]=2*A[i]+3*B[i];

}

(1 Mark for function header with desired parameters)

(1 Mark for correct formation of loop)

Page 58: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

58

(1 Mark for the formula)

(1 Mark for transferring elements in the resultant array)

(b) An array P[20][30] is stored in the memory along the column with each of the element occupying 4 bytes, find out the memory location for the element P[5][15], if an element P[2][20] is stored at the memory location 5000.

3

Answer:

Given,

W=4

N=20

M=30

Loc(P[2][20])=5000

Column Major Formula:

Loc(P[I][J]) =Base(P)+W*(N*J+I)

Loc(P[2][20]) =Base(P)+4*(20*20+2)

5000 =Base(P)+4*(400+2)

Base(P) =5000- 1608

Base(P) =3392

Loc(P[5][15]) =3392+4*(20*15+5)

=3392+4*(300+5)

=3392+1220

=4612

(1/2 Mark for correct formula/substitution of values in formula)

(1 ½ Mark for correctly calculating Base Address)

(2 Mark for correctly calculating address of desired location)

(c) Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real numbers.

4

Answer:

struct NODE

{

float Data; NODE *Link;

Page 59: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

59

};

class STACK

{

NODE *Top;

public:

STACK();

void Push();

void Pop();

};

void STACK::Push()

{

NODE *Temp;

Temp=new NODE;

cin>>Temp->Data;

Temp->Link=Top;

Top=Temp;

}

( ½ Mark for appropriate function header)

( ½ Mark for declaring a Temporary pointer - TEMP)

(1 Mark for new operation)

(1 Mark for Temp->Link to Top)

(1 Mark for assigning Top as Temp)

(d) Write a function in C++ to find sum of rows from a two dimensional array.2

Answer:

void MatAdd(int A[100][100],int N,int M)

{

for (int R=0;R<N;R++)

{

int SumR=0;

for (int C=0;C<M;C++)

SumR+=A[C][R];

Page 60: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

60

cout<<SumR<<endl;

}

}

( ½ Mark for initialization of desired variables)

(1 Mark for loops)

( ½ Mark for statement to add rows elements)

(e) Evaluate the following postfix notation of expression:2

True, False, AND, True, True, NOT, OR, AND

Answer:

Step 1: Push

True

Step 2: Push

False

True

Step 3: ANDPush

Pop Pop

Op2=True Op1=False

Op2=True

True False

Step 4: Push

True

False

Page 61: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

61

Step 5: Push

True

True

False

Step 6: NOT Push

Pop

Op2=True False

True True

False False

Step 7: ORPush

Pop Pop

Op2=False Op1=True

True Op2=False True

False False False

Step 8: ANDPush

Pop Pop

Op2=True Op1=False

Op2=True

False False

Step 9: Pop

Result

False

( 1½ Mark for showing stack position for operations NOT,OR and AND)

( ½ Mark for correctly evaluating the final result)

4.

Page 62: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

62

(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task.

1

#include <fstream.h>

class Employee

{

int Eno;char Ename[20];

public:

//Function to count the total number of records

int Countrec();

};int Item::Countrec()

{

fstream File;

File.open(“EMP.DAT”,ios::binary|ios::in);

______________________ //Statement 1

int Bytes = ______________________ //Statement 2

int Count = Bytes / sizeof(Item);

File.close();

return Count;

}

Answer:

File.seekg(0,ios::end); //Statement 1

File.tellg(); //Statement 2

( ½ Mark for each correct statement)

(b) Write a function in C++ to count the number of alphabets present in a text file “NOTES.TXT”.2

Answer:

void CountAlphabet()

Page 63: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

63

{

ifstream FIL(“NOTES.TXT”);

int CALPHA=0;

char CH=FIL.get();

while (!FIL.eof())

{

if (isalpha(CH)) CALPHA++;

CH=FIL.get();

}

cout<<”No. of Alphabets:”<<CALPHA<<endl;

FIL.close();

}

( ½ mark for opening the file in ‘in’ mode)

( ½ mark for correct use of eof)

( ½ mark for reading each character)

( ½ mark for correct increment)

(c) Write a function in C++ to add new objects at the bottom of a binary file “STUDENT.DAT”, assuming the binary file is containing the objects of the following class.

3

class STUD

{

int Rno;

char Name[20];

public:

void Enter(){cin>>Rno;gets(Name);}

void Display(){cout<<Rno<<Name<<endl;}

};

Answer:

void Addnew()

{

fstream FIL;

Page 64: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

64

FIL.open(“STUDENT.DAT”,ios::binary|ios::app);

STUD S;

char CH;

do

{

S.Enter();

FIL.write((char*)&S,sizeof(S));

cout<<”More(Y/N)?”;cin>>CH;

}

while(CH!=’Y’);

FIL.close();

}

( ½ mark for opening the file in ‘app’ mode)

( ½ mark for declaration of desired variables)

( ½ mark for calling the member function Enter correctly)

( 1 mark for writing the content of object to the binary file)

( ½ mark for forming the appropriate loop)

5.

(a) What do you understand by Primary Key & Alternate Key?2

Answer:

An attribute or set attributes which are used to identify a tuple uniquely is known as Primary Key. All the candidate keys that are not primary key are called alternate key.

(b) Consider the following tables GAMES and PLAYER. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)

6

Table: GAMES

GCode GameName Number PrizeAmt ScheduleDate

101 Carom Board 2 5000 23-Jan-2004

102 Cricket 2 12000 12-Dec-2003

Page 65: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

65

103 Table Tennis 4 8000 14-Feb-2004

105 Kho Kho 2 9000 01-Jan-2004

108 Lawn Tennis 4 25000 19-Mar-2004

Table: PLAYER

PCode Name Gcode

1 Nabi Ahmad 101

2 Ravi Sahai 108

3 Jatin 101

4 Nazneen 103

(i) To display the name of all Games with their Gcodes

Answer:

SELECT GameName,Gcode FROM GAMES;

(1 mark for correct SELECTion of columns)

(ii) To display details of those games which are having PrizeMoney more than 7000.

Answer:

SELECT * FROM GAMES WHERE PrizeMoney>7000( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of WHERE)

(iii) To display the content of the GAMES table in ascending order of ScheduleDate.

Answer:

SELECT * FROM GAMES ORDER BY ScheduleDate;

( ½ mark for correct SELECTion of columns)

( ½ mark for correct use of ORDER BY)

(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as shown in column Number 2 or 4)

Answer:

SELECT SUM(PrizeAmt),Number FROM GAMES GROUP BY Number;

( ½ mark for correct SELECTion of columns)

Page 66: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

66

( ½ mark for correct use of GROUP BY)

(v) SELECT COUNT(DISTINCT Number) FROM GAMES;Answer:

2

( ½ mark for correct output)

(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;

Answer:

19-Mar-2004 12-Dec-2003

( ½ mark for correct output)

(vii) SELECT SUM(PrizeAmt) FROM GAMES;

Answer:

59000

( ½ mark for correct output)

(viii) SELECT DISTINCT Gcode FROM PLAYER;

Answer:

101

103

108

( ½ mark for correct output)

6. (a) State and algebraically verify Absorbtion Laws.2

Answer:

X+X.Y = X

L.H.S = X+X.Y

= X.1+X.Y

= X.(1+Y)

= X.1

= X

Page 67: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

U

V

67

= R.H.S

X+X’.Y = X+Y

L.H.S. = X+X’.Y

= (X+X’).(X+Y)

= 1.(X+Y)

= X+Y

= R.H.S

(1 mark for stating the correct law)

(1 mark for the appropriate verification using algebraic method)

(b) Write the equivalent Boolean Expression for the following Logic Circuit2

Answer:

F(U,V)=U’.V+U.V’

(Full 2 marks for obtaining the correct Boolean Expression for the Logic Circuit)

OR

(1 mark correctly interpreting Product terms)

(c) Write the SOP form of a Boolean function G, which is represented in a truth table as follows:1

Answer:

P Q R G

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

Page 68: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

68

1 1 1 1

G(P,Q,R) = P’.Q.R’+P.Q’.R’+P.Q.R’+P.Q.R

(1 mark for correct SOP representation)

(d) Reduce the following Boolean Expression using K-Map:3

F(U,V,W,Z)=(0,1,2,4,5,6,8,10)

Answer:

U’V’ U’V UV UV’

W’Z’

0 4

1

12 8

W’Z

1 5

1

13

1

9

WZ 1

3

1

7

1

15

1

11

WZ’

2 6

1

14 10

F(U,V,W,Z)=UV+WZ+UZ

(1 mark for correctly drawing K-Map with 1s represented on right places)

(1 mark for minimizing each Quad)

(1 mark for writing the complete Boolean Expression)

7.

a) Define the term Bandwidth. Give unit of Bandwidth.1

Answer:

Bandwidth is the capability of a medium to transmit an amount of information over a distance. Bandwidth of a medium is generally measured in bits per second (bps) or more commonly in kilobits per second (kbps)

( ½ Mark for correct definition and ½ Mark for correct unit)

Page 69: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

69

b) Expand the following terminologies:1

(i) HTML (ii) XML

Answer:

(i) Hypertext Markup Language(ii) Extended Markup Language

( ½ Mark for each correct expansion)

c) Define the term firewall.1

Answer:

Firewall is a feature used for Network Security. In a Network there is always danger of information leaking out or leaking in. Firewall is a feature which forces all information entering or leaving the network to pass through a check to make sure that there is no unauthorized usage of the network.

(1 Mark for correct definition)

d) What is the importance of URL in networking?1

Answer:

URL stands for Uniform Resource Locator. Each page that is created for Web browsing is assigned a URL that effectively serves as the page’s worldwide name or address. URL’s have three parts: the protocol , the DNS name of the machine on which the page is located and a local name uniquely indicating the specific page(generally the filename).

(1 Mark for correct significance)

e) Ravya Industries 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:

Raj Building

Fazz

Building

Harsh Buildi

ng

Jazz

Building

Page 70: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

Raj B

uild

ing

Fazz

Build

ing

Hars

h Bu

ildin

g

Jazz

Build

ing

Raj B

uild

ing

Fazz

Build

ing

Har

sh B

uild

ing

Jazz

Build

ing

70

Center to center distances between various buildings is as follows:

Harsh Building to Raj Building 50 m

Raz Building to Fazz Building 60 m

Fazz Building to Jazz Building 25 m

Jazz Building to Harsh Building 170 m

Harsh Building to Fazz Building 125 m

Raj Building to Jazz Building 90 m

Number of Computers in each of the buildings is follows:

Harsh Building 15

Raj Building 150

Fazz Building 15

Jazz Bulding 25

e1) Suggest a cable layout of connections between the buildings.1

Answer:Layout 1:

Layout 2: Since the distance between Fazz Building and Jazz Building is quite short

(1 Mark for appropriate layout)

Page 71: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

71

e2) Suggest the most suitable place (i.e. building) to house the server of this organisation with a suitable reason.

1

Answer:The most suitable place / block to house the server of this organisation would be Raj Building, as this block contains the maximum number of computers, thus decreasing the cabling cost for most of the computers as well as increasing the efficiency of the maximum computers in the network.

(1 mark for correct placement)

e3) Suggest the placement of the following devices with justification:1

a. Internet Connecting Device/Modemb. Switch

Answer:

(i) Raj Building(ii) In both the layouts, a hub/switch each would be needed in all the buildings, to

interconnect the group of cables from the different computers in each block( ½ Mark for placement of each device correctly)

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.

1

Answer:

The type of network that shall be formed to link the sale counters situated in various parts of the same city would be a MAN, because MAN (Metropolitan Area Networks) are the networks that link computer facilities within a city.( ½ mark for correct type and ½ mark for correct justification)

f) Correct definition 1 marks

g) Correct definition 1 marks

Page 72: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

72

SET III

CLASS XII

SUBJECT : COMPUTER SCIENCE (083)

DESIGN OF QUESTION PAPER

Time: 3 hours Max. Marks: 70

A. Weightage to different topics/ content units

S.No. Topics Marks

1. Review of C++ covered in class XI 12

2. Object oriented programming in C++ 12

3. Data Structures & Pointers 14

4. Data File Handling in C++ 06

5. Databases and SQL 08

6. Boolean Algebra 08

7. Communication and Open Source Concepts 10

Total 70

B. Weightage to different FORMS OF QUESTIONS

S.No. Forms of Questions Marks for each question

No. of Questions

Total Marks

1. Very Short answer questions (VSA) 01 09 09

2. Short answer questions - Type I (SA-I) 02 13 26

Page 73: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

73

3. Short answer questions - Type II (SA-II) 03 05 15

4. Long Answer Questions (LA) 04 05 20

Total 32 70

PAPER - II

BLUE PRINT OF QUESTION PAPER

S.No. UNIT VSA

(1 Mark)

SA I

(2 Marks)

SA-II

(3 Marks)

LA

(4 Marks)

Total

1. Review of C++ covered in class XI 1(1) 8(4) 3(1) 12(6)

2. Object Oriented Programming in C++

(a) Introduction to OOP using C++ 2(1) 4(1) 6(2)

(b) Constructor & Destructor 2(1) 2(1)

(c) Inheritance 4(1) 4(1)

3. Data Structure & Pointers

(a) Address Calculation 3(1) 3(1)

(b) Static Allocation of objects 2(1) 3(1) 5(2)

(c) Dynamic Alocation of Objects 4(1) 4(1)

(d) Infix & Postfix expressions 2(1) 2(1)

4. Data File Handling in C++

(a) Fundamentals of File Handling 1(1) 1(1)

(b) Text File 2(1) 2(1)

(c) Binary File 3(1) 3(1)

5. Databases and SQL

(a) Database Concepts 2(1) 2(1)

(b) Structured Query Language 2(1) 4(1) 6(2)

6. Boolean Algebra

(a) Introduction to Boolean Algebra & Laws 2(1) 2(1)

Page 74: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

74

(b) SOP & POS 1(1) 1(1)

(c) Karnaugh Map 3(1) 3(1)

(d) Basic Logic Gates 2(1) 2(1)

7. Communication & Open Source Concepts

(a) Introduction to Networking 2(2) 2(2)

(b) Media. Devices. Topologies & Protocols 4(1) 4(1)

(c) Security 2 (2) 2(2)

(d) Webservers 1(1) 1(1)

(e) Open Source Terminologies 1(1) 1(1)

Total 9(9) 26(13) 15(5) 20(5) 70(32)

Page 75: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

General Instructions

All Questions are Compulsory. Language is C++. Please check that this question paper contains 7 questions. Please write down the serial number of question before attempting it. 15 minutes extra should be given to read the question paper. During this reading time students will read the question

paper only and will not write anything on answer-sheet during this period.

75

PAPER II

MODEL QUESTION PAPER

SUBJECT:-COMPUTER SCIENCE (083)

MAX. MARKS: 70 CLASS: XIITIME: 3:00 Hrs

1 (A) What is Global & Local variable? Explain with Example. 2

(B) Observe the following code and write the name(s) of the header files essentially required to compile it.

void main()

{

charch; cin>>ch;

int x=isdigit(ch);

if(x)

cout<<”It is a digit”;

1

Page 76: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

76

}

(C) Find out the syntax errors (if any) in the following program. (Assuming all the required header files are included.

typedef char[30] string;

void main()

{

string s;

for(i=0,i<10,i++)

s[i]=65+i;

s[i]="\0";

cout<<s;

}

2

(D) Find the output of the following program.

#include<iostream.h>

void main()

{

int a[]={5,10,15,20,25,30};

int *p=a+3;

for(int i=0;i<3;i++)

{

p[i]=a[i];

a[i]=p[i]*2;

}

for(i=0;i<6;i++)

cout<<*(a+i)<<" ";

}

3

(E) Find the output of the following program.

#include <iostream.h>

#include<string.h>

2

Page 77: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

77

void encode(char S[ ])

{

int L=strlen(S);

for (int C=0;C<L/2;C++)

if (S[C]=='A' || S[C]=='E')

S[C]='#';

else

{

char T=S[C];

S[C]=S[L-C-1];

S[L-C-1]=T;

}

}

void main()

{

char Text[ ]="AISSCE 2015";

encode(Text);

cout<<Text<<endl;

}

(F) In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)?

#include <iostream.h>

#include <stdlib.h>

void main()

2

Page 78: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

78

{

int Guess;

randomize();

cin>>Guess;

for (int I=4;I>=1;I--)

{

New=Guess+random(I);

cout<<(char)New;

}

}

(i) ACBA (ii) BBCA

(iii) CDBA (iv) DABA

2. (A) What do you understand by Data Encapsulation and Data Hiding? 2

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

class Exam

{

int year;

public :

Exam(int y) { year=y; } //constructor 1

Exam(Exam &t); //constructor 2

}

(i) Create an object, such that it invokes constructor 1.(ii) Write complete definition for constructor 2.

2

Page 79: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

79

(C) Define a class Show in C++ with the description given below:

Private Members:

name_of_Show of type character array(string)

date_of_release of type character array(string)

name_of_director of type character array(string)

star of type int

total_print_release of type int

Public Members:

A constructor to assign initial values as follows:

name_of_Show NULL

date_of_release 1_1_2007

name_of_director NULL

star 2

total_print_release 100

A function calculate_star() which calculates and assigns the value of data member Star as follows:

Total Print Release Star

>= 1000 5

< 1000 &>=500 4

< 500 &>=300 3

< 300 &>=100 2

< 100 1

A function EnterShow() to input the values of the data members name_of_Show, date_of_release, name_of_director and total_print_release and invokes the function calculate_star( ).

A function DisplayShow() which displays the contents of all the data members for a play.

4

Page 80: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

80

(D) class COMP { private : char Manufacturer [30];

char addr[15];

public: toys( ); void RCOMP( ); void DCOMP( );};class TOY: public COMP{ private: char bcode[10]; public:

double cost_of_toy; void RTOY ( ); void DTOY( );}; class BUYER: public TOY

{ private: char nm[30];

char delivery date[10];

char baddr; public: void RBUYER( ); void DBUYER( );};void main ( )

4

Page 81: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

81

{ BUYER MyToy; }

i) Mention the member names that are accessible by MyToy declared in main( ) function.

ii) Name the data members which can be accessed by the functions of BUYER class.

iii) Name the members that can be accessed by functionRTOY( ).(iv) How many bytes will be occupied by the objects of class BUYER?

3. (A) Write a function in C++ which accepts an integer array and its size as

arguments/parameters and exchanges the values of first half side elements with thesecond half side elements of the array. 3

Example:

If an array of eight elements has initial content as

2,4,1,6,7,9,23,10

The function should rearrange the array as

7,9,23,10,2,4,1,6

2

(B) An array PP[20][25] is stored in the memory along the row with each of the elements occupying 4 bytes. Find out the memory location for the element PP[13][20], if the element PP[7][10] is stored at memory location 3454.

3

(C) Write a function in C++ to display the sum of all the positiveand even numbers , stored in a two dimensional array. The function prototype is as follows:

voidSumPosEven(int Array[5][5]);

3

(D) Write a function in C++ to perform insert operation on a dynamically allocated Queue. struct Node

{

int Code;

char Description[10];

Node * link;

4

Page 82: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

82

}

(E) Evaluate the following postfix notation of expression :(Show status of Stack after each operation)

True,False,NOT,OR,False,True,OR,AND

2

4. (A) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task.

#include <fstream.h>

class Employee

{

intEno;charEname[20];

public:

//Function to count the total number of records

intCountrec();

};int Item::Countrec()

1

Page 83: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

83

{ fstream File;

File.open(“EMP.DAT”,ios::binary|ios::in);

______________________ //Statement 1

int Bytes = ______________________ //Statement 2

int Count = Bytes / sizeof(Item);

File.close();

return Count;

}

(B) Write a function in C++ to read the content of a text file “PLACES.TXT” and display all those lines on screen, which are either starting with ‘P’ or starting with ‘S’.

2

(C) Write a function in C++ to search for a Pcode from a binary file “PRODUCT.DAT”, assuming the binary file is containing the objects of the following class.

class PRODUCTS

{

intPcode;

char Pname[20];

float Price;

public :

void getproducts()

{

cin>>Pcode>>Pname>>Price;

}

void showproducts()

{

cout<<Pcode<<Pname<<Price<<endl;

}

int *getproduct()

{

return Pcode;

}

3

Page 84: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

84

};

Q.5. (A) What do you understand by Candidate Keys in a table ? Give a suitable example. 2

(B) Consider the following tables SHOP and SUPPLIER and answer the following questions:

TABLE : SHOP

TABLE : SUPPLIER

SCODE SNAME

11 Arya Stationers

12 Stationery House

13 Sapna Stores

Write SQL commands for the following statements i to iv and Output for v to viii

(I) To display details of all the items in the shop table in ascending order of

Buydate. 1 Mark

1

(II) To display ICODE and INAME of the items with QTY more than 100. 1

(III) To diplay the ICODE, INAME and TOTAL AMOUNT of each item ( TOTAL AMOUNT is the product of QTY and RATE.

1

(IV) To display SCODE and Number of items supplied for each Supplier. 1

(V) SELECT COUNT (DISTINCT SCODE) FROM Shop; ½

(VI) SELECT SUM(QTY) FROM Shop where SCODE=11; ½

(VII) SELECT INAME, SNAME FROM Shop S, Supplier P WHERE S.Scode =

P.Scode AND ICODE = 1006 ;

½

(VIII) SELECT MIN (BUYDATE) FROM Store ; ½

ICODE INAME SCODE QTY RATE BUYDATE

1005 Note Book 13 120 24 03-May-13

1003 Eraser 12 80 5 07-Aug-13

1002 Pencil 12 300 10 04-Mar-13

1006 Bag 11 70 300 27-Dec-12

1001 Pen 13 250 20 18-Jul-13

1004 Sharpener 12 100 10 23-Jun-13

1009 Box 11 50 80 17-Dec-12

Page 85: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

85

6. (A) Prove that A+ A B=A+B 2

(B) Draw the logic circuit for the following Boolean expression((A+B')(B+C)')'

2

(C) Write the POS expression for the Boolean function given by the following truth tableA B C F0 0 0 10 0 1 00 1 0 10 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1

1

(D) Minimize the given Boolean function using k-map and draw the logic circuit for the reduced expression.

F(A,B,C,D)=∑(0,1,2,4,5,6,8,12)

3

7. (A) What is WAN? What does the MAC address refer to? 1

(B) Define the term Bandwidth. 1

(C) Which of the following is/are not a Client Side script:

(i) PHP (ii) Java Script (iii) VB Script (iv) ASP

1

(D) What is the use of Cloud Computing? 1

(E) “Eduminds University” is starting its first campus in a small town Parampur of Central India with its centre admission office in Delhi. The University has 3 major buildings comprising of Admin building, Academic Building and Research Building in the 5 KM area Campus.

As a network expert, you need to suggest the network plan as per (i) to (iv) to the authorities keeping in mind the distances and other given parameters.

INDIA

Expected wire distances between various locations:

Research Building to Admin Building 90m

Research Building to Academic Building 80m

Academic Building to Admin Building 15m

Delhi Admission Office to Parampur campus 1450Km

4

EdumindsUniversity

Parampur CampusAcademicBuildin

g

ResearchBuildi

ng

Admin

Building

Delhi Admission Office

Page 86: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

86

Expected number of computers to be installed at various locations in the University are as follows:

Research Building 20

Academic Building 150

Admin Building 35

Delhi Admission Building 5

(i) Suggest to the authorities, the cable layout amongst various buildings inside University campus for connecting the buildings.

(ii) Suggest the most suitable place (i.e. building) to house the server of this organization with a suitable reason.

(iii) Suggest an effective device from the following to be installed in each of the buildings to connect all the computers:

Gateway Modem Switch

(iv) Suggest the most suitable (very high speed) service to provide data connectivity between Admission building located in Delhi and the campus located in Parampur from the following options:

Telephone line Fixed line Dial-up connection Co-axial Cable Network GSM Satellite Connection

(F) Write the full forms of the followings:

(i) XML(ii) FLOSS

1

(G) Write one advantage and one disadvantage of BUS topology. 1

PAPER - II

MARKING SCHEME

COMPUTER SCIENCE (083)

Time Allowed : 3 Hrs CLASS XII Max Marks : 70

Q.1 (A) 1 Marks for correct definition & 1 Marks for Example.

(B) iostream.h, ctype.h – ½ mark for each file name

(C) typedefchar string[30]; - ½ mark for each correction

void main()

{

string s;

Page 87: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

87

for(inti=0 ;i<10 ;i++)

s[i]=65+i;

s[i]='\0';

cout>>s;

}

(D) 10 20 30 5 10 15 – ½ mark for each correct value

(E) #102 ECSSI5 – 2 mark for the correct output

(F) (i) & (iv) – 1 mark for each

2. (a) Data Encapsulation: Wrapping up of data and function together in a single unit is known as Data Encapsulation. In a class, we wrap up the data and function together in a single unit.

Data Hiding: Keeping the data in private visibility mode of the class to prevent it from accidental change is known as Data Hiding.

class Computer

{

char CPU[10];int RAM;

public:

void STOCK();

void SHOW();

};

(1 Mark for each definition and explanation)OR (Full 2 marks for explaining both with the help of an example)

(B) i. Exam E1(2007);

ii. Exam(Exam &t)

{

year=t.year;

}

1 mark for Each correct answer

(C) class show

{

char name_of_show[20];

char date_of_release[20], name_of_director[20];

int star;

Data Hiding

Data Encapsulation

Page 88: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

88

inttotal_print_release;

public:

show()

{

strcpy(Nameofshow,” ”);

strcpy(dateof release,”1_1_2007”);

strcpy(nameof director,” ”);

star=2;

totalprintrelease=100;

}

calculate_star()

{

if(totalprintrelease>=1000)

star =5;

else if(totalprintrelease>=500)

star=4;

else if(totalprintrelease>=300)

star=3;

else if(totalprintrelease>=100)

star =2;

else

star =1;

}

void EnterShow(){gets(name_of_Show,);gets(date_of_release); gets(name_of_director); cin>>total_print_release;calculate_star();}

void DisplayShow(){cout<<name_of_Show<<date_of_release;cout<<name_of_director<<total_print_release<<Star;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)

Page 89: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

89

(½ Mark for constructor)(1 Mark for calculation of correct star for each condition)(1 Mark for correct definition of EnterShow() with proper invocation of calculate_star()) (½ Mark for correct definition of function DisplayShow())

(D) i. RBUYER(), DBUYER(),RTOY(), DTOY(),RCOMP(), DCOMP(), Cost_of_toy

ii. nm,baddr,delieverdate,cost_of_toy

iii. Members functions : Bcode,cost_of_toy,DTOY(),RCOMP(),DCOMP(), RBUYER(), DBUYER(),

Data Member s: nm, baddr,delieverdate iv 104 bytes

Q.3 (A) void Exchange (int A [ ], int N)

{

for (int I=0;I<N/2;I++)

{

int Temp=A[I];

A[I]=A[N/2+I];

A[N/2+I]=Temp;

}

}

OR

void Exchange(int A[], int N)

{

for (int I=0,J=N/2;I<N/2;I++,J++)

{

int Temp=A[J];

for (int K=J;K>I;K--)

A[K]=A[K-1];

A[I]=Temp ;

}

}

Any other equivalent logic producing the correct result

[1 Mark for correct formation of loop]

[1 Mark for exchanging the content correct

(B) FOR ROW-MAJOR

Page 90: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

90

A[I][J]=B + W[N(I-1) + (J-1)]

PP[7][10]=B+4[25*(6) + 9] ½ mark

3454=B+636

B=2818 1 mark

PP[13][20]=2818+4[25*(12) +1 9] ½ mark

PP[13][20] =4094 1 mark

(C) void SumPosEven( intArr[5][5])

{ int s=0;

for(inti=0;i<5;i++) ½ mark

for(int j=0;j<5;j++) ½ mark

{ if(Arr[i][j]>0) ½ mark

{ if(Arr[i][j]%2==0) ½ mark

s=s+Arr[i][j]; ½ mark

}

}

cout<<”Sum of Positive even numbers=”<<s; ½ mark

return;

}

(D) voidins_Queue(Node * rear)

{

Node * nptr=new Node; ½mark

cout<<”\n Enter the value for Code::”;

cin>>nptr-> code;

cout<<”\n Enter the value for Description::”;

gets(nptr-> description); 1½mark for assigning values

nptr->link=Null;

if(rear = = Null)

front=rear=nptr; 1mark

else

{ rear->link=nptr; ½mark

Page 91: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

91

rear=nptr; ½mark

}

}

(E) The operation is as follows: 2mark

Elements Scanned StackTrueFalseNOTORFalseTrueORAND

TrueTrue, FalseTrue, TrueTrueTrue, FalseTrue, False, TrueTrue, TrueTrue

Result : True

Q.4 (A) File.seekg(0,ios::end); //statement1 (½ Mark for each correct statement)

File.tellg(); //statement2

(B) void readfile( )

{ ifstream fin;

fin.open(“PLACES.TXT”);

char line[256];

while (!fin.eof( ))

{ fin.getline(line,255);

if (line[0]= = ‘P’ || line[0]==’S’)

cout<< line;

}

fin.close();

}(½ mark for correct syntax of function header and opening the file in ‘in’ mode)

( ½ mark for reading content from file)

( ½ mark for correct condition for searching)

(½ mark for displaying the result)(C) void ProductSearch( )

{

ifstream fin;

fin.open(“PRODUCT.DAT”,ios::binary|ios::in);

PRODUCTS P;

intp_code, Found=0;

Page 92: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

92

cout<<”Enter Product Code to be search:”;

cin>>p_code;

while (!fin.eof( ))

{ fin.read((char*)&P,sizeof(P));

if (P.getproduct( )= = p_code)

{

P.showproducts();

Found++;

}

}

if (Found==0)

cout<<”Sorry! Product not found!!!”<<endl;

fin.close();

}

(½ mark for correct syntax of function header and body)

( ½ mark for opening the file in ‘in’ mode)

( ½ mark for reading content from file into the object of P)

( ½ mark for appropriate loop)

( ½ mark for correct condition for searching)

(½mark for displaying the content of the object)

Q.5 (A) 1 mark for definition, 1 mark for example

(B) ½ mark for selecting relevant attributes, ½ mark for valid condition

(i) SELECT * FROM SHOP ORDER BY BUYDATEA ASC.

(II)SELECT ICODE, INAME FROM SHOP WHERE QTY> 100.

(III) SELECT ICODE, INAME, QTY*RATE “TOTAL AMOUNT” FROM SHOP;

(IV) SELECT, SCODE, COUNT(*) FROM SHOP GROUP BY SCODE;

½ mark for completely correct answer(Column headings not to be considered)

(v) 3

(vi) 120

(vii)Bag Arya Stationers

(viii) 17-Dec-12

Q.6 (A) (a) LHS A + A'B = A.1 + A'.B (using A.1=A)= A. (1+B) + A'.B (using 1+B=1)

Page 93: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

A

C

D

A'C'

A'D'

C'D' A'C' + C'D'+ A'D'

93

= A + A.B + A'.B (using distributive law)= A + (A+A').B (using distributive law)=A + 1.B (using A+A'=1)

= A +B (RHS) (using 1.B=B)

Or RHS= A + B = A + 1. B= A + (A+A').B= A + A.B + A'.B= A.(1+B) + A'.B= A.1 + A'.B=A + A'B LHS

(Full 2 marks for correct proof using laws of Boolean algebra)

(B) Logic circuit for ((A+B')(B+C)')'

( ½ mark for representing A+B', ½ mark for (B+C)', 1 mark for ((A+B')(B+C)')

(C) POS expression for given truth table is (A+B+C').(A'+B+C).(A'+B'+C)A B C F M0 0 0 10 0 1 0 A+B+C'0 1 0 10 1 1 11 0 0 0 A'+B+C1 0 1 11 1 0 0 A'+B'+C1 1 1 1

(1 mark for correct POS form)

(D) Simplification of Boolean expression is A'C'+A'D'+C'D'

00(C'D') 01(C'D) 11(CD) 10(CD')

00(A'B') 1 1 01

01(A'B) 11

01

11(AB) 1 0 0 0

10(AB')1

0 00

Logic circuit for reduced expression is

Quad1 = A'D'

Quad2 = A'C'

Quad3 = C'D'

Page 94: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

94

(1 mark for drawing k-map & placing 1s at correct position, ½ mark for correct grouping, 1 mark for writing correct minimal form, ½ mark for logic circuit)

Q.7 (A) (1 mark for correct answer)

(B) (½ marks for definition)

(½ marks for examples)

(C) (i)PHP (iv)ASP

(½ marks for each answer)

(D) (1mark for appropriate Answer)

(E) (i) for correct lay out design

(ii) Academic Building because it has the maximum number of computers.

(iii)Switch

(iv) Satellite Connection

(1 mark for each answer)

(F) (i) eXtensiblemark-up language

(ii) Free Libre and Open Source Software

(½ mark for each correct full form)

(G) Advantage- low cost

Disadvantage- fault cannot be easily identified

(½ marks each for advantage & disadvantage)

Page 95: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

95

PAPER III

COMPUTER SCIENCE (THEORY) CLASS XII 083

SESSION 2016-17

BLUE PRINT

S. No UNIT VSA

(1 Mark)

SA I

(2 Marks)

SA II

(3 Marks)

LA

(4 Marks)

Total

1. Review of C++ Covered in Class XI 1 (1) 8 (4) 3 (1) -- 12 (6)

2. Object oriented Programming in C++ 12 (4)

(a) Introduction to OOP using C++ - 2 (1) - 4 (1) 6 (2)

(b) Constructor and Destructor - 2 (1) - - 2 (1)

(c) Inheritance - - - 4 (1) 4 (1)

3. Data Structure and Pointers 14 (5)

(a) Address calculation - - 3 (1) - 3 (1)

(b) Static Allocation of Objects - 2 (1) 3 (1) - 5 (2)

(c) Dynamic Allocation of Objects - - - 4 (1) 4 (1)

(d) Infix and Postfix Expression 2 (1) - - 2 (1)

4. Data File Handling in C++ 6 (3)

(a) Fundamental of File Handling 1 (1) - - - 1 (1)

(b) Text File - 2 (1) - - 2 (1)

(c) Binary File - - 3 (1) - 3 (1)

5. Database and SQL 8 (3)

(a) Database Concepts - 2 (1) - - 2 (1)

(b) Structured Query Language - 2(1) - 4 (1) 6 (2)

6. Boolean Algebra 8 (4)

(a) Introduction to Boolean Algebra and Law

- 2 (1) - - 2 (1)

(b) SOP and POS 1 (1) - - - 1 (1)

(c) Karnaugh Map - - 3 (1) - 3 (1)

(d) Basic Logic Gates - 2 (1) - - 2 (1)

7. Communication and Open Source Concepts

10 (7)

(a) Introduction to Networking 2 (2) - - - 2 (2)

(b) Media, Devices, Topologies & - - - 4 (1) 4 (1)

Page 96: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

96

Protocols(c) Security 2 (2) - - - 2 (2)

(d) Web Server 1 (1) - - - 1 (1)

(e) Open Source Technologies 1 (1) - - - 1 (1)

TOTAL 9 (9) 26 (13) 15 (5) 20 (5) 70 (32)

PAPER III

COMPUTER SCIENCE (THEORY)

SESSION 2016-17 CLASS XII CODE: 083

MAX MARKS: 70 TIMES: 3 HOURS

General Instructions

1. All questions are compulsory.2. Mark for each question is mentioned against it.3. Programming Language is C++

1(a) What are differences between call by value and call by reference technique of function calling? Give a suitable C++ code to illustrate both.

2

(b) Which header file(s) will be essentially required to be included to execute the following C++ code

void main( )

{ char institute[ ]="KendriyaVidyalaSangathan";

intAdmission_Fee =3025;

cout<<"Name of institute = "<<institute<<endl;

cout<<"Admission fee for class 1 = "<<setw(10)<<Admission _Fee;

}

1

(d) Find the output of following program

#include<iostream.h>

void WithDef(intHisNum =30)

{

for(int P=20; P<=HisNum; P+=5)

cout<<P<<" ,";

cout<<endl;

3

Page 97: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

97

}

void Control(int&MyNum)

{

MyNum += 10 ;

WithDef(MyNum);

}

void main(void)

{

intYourNum=20;

Control(YourNum);

WithDef( );

cout<<"Number = "<<YourNum;

}

(e) Find the output of following program

#include<iostream.h>

#include<ctype.h>

void Change(char Text[ ] , char c)

{

for(int k=0; Text[k]!='\0'; k++)

{

if(Text[k] >= 'F' && Text[k] <= 'L')

Text[k] = tolower( Text[k] );

else

if(Text[k] == 'E' || Text[k] == 'e')

Text[k] = c;

else

if(k % 2 == 0)

Text[k] = toupper( Text[k] );

else

Text[k] = Text[k -1];

}

}

2

Page 98: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

98

void main(void)

{ char OldText[ ] = "pOwERALone";

cout<<"Old Text = "<<OldText<<endl;

Change(OldText, '%');

cout<<"New Text = "<<OldText;

}

(f) The following program will generate four random numbers. The four choices of probable numbers are given below out of which only one is correct possible choice. Select the right choice and justify your answer why this is the correct choice.

#include<iostream.h>

#include<stdlib.h>

constint LOW = 15;

void main( void)

{ randomize( );

int POINT = 5, Number;

for(int P = 1; P<=4; P++)

{ Number = LOW + random(POINT);

cout<<Number<<" : ";

POINT- -;

}

}

(i) 19:16:15:18:(ii) 14:18:15:16:(iii) 19:16:14:18:(iv) 19:16:15:16:

2

2.(a) What do you understand by Polymorphism? Give a suitable example of the same. 2

(b) Answer question (i) to (ii) after going through the following program:

class Match

{ int Time;

public:

Match( ) // Function 1

{ Time = 0;

cout<<"Match commences "<<endl;

}

void Detail( ) // Function

2

Page 99: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

99

2

{ cout<<"\nInter Section Basketball Match "<<endl;

}

Match(int Duration) //Function 3

{ Time = Duration;

cout<<"Another match begin now "<<endl;

}

Match(Match &M) //Function 4

{ Time = M.Duration;

cout<<"Like Previous Match"<<endl;

}

};

(i) Which category of constructor - Function 4 belongs and what is its purpose?(ii) Write statement that would call the member function 1 and 3.

c) Define a class TRAVEL in C++ with following description

Private members

Travel_Code long int data type for storing Travel Code

Place a character array to store destination place to travel

Number_of_travellers of type integer

Number_of_buses of type integer

A member function Bus_Required( ) to calculate the Number_of_buses according to following conditionsNumber_of_buses = Number_of_travellers / 55 if Number_of_travellers is exact multiple of 55 otherwise Number_of_buse= Number_of_travellers / 55 + 1

Public Members

A constructor to assign following initial values of Travel_Code as 201, Place as "Nainital", Number_of_travellers as 10, and Number_of_buses as 1.

A function NewTravel( ) which allows user to enter values for Travel_Code, Place and Number_of_travellers. This function must call the function Bus_Required( ) to assign value of Number_of_buses.

A function ShowTravel( ) to display values of all the data members on screen.

4

(d) Answer the question (i) to (iv) based on the following code

class FaceToFace

{

char CentreCode[10];

public:

4

Page 100: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

void Enter( );

void Out( );

};

class Online

{

char website[50];

public:

void SiteEnter( );

void SiteOut( );

};

class Training : public FaceToFace, private Online

{

long Tcode;

float charge;

public:

void Register( );

Void Show( );

};

(i) Which type of inheritance is shown in the example?(ii) Write names of all the members accessible from Show( ) function of class Training.(iii) Write all the members (i.e member data and member functions) accessible by

object of class Training.(iv) What will be the size of object of class Training.

3 (a) Write a function to find a value using Binary Search technique in an array of N integers sorted in ascending order. The function must receive entire array and the value to be searched and should return the index position if value found otherwise -1 to indicate value not in array.

2

(b) An array Arr[35][15] is stored in the memory in row major form with each of its element occupying 4 bytes. Find out the Base Address and address of an element Arr[20][5], if the element Arr[2][2] is stored at address 3000.

3

(c) Write PUSH function in C++ to insert a NODE in a Dynamic Stack with following structure

struct NODE

{ intinfo;

NODE *Next;

};

4

Page 101: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

The function must receive the Address of the NODE Pointer TOP declared in main as well as the value for the node to be pushed in stack.

(d) Write a function to transpose a square integer matrix. The function must receive entire Matrix and the same should be transposed. The function must not create another Matrix.

3

(e) Evaluate the following POSTFIX Expression. Show status of stack after every step of evaluation

True, False, NOT, AND, False, True, OR, AND

2

4(a) Observe the following program segment carefully and answer the questions that follow.

class STUDENT

{ long intStudent_id;

char Name[20];

float score;

public:

void Enroll( );

void Display( );

void ChangeScore( ); //Function to change Score

long intget_studentid( )

{ return student_id; }

};

void ScoreUpdate(long int id)

{ fstream File;

File.open("STUD.DAT",ios::binary|ios::in|ios::out);

STUDENT S; int Record = 0, Found = 0;

while( !Found &&File.read( (char *)&S, sizeof(S) )

{ if(S.get_studentid() = = id)

{ cout<<"\nEnter New Score:- ";

cin>>score;

________________________ //Statement1

________________________ //Statement 2

Found = 1;

}

Record++;

if(Found= = 1)

1

Page 102: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

cout<<"\nRecord Updated";

File.close();

}

Write the statement 1 to position the File Pointer at the beginning of the record for which the student's id matches with the argument passed and Statement 2 to write the updated record at the position.

(b) Write a function COUNT( ) in C++ to count the number of occurrences of word to in the text file NOTES.TXT.

2

(c) Write a function in C++ to read and display all the members whose city is Delhi or Mumbai from the binary file ADDBOOK.DAT. Assume the file contains object of class EMPLOYEE which is defined as follows:

class EMPLOYEE

{ intEmpid;

char EmpName[20];

Char City[20];

Char Department[20];

public:

void Read_Details( ); //Function to Enter value for different fields of Employee

Void Display_Details( ); //To display details of employee

char* Get_City( ); { return City; };

};

3

5(a) Define Primary Key and Foreign Key in respect of a database. 2

Consider the following tables DRESS and MATERIAL and answer (b) and (c) parts of this question

TABLE: DRESS

DCODE DESCRIPTION PRICE MCODE LAUNCHDATE

1001 FORMAL SHIRT 1250 M001 12-JAN-11

10020 FROCK 750 M004 09-SEP-10

10012 INFORMAL SHIRT 1450 M002 06-JUN-11

10019 EVENING GOWN 850 M003 06-JUN-11

10090 TULIP SKIRT 850 M002 31-MAR-10

10023 PENCIL SKIRT 1250 M003 19-DEC-11

10089 SLACKS 850 M003 20-OCT-11

10007 FORMAL PANT 1450 M001 09-MAR-11

Page 103: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

10009 INFORMALPANT 1400 M002 20-OCT-11

10024 BABY TOP 650 M003 07-APR-10

TABLE: MATERIAL

MCODE TYPE

M001 TERELENE

M002 COTTON

M004 POLYESTER

M003 SILK

(b) Write SQL Commands for the following statement

(i) To display DCODE and DEASCRIPTION of each dress in ascending order of DCODE(ii) To display the details of all the dresses which have LAUNCHDATE in between

05-DEC-10 and 20-JUN-11 (Inclusive of both the dates)(iii) To display the average PRICE of all the dresses which are made of material with

MCODE as M003(iv) To display materialwise highest and lowest price alongwith MCODE of dress from

DRESS Table

4

(c) Give the output of following SQL queries:

(i) SELECT SUM(PRICE) FROM dress WHERE MCODE = 'M001';(ii) SELECT DESCRIPTION, TYPE FROM DRESS, MATERIAL WHERE

DRESS.DCODE = MATERIAL.MCODE AND DRESS.PRICE>=1250;(iii) SELECT MAX(MCODE) FROM MATERIAL;(iv) SELECT COUNT(DISTINCT PRICE) FROM DRESS;

2

6(a) State Absorptionlaw and Verify it using Algebraic Method. 2

(b) Write the equivalent Boolean Expression for the following Logic Circuit.

A

B

Z

C

2

(c) Write POS form of Boolean Function F, which is represented in the given truth table.

X Y Z F

0 0 0 1

0 0 1 0

0 1 0 1

1

Page 104: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

0 1 1 0

1 0 0 1

1 0 1 0

1 1 0 0

1 1 1 1

(d) Reduce the following Boolean Expression using K-Map:

F(A, B, C, D) = (0,1,2,4,5,6,8,10)

3

7(a) Which of the following device is used to connect two similar networks with different protocols

(a) Repeater(b) Bridge(c) Router(d) Gateway

1

(b) Differentiate between circuit switching and packet switching. 1

(c) Differentiate between hackers and crackers? 1

(d) Name two server side scripting language. 1

(e) Name at least four protection methods to counter security threats. 1

(f) Write full form of (i) FOSS and (ii) FLOSS 1

(g) Great Studies University is setting up its Academic Schools at Sundar Nagar and planning to set up a network. The University has 3 academic schools and one administration centre as shown in the diagram shown below:

Centre to centre distances between various building is as follows

4

Technology School

Law School Admin

Centre

Business School

Page 105: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

Law School to Business School 60 m

Law School to Technology School 90 m

Law School to Admin Centre 115 m

Business School to Technology School 40 m

Business School to Admin Centre 45 m

Technology School to Admin Centre 25 m

Number of Computers in each school /Centre is as below:

Law School 25

Technology School 50

Admin Centre 125

Business School 35

On the basis of above specification give answer of following questions

(i) Suggest the most suitable place (Schools / Centre) to install the server of the University with a suitable reason.

(ii) Suggest and ideal layout for connecting these Schools/ Centre for a wired connectivity.

(iii) Which device you will suggest to be placed/ installed in each Schools and Centre to efficiently connect all the computers within the Schools / Centre.

(iv) The University is planning to connect its Admin Centre in the closest big city, which is more than 350 kms from the University. Which type of network out of LAN, MAN, WAN will be formed? Justify your answer.

----------------

Page 106: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

PAPER - III

KENDRIYA VIDYALAYA SANGATHAN

MARKING SCHEME

1 (a) What are differences between call by value and call by reference technique of function calling? Give a suitable C++ code to illustrate both.

Ans:

Call By Value Call By Reference

In call by value technique of function calling the called function creates copy of actual argument on formal argument and the called function works on its own copy.

Any change made on formal argument does not affect actual argument. Thus actual argument remains protected from any change.

In call by reference technique of function calling the called function received either the address of the actual argument or creates a reference of the actual argument

Thus the called function works on the actual copy. It means called function is able to make necessary changes on actual copy.

Example:

#include<iostream.h>

void CalcAreaPeri(float r, float *a, float &p)

{

*a = 3.14 * r * r;

2

Page 107: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

p = 2 * 3.14 * r;

}

void main(void)

{

float radius, area_of_circle, perimeter_of_circle;

cout<<"Enter radius of circle ";

cin>>radius;

CalcAreaPeri(radius, &area_of_circle, perimeter_of_circle);

cout<<"Area of Circle = "<<area_of_circle<<endl;

cout<<"Perimeter of circle = "<<perimeter_of_circle;

}

Here a copy of radius is created on r (call by value technique of function calling), Address of area_of_circle is being received on pointer variablea, and reference of perimeter_of_circle i.e. alias is created with the name p.

(Any suitable example should be considered)

Marking

½ Marks for Call By value technique of function calling explanation

½ Marks for Call by reference technique of function calling explanation

½ Marks for Call By value technique of function calling example

½ Marks for Call by reference technique of function calling example

(b) Ans:

Following header files are essentially required for execution of above program

1. iostream.h for cout2. iomanip.h for setw( ) manipulator

Marking

½ Marks for each correct header file.

1

(c) Answer:

#include <iostream.h>

#include <stdio.h>

#include <string.h> //For strcpy( ) function

class Person

2

Page 108: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

{ private:

intPid; // Direct Initialization of a class member in class definition is not allowed. It must be initialized by a function.

char Nationality[20];

public:

Person( ) { Pid=100; strcpy(Nationality,"Indian"); }

void Enter( )

{ cout<<"\nEnter Nationality "; gets(Nationality);

cout<<"\nEnter Person Identification Number "; cin>>Pid;

Display( );

}

void Display( )

{ cout<<"Person Identification Number = "<<Pid<<endl;

cout<<"Nationality of Person = "<<Nationality;

}

};

void main( )

{ Person P;

P.Enter( );

}

Marking

½ Marks for each correction

(d) Answer:

20 , 25 , 30 ,

20 , 25 , 30 ,

Number = 30

Marking:

1 Mark for each correct line of output

Deduct ½ Mark if punctuation is not shown properly and

Deduct ½ Mark if line is not changed properly

3

(e) Answer: 2

Page 109: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

10

Old Text = pOwERALone

New Text = PPW%RRLLN%

Marking:

1 Mark for each correct line of output.

Marks must not be awarded on partial correction of any line of output

(f)

Answer:

(iv) 19 : 16 : 15 : 16 :Explanation:

P LOW POINT Number = LOW + random(POINT) Number

Minimum Maximum

1 15 5 Number = LOW+random(5) 15 + 0 = 15 15 + 4 = 19

2 15 4 Number = LOW+random(4) 15 + 0 = 15 15 + 3 = 18

3 15 3 Number = LOW+random(3) 15 + 0 = 15 15 + 2 = 17

1 15 2 Number = LOW+random(2) 15 + 0 = 15 15 + 1 = 16

Marking:

1 Mark for correct answer

1 Mark for explanation

2

2. (a) What do you understand by Polymorphism? Give a suitable example of the same.

Ans:

Polymorphism is the ability for a message or data to be processed in more than one form. It is implemented through function overloading in C++.

Suppose we have to add two integers and two real numbers through function then instead of writing two functions with different name we can write two function with same name but with different argument. Return type may or may not be different.

int sum(int x, int y)

{ return x+y; }

float sum(float p, float q)

{ return p+q; }

Marking:

2

Page 110: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

1 Mark for definition and

1 mark for suitable example.

(b) Answer

(iii) Function 4 is a Copy Constructor and it is used to initialize an object of class using another object at the time of its declaration.

(iv) Use following statements to call function 1Match M1; //and to call function 3 use the following syntaxMatch M2(90); or Match M3=M1;

Marking:

1 Mark for correct identification of which category of constructor Function 4 is.

½ Mark for each correct syntax of function call for Function 1 and Function 3l

2

(c) Public Members

A constructor to assign following initial values of Travel_Code as 201, Place as "Nainital", Number_of_travellers as 10, and Number_of_buses as 1.

A function NewTravel( ) which allows user to enter values for Travel_Code, Place and Number_of_travellers. This function must call the function Bus_Required( ) to assign value of Number_of_buses.

A function ShowTravel( ) to display values of all the data members on screen.class TRAVEL

{ private:

long intTravel_Code;

char Place[20];

intNumber_of_travellers;

intNumber_of_buses;

void Bus_Required( )

{ if(Number_of_Traveller % 55 = = 0)

Number_of_buses = Number_of_Traveller / 55;

else

Number_of_buses = Number_of_Traveller / 55 + 1;

}

public:

TRAVEL( )

{ Travel_Code = 201;

strcpy(Place, "Nainital");

4

Page 111: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

Number_of_travellers = 10;

Number_of_bus = 1;

}

void NewTravel( )

{ cout<<"\nEnter Where to go :- ";

gets(Place);

cout<<"\nEnter Travel Code:- ";

cin>>Travel_Code;

cout<<"\nEnter Number of travelers:-";

cin>>Number_of_travellers;

Bus_required( );

}

void ShowTravel( )

{ cout<<"\nTravel Code = "<<Travel_Code;

cout<<"\nPlace to visit = "<<Place;

cout<<"\nNumber of travellers = "<<Number_of_travellers;

cout<<"\nNumber of bus = "<<number_of_bus;

}

};

Marking:

½ Mark for Correct declaration of data members under specified Access Specifier

½ Mark for Correct definition of Bus_required( ) Function

½ Mark for its correct calling from function NewTravel( )

½ Mark for correct initialization of place in constructor

½ Mark for correct definition of constructor

½ Mark for correct definition of function NewTravel( )

½ Mark for correct definition of function ShowTravel( )

(d) Answer

(v) Multiple Inheritance

(vi) Enter(), Out(), SiteEnter(),SiteOut(),Register()

(vii) None of the data members will be accessible but following member functions can be

4

Page 112: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

accessed by object of class training Register( ), Show( ), Enter( ), Out(

(viii) The size of object of class Training will be 68 bytes.

Marking

1 Mark for each correct answer.

No marks if partial answer is correct.

3 (a) Answer:

intBinary_Search(int A[ ], int N, int SV)

{

int Low=0, High=N-1, Mid;

Mid=(Low+High)/2;

while( Low <=High && A[Mid] != SV)

{

if(A[Mid] > SV)

High = Mid-1;

if(A[Mid] < SV)

Low = Mid+1;

Mid = (Low+High)/2;

}

if(Low > High)

return -1;

else

return Mid;

}

Marking

½ Mark for Correct Function Definition Header Line

1 Mark for correct logic

½ Mark for returning correct value

2

(b) Answer: Following things are given

Array --------- Arr[35[15]

Page 113: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

Number of Bytes Required by an element of array i.e. elementsize (W) = 4

Address of Arr[2][2] = 3000

Array is stored in Row Major Form

Let

B = Base Address of Array

I = Row Index of Array Element

J = Column Index of Array Element

Lr ( Lower Limit of Row) = 0

Ur (Upper Limit of Row) = 34

R (Number of Row) = Ur-Lr+1 34-0+1=35

Lc ( Lower Limit of Column) = 0

Uc (Upper Limit of Column) = 14

C (Number of Column) = Uc-Lc+1 14-0+1=15

What to Find

Base Address of Array Arr[35][15]

Address of Arr[20][5]

Address of an element in Row major is calculated using following formula

&Arr[I][j] = Base Address + elementsize*(Number of column*( (Row Index-Lower Limit of

Row)+(Column Index – Lower Limit of Column) )

i.e.

&Arr[I][j] = B + W * ( C * (I – Lr) + ( j – Lc) )

Thus

&Arr[2][2]= B + W * ( C * (I – Lr) + ( j – Lc) ) Here I = 2 and J = 2

3000 = B + 4 * (15 * (2 – 0 ) + ( 2 – 0) )

3000 = B + 4 * (15 * 2 + 2 )

3000 = B + 4 * (30 + 2 )

3000 = B + 4 * 32

3000 = B + 128

B = 3000 – 128

B = 2872

&Arr[20][5]= B + W * ( C * (I – Lr) + ( j – Lc) ) Here I = 20 and J = 5

Page 114: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

Arr[20][5]= 2872 + 4 * (15 * (20 – 0 ) + ( 5 – 0) )

Arr[20][5]= 2872 + 4 * (15 * 20 + 5 )

Arr[20][5]= 2872 + 4 * (300 + 5 )

Arr[20][5]= 2872 + 4 * 305

Arr[20][5]= 2872 + 1220

Arr[20][5]= 4092

Marking

1 Marks for Formula

1 Marks for Correct calculation of Base Address

1 Marks for Correct Calculation of Address of Arr[20][5]

(c) Answer:

Structure of NODE to push in stack is given as below

struct NODE

{ int info;

NODE *Next;

};

PUSH function has to implement using Linked List

Function is receiving Address of TOP which is declared in main which is a NODE Pointer

and value to be pushed in stack which is an integer

void PUSH(NODE **START, int data)

{

NODE *temp; //Declaring temporary NODE pointer temp

temp = new NODE; //Allocating memory dynamically for NODE and storing its

//Address in temporary Node Pointer temp

temp->info=data; //Setting info value of newly created NODE with data

temp->Next = *START;//Setting Address Stored in TOP to Link field of Newly

//created NODE thus pointing the node which is at

// First position and attached with TOP at present

*START = temp; //Adjusting Link of TOP such that now it point to the

4

Page 115: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

// newly created NODE and this it become first node

}

Marking:

1 Mark for Correct Function definition header line

1 Mark for allocation of space dynamically for new node on request

1 Mark for Setting different field of newly create node with correct value

1 Mark for adjusting link of TOP

(d) Answer

void TRANSPOSE_MATRIX(int M[ ], int ROW, int COL)

{ int R, C, temp;

for( R = 0 ; R < ROW ; R++ )

{ for( C = R+1 ; C < COL ; C++ )

{

temp = M[R][C];

M[R][C] = M[C][R];

M[C][R] = temp;

}

}

}

Marking

1 Mark for Correct definition header line

½ Mark for Correct outer loop

½ Mark for Correct inner loop

1 Mark for Correct logic within inner loop

3

(e) Answer: The given Postfix expression is True, False, NOT, AND, False, True, OR, AND

Adding ( at the beginning and ) at the end of the postfix expression it will be as

(True, False, NOT, AND, False, True, OR, AND)

Now Scanning expression from left to right

Symbol Action Stack Status Intermediate Output

2

Page 116: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

( Push (

(Top element pointed by )

-----

True Push (, True

-----

False Push (,True, False

-----

NOT Pop once

Evaluate & Push Back

(, True

POP False

(, True

Evaluate with NOT i.e NOT(False) = True

(, True, True

Push Result True Back in Stack

AND Pop twice (i.e.

Evaluate & Push Back

(, True

POP True

(

POP True

(

Evaluate (True AND True )= True

(, True

PUSH the result True back in Stack

False Push (, True, False

True Push (, True, False, True

OR Pop twice

Evaluate & Push Back

(, True, False

POP True

(, True

POP False

(, True

Evaluate (True OR False) = True

(, True, True

PUSH result True back in Stack

AND Pop twice (, True POP True

Page 117: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

Evaluate & Push Back

(

POP True

(

Evaluate (True AND True) = True

(, True

PUSH result True back in Stack

) End of Expression

Pop everything as result

Result is True

4(a) Answer:

Statement1 to place the cursor to the beginning of the record with matched

File.seekg(-1 *sizeof(S),ios::cur);

statement 2 to write at same place a new record with updated score

File.write( (char *)&S, sizeof(S) );

Marking:

½ Mark for correct syntax of statement 1

½ Mark for correct syntax of statement 2

1

(b) Answer:

void COUNT( )

{ ifstream Fin;

Fin.open("NOTES.TXT", ios::in);

if(!Fin)

{ cout<<"\nFile Opening Error";

getch( );

exit(1);

}

intno_of_to=0;

char word[40];

while(!Fin.eof( ) )

{ cin>>word;

if(strcmp(word,"to")==0)

no_of_to++;

2

Page 118: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

}

cout<<"\nTotal count of word \"to\" is = "<<no_of_to;

Fin.close( );

}

Marking:

½ Mark for declaring correct file stream

½ Mark for opening text file NOTE.TXT in read mode

½ Mark for checking end of file

½ Mark for comparing read word with value "to"

(c) Answer:

void DISPLAY( )

{

EMPLOYEE E;

ifstream Fin;

Fin.open("ADDBOOK.DAT",ios::binary);

while(!Fin.read( (char*)&E, sizeof(E) ) )

{

if( strcmp(E.GetCity( ),"Delhi") == 0 || strcmp(E.GetCity( ),"Mumbai") == 0 ))

E.Display_Details( ).

}

Fin.close();

}

Marking:

½ Mark for Declaration of Object of Class Employee

½ Mark for Declaring correct file stream

½ Mark for opening of file

½ Mark for Reading a record from file

½ Mark for getting city value from read record

½ Mark for closing of file

3

5(a) Define Primary Key and Foreign Key in respect of a database. 2

(b) Write SQL Commands for the following statement

(i) SELECT DCODE, DESCRIPTION FROM DRESS ORDER BY DCODE;

4

Page 119: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

11

(ii) SELECT * FROM DRESS

WHERE LAUNCHDATE BETWEEN '05-DEC-10' AND '20-JUN-11';

(iii) SELECT AVG(PRICE) FROM DRESS

WHERE MCODE='M003';

(iv) SELECT MCODE, MAX(PRICE), MIN(PRICE) FROM DRESS

GROUP BY MCODE;

1 Mark for each correct answer

Ignore if ; is not used as terminator

(c) Give the output of following SQL queries:

(v) 2700(vi)

DESCRIPTION TYPE PRICE

FORMAL SHIRT TERELENE 1250

INFORMAL SHIRT COTTON 1450

PENCIL SKIRT SILK 1250

FORMAL PANT TERELENE 1450

INFORMAL PANT COTTON 1400

(vii) M004(viii) 6Marking

½ Mark for each correct output

No marking for partial or incorrect output

2

7(a) State Absorption law and Verify it using Algebraic Method.

This law states that

i) X + XY= X ii) X(X+Y) = XProof

LHS: X+XY

= X+(1+Y) [X is common]

= X [1+Y=1 from properties of 0 and 1]

Proof

LHS: X.(X+Y)

= X.X + X.Y

= X+X.Y [Since X.X = X

Indempotence Law]

= X(1+Y) [X is common]

= X.1 [1+Y = 1, Properties of 0

and 1]

2

Page 120: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

= X [1.X = 1, Properties of 0 and 1]

Marking

1 Mark for Correct Law

1 Mark for Proof using algebraic method

(b) Write the equivalent Boolean Expression for the following Logic Circuit.

A

B

Z

C

Ans:

(A'+B')+(A'C')

Marking:

2 Mark for correct answer.

No Partial Marking

2

(c) Answer:

POS expression for the ABOVE TRUTH TABLE IS AS BELOW

(X+Y+Z') . (X+Y'+Z') . (X'+Y+Z') . (X'+Y+Z)

Marking

1 Mark for Correct POS Expression

No Partial Marking

1

(d) Reduce the following Boolean Expression using K-Map:

F(A, B, C, D) = (0,1,2,4,5,6,8,10)

Answer:

C'D' (00) C'D (01) CD (11) CD' (10)

A'B' (00)0 1 3 2

3

1 1 1

Page 121: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

A'B (01)4 5 7 6

AB (11)12 13 15 14

AB' (10)8 9 11 10

There are three Quads

Quad1 : ( 0, 1, 4, 5) and its reduced expression is A'C'

Quad2: ( 0, 2 , 4, 6) and its reduced expression is A'D'

Quad3: (0, 2, 8, 10) and its reduced expression is B'D'

Thus F(A,B,C,D) = A'C' + A'D' + B'D'

Marking

½ Mark for Correct Drawing of Number of squares for Minterms

½ Marks for Correct labeling of Rows and Columns

1 Mark for Correct grouping (i.e. Quad)

1 Mark for reduced expression writing

8(a) Answer:

(c) Router

Marking

1 Mark for correct answer

1

(b) Difference between Circuit Switching and Packet Switching

Circuit Switching Packet Switching

In Circuit switching technique a dedicated physical connection is established between the two communicating device and then data is transmitted from source to the destination.

In packet switching technique data is divided into fixed size packets of maximum length with destination address on each packet and control information which is allowed to travel on network without establishing a dedicated connection. The data packets are copied into disk at intermediate stations and then send forward by seeking the free link to the desired destination rout.

Marking

½ Mark for circuit switching

½ mark for message switching

1

(c) Ans: 1

1

1

1

1

1

Page 122: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

Cracker Hackers

The crackers are the malicious programmers who break into the secure system for mischievous purpose.

The hackers also break the secured system but for gaining knowledge about the secured system and possibly using this knowledge for playful pranks.

Marking

½ Mark for correct explanation of Crackers

½ Mark for correct explanation of Hackers

(d) Ans: ASP,JSP, PHP etc.

Marking

½ Mark for each correct answer

1

(e) Ans:

Following are the protection methods which is being used to counter network security threats

(i) Authorization(ii) Authentication(iii) Encrypted Smart Cards(iv) Biometric Systems(v) Firewall

Marking:

¼ Mark for each correct protection method

1

(f) Ans: Full form of

FOSS Free and Open Source Software

FLOSS Free Libre and Open Source Software or Free Livre and Open Source Software

Marking:

½ Marks for each correct expansion

1

(g) (i) The most suitable place (Schools / Centre) to install the server of the University is Admin Centre because this Centre is having maximum number of computers thus decreasing the cabling cost. Also housing the server here will make most of the traffic local which is required by 80-20 network design rule.

Marking

½ Mark for Correct place selection and ½ marks for explaining its reason

(ii) Layout 1

4

Technology School

Business School

40 mt

Page 123: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

Layout 2:

Marking :

½ Mark for each layout

(iii) Switch will be suggested to place/ Installin each Schools and Centre to efficiently connect all the computers within the Schools / Centre.

Marking:

1 Mark for correct answer

(iv) The University is planning to connect its Admin Centre in the closest big city, which is more than 350 kms from the University. Since distance is more than 100 kilometers hence WAN is the perfect choice.

Marking

1 Mark for correct answer

Law School

Admin Centre

25 mt

25 mt

45 mt

115 mt

Repeater

Page 124: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

PAPER IV

KENDRIYA VIDYALAYA SANGATHAN COMPUTER SCIENCE (Theory)

Class XII - Code : 083

Blue Print

S.No. UNIT VSA SA I SA II LA TOTAL

(1 Mark) (2 Marks) (3 Marks (4 Marks)

01. Review of C++ covered in Class XI 1(1) 8(4) 3(1) 12(6)

02. Object Oriented Programming in C++

a. Introduction to OOP using C++ 2(1) 4(1) 6(2)

b. Constructor & Destructor 2(1) 2(1)

c. Inheritance 4(1) 4(1)

03. Data Structure & Pointers

a. Address Calculation 3(1) 3(1)

b. Static Allocation of Objects 2(1) 3(1) 5(2)

c. Dynamic Allocation of Objects 4(1) 4(1)

d. Infix & Postfix Expressions 2(1) 2(1)

04. Data File Handling in C++

a. Fundamentals of File Handling 1(1) 1(1)

b. Text File 2(1) 2(1)

c. Binary Files 3(1) 3(1)

05. Databases and SQL

a. Database Concepts 2(1) 2(1)

Page 125: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

b. Structured Query Language 2(1) 4(1) 6(2)

06. Boolean Algebra

a. Introduction to Boolean Algebra & laws 2(1) 2(1)

b. SOP & POS 1(1) 1(1)

c. Karnaugh Map 3(1) 3(1)

d. Basic Logic Gates 2(1) 2(1)

07. Communication & Open Source Concepts

a. Introduction to Networking 2(2) 2(2)

b. Media,Devices,Topologies & Protocols 4(1) 4(1)

c. Security 2(2) 2(2)

d. Webservers 1(1) 1(1)

e. Open Source Terminologies 1(1) 1(1)

TOTAL 9(9) 26(13) 15(5) 20(5) 70(32)

Page 126: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

PAPER IV

KENDRIYA VIDYALAYA SANGATHAN Computer Science (Theory)

Class XII - Code (083)Design of Question Paper Computer Science

Time: 3 hrsMM: 70

Weightage of marks over different dimensions of the question paper shall be as follows:A. Weightage to different topics/contents units

S.N. Topics No. of questions Marks01 Review of C++ covered in class XI 06 1202 Object Oriented Programming in C++ 04 1203 Data Structure and pointer 05 1404 File Handling in C++ 03 0605 Database and SQL 03 0806 Boolean Algebra 04 0807 Communication and open source concept 07 10

TOTAL 32 70B. Weightage to different form of questions

S.N. Form of Questions Marks for each Question

No. of Questions

Total Marks

01 Very Short Answer Questions (VSA) 01 09 0902 Short Answer Questions- Type I (SA I) 02 13 2603 Short Answer Questions- Type II(SA II) 03 05 1504 Long Answer Questions (LA) 04 05 20

C. Weightage to Typology of QuestionsS.N. Typology of Question VSA

1 markSA

2 marksSA II

3 marksLA

4 marksTotal

Marks%

Weightage01 Knowledge 07 05 00 00 17 24.302 Understanding 02 06 03 04 39 55.704 Application 00 02 02 01 14 20.0

TOTAL 09 13 05 05 70 100.0D. Difficulty level of QuestionsS.N. Difficulty level of

QuestionVSA

1 markSA

2 marksSA II

3 marksLA

4 marksTotal

Marks%

Weightage

01 Lower Order (LOTs) 06 02 00 00 10 14.302 Average 03 11 03 04 50 71.404 Higher Order (HOTs) 00 00 02 01 10 14.3

TOTAL 09 13 05 05 70 100.0

Page 127: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

PAPER IV

KENDRIYA VIDYALAYA SANGATHANSAMPLE PAPER

CLASS : XIICOMPUTER SCIENCE (083)

General Instructions: 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. All questions are compulsory. Programming language C++.

Time allowed: 3 hours Maximum Marks: 70

1.

(a) Differentiate between call by value and call by reference with the help of examples.

2

(b) Name the header file(s), which are essentially required to run the following program segment:

void main ( ){char String[20] = “Make in India”;for(int i=5; i<strlrn(String); i++)puts(String);}

1

(c) Observe the following C++ code carefully and rewrite the same after removing all the syntax error(s) present in the code. Ensure that you underline each correction in the code.Important Note:

Correction should not change the logic of the programme.

# include (iostream.h)void main( ){ first = 10, second = 20; jump( first; second); jump(second);} void jump(int n1, int n2 = 20) { n1 = n1+n2; cout<< n1>>n2; }

2

(d) Observe the following C++ code carefully and obtain the output, which will appear on the screen after execution of it.

Important Note: All the desired header files are already included in the code, which are required to

run the code.#include <iostream.h>

2

Page 128: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

#include <stdlib.h>int main( ){ int arr[ ] = { 12, 23, 34, 45} int *ptr = arr; int val = *ptr; cout<<val<<endl; val = *ptr++; cout<<val <<endl; val = *ptr; cout<< val << endl; val = *++ptr; cout<<val<<endl; val = ++*ptr; cout<<vol<<endl; return 0;}

(e) Write the output of the following programme:

#include<iostream.h>

struct Package

{

int L, b, h;

};

void occupy(Package M)

{

cout<<M.L<<”x”<<M.b<<”x”<<M.h<<endl;

}

void main( )

{

Package B1 = { 100, 150, 50}, B2, B3;

++B1.L;

occupy(B1);

B3 = B1;

++B3.b;

B3.b++;

occupy(B3);

B2 = B3;

B2.b += 50;

B2.h- -;

occupy(B2);

}

3

(f) The following code is from a game, which generates set of 4 random numbers. Shalaini is playing this game, help her to identify the correct options(s) out of four choices given below as the possible set of such numbers generated from the program code so that she can win the game. Justify your answer.

Page 129: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

12

#include<iostream.h>#include<stdlib.h>const int Mins = 15;void main( ){ randomize( ); int Dial, Coin = 5; for (int N = 1; N<=4; N++) { Dial = Mins + random(Coins); cout<< Dial << “@”; Coins - - ; } }

(i). 19@16@14@18@ (ii). 19@16@15@16@ (iii). 14@18@15@16@ (iv). 10@16@15@18@

2

2.

(a) What is an object with reference to Encapsulation? State the different ways to assign values to the data members of an object.

2

(b) Answer the question (i) and (ii) after going through the following class:class CPPDPT{ int duration; // in hours public: CPPDPT( ) // Function 1 { duration = 6; cout<<Inaugural Function”<<endl; } ~CPPDPT( ) // Function 2 { cout<<” Valedictory Function”<< endl; void session(int s = 1) // Function 3 { cout<<”session”<< s << “is on” << endl; } CPPDPT (int time) // function 4 { duration = time; cout << Inaugural Function”<<endl; } };

i). In object oriented programming, what is function 2 referred to as and when does it get invoked/called?ii). In object oriented programming, which concept is illustrated by Function 1 and Function 4? Write an example illustrating the calls for these two functions.

2

(c) Define a class SUPERMARKET in C++ with the following description:Private members:

Icode of type integer (item code) Item of type string (item name)

4

Page 130: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

Price of type float (price of each item) Qty of type integer (quantity in stock) Discount of type float (discount percentage on the item) A member function FindDisc( ) to calculate discount as per the following rule.

if Qty <= 50 Discount is 00% if 50 < Qty <= 100 Discount is 05% if Qty > 100 Discount is 10%

Public Members: A Function Buy( ) to allow user to enter values for Icode, Item, Price, Qty and call

function FindDisc( ) to calculate the discount. A Function ShowAll ( ) to allow user to view the content of ALL data member.

(d) Consider the following C++ code and answer the questions from (i) to (iv):class ADDRESS

{

char Hno[10];

char City[15];

protected:

long Pincode;

public:

char phone[11];

ADDRESS();

void get();

void show();

};

class OFFICE

{

char Name[15];

char Manager[20];

char code[10];

public:

int totalEmp;

OFFICE();

void Input();

void Output();

};

class EMPLOYEE: private ADDRESS, public OFFICE

{

4

Page 131: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

int Icode;

char Ename[25];

float Salary;

public:

char Dept[15];

EMPLOYEE();

void getEmp();

void showEmp();

};

(i) Name the type of inheritance is shown in above example.

(ii) Write the names of all the member functions which are Accessible from objects of class EMPLOYEE.

(iii) Write the names of all the members which are accessible from member functions of class EMPLOYEE.

(iv) How many bytes will be allocated to an object belonging to class EMPLOYEE?

3.

(a) Write a programme which perform the following task: Initialize an integer array of 10 elements in main( ) Pass the entire array to a function modify( ) and define the modify( ) function to

multiply each element of array by 3. Return the control to main( ) and print the new array elements in main( ).

3

(b) An array A[50][60] is stored in the main memory along the column with each of the element occupying 6 bytes, find out the base address of the array if an element P[10][20] is stored at the memory location 6800.

3

(c) Write a user defined function to store and print the elements of a unit matrix.(note: The unit matrix is the matrix whose left diagonal elements are 1 and rest of the elements are 0) 2

(d) Obtain the postfix notation for the following infix notation of expression showing the content of the stack and postfix expression formed after each step of conversion:

A + (B * C / D ) – (E * F ) / G 2

(e) Write a function in C++ to delete an element from a dynamically allocated Stack of Student implemented with the help of following structure:

struct Student

{ 4

Page 132: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

int Rollno;

char Name[20];

Student * Link;

};

4.

(a) Observe the programme segment given below carefully and fill the blanks marked as statement 1 and statement 2 using seekg( ), seekp( ), tellp( ) and tellg( ) function for performing the required task.

#include <fstream.h>

class Customer

{

int Cno;

char Cname[20];

public:

//Function to count the total number of records

int Countrec();

};

int Customer::Countrec()

{

fstream f;

f.open(“Cust.dat”,ios::binary|ios::in);

______________________ //Statement 1

int Bytes =_____________________ //Statement 2

int count = Bytes / sizeof(Customer);

f.close();

return count;

}

1

(b) Write a function in C++ to count number of words starting with “amend” in the text file named as “Amendment.txt”

Eg:

A contract to deliver something to a customer once a month can be amended if the customer wants it delivered once a week. Usually, everyone involved in the contract must agree to the amendment before it goes into effect. Most contracts are written with rules

2

Page 133: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

about amendments.

The Output should be

No of words starting with amend : 3(c) Write a function in C++ to search for a computer from a binary file “COMPUTER.DAT”

containing the objects of class COMPUTER (as defined below). The user should enter the model no and the function should search and display the details of the computer.

class COMPUTER{ long ModelNo; float RAM, HDD; char Details[120]; public: void stockenter( ) { cin>>ModelNo>>RAM>>HDD; gets(Details);} void stockdisplay( ) { cout<< ModelNo<<RAM<<Details<<endl; } long return getModelNo( ) { return ModelNo;}};

3

5.

(a) What is Data Independence? Explain each level of data independence. 2

Consider the following tables Consignor and Consignee. Write SQL commands for the statements (i) to (iv) and give outputs for SQL Queries (v) to (viii).

TABLE : CONSIGNORCnorID CnorName CnorAddress CityND01 R Singhal 24, ABC Enclave New DelhiND02 Amit Kumar 123, Palm Avenue New DelhiMU15 R Kohli 5/A, South Street MumbaiMU50 S Kaur 21-K, Westend Mumbai

TABLE: CONSIGNEE

CneeID CnorID CneeName CneeAddress CneeCityMU05 ND01 Rahul Kishore 5, Park Avenue MumbaiND08 ND02 P Dhingra 16/J,Moore Enclave New DelhiKO19 MU15 A P Roy 2A, Central avenue KolkataMU32 ND02 S Mittal P 245, AB colony MumbaiND48 MU50 B P Jain 13, Block D, A Vihar New Delhi

Page 134: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

(b) 4

i). To display the name of all Consignors from Mumbai.iii). To display the CneeID, CnorName, CnorAddress, CneeName, CneeAddress for every consignee.iii). To display consignee details in ascending order of CneeName.iv). To display number of consignors from each city.

(c) 2

v). SELECT DISTINCT CneeCity form Consigneevi). Select A.consignor , B.CneeName from Consignor A, Consignee B WHERE A.CnorID = B.CnorID AND B.CneeCity = ‘Mumbai’ ;vii). SELECT CneeName, CneeAddress from Consignee WHERE CneeCity NOT IN (‘Mumbai’ , ‘Kolkata’);viii). SELECT CneeID, CneeName from Consignee WHERE CnorID = ‘MU15’ OR CnorID = ‘ND01’ ;

6.

(a) State and prove the De Morgan’s Theorem (any one) Algebraically. 2

(b) Draw Logic circuit diagram for the following:x y + x ȳ + zx̄

2

(c) Write the Product of Sum & Sum of Product form of Boolean function H( X, Y, Z), for the following truth table representation of H.

X Y Z H0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 11 1 0 11 1 1 0

1

(d) Obtain a simplified form of the following Boolean expression using Karnaugh’s Map.

F(P, Q, R, S) = Π (9, 11, 13, 14, 15) 3

7.

(a) Arrange the following Communication channels in ascending order of their data transmission rates.Ethernet cable, Optical Fiber, Telephone cable, Co-axial cable 1

(b) Which cable connectors are used to connect a cable from router’s console a PC?

Page 135: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

Head Office Mumbai

GIDA

Development Office

Administrative Building

Finance office

13

1

(c) Raj Shree Productions are setting up a secured network for their office campus at GIDA for their day to day office and web based activities. They are planning to have connectivity between 3 buildings and the head office situated in Mumbai. Answer the questions (i) to (iv) after going through the building positions in the campus and other details, which are given below:

Distance between various buildings:Development office to Building Finance office. 125 mDevelopment office to Building Administrative Building 60 mAdministrative Building to Building Finance Office 65mGorakhpur to Head Office Mumbai 1500km

Number of Computers:Building Development Office 25Finance Office 150Administrative Building 51Head Office 10

4

i). Suggest the most suitable place (Building) to house the server of this industry.ii). Suggest the cable layout connections between the building inside the GIDA campus.iii). Suggest the placement of the following devices with justification: (a). Switch (b). Repeateriv). The industry is planning to provide high speed link with its head office situated in Mumbai using a wired connection. Which of the following cables will be most suitable for this job.

(a) Optical Fiber (b) Co-axial cable (c) Ethernet cable(d) Differentiate between shareware software and freeware. 1

(e) What are cookies? 1

(f) What do You understand by 3G technologies in networking? 1

(g) Write the name of one client-side and one server side script. 1

PAPER IV KENDRIYA VIDYALAYA SANGATHAN

SAMPLE PAPER

Page 136: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

MARKING SCHEMECLASS: XII

COMPUTER SCIENCE (083)

GENERAL INSTRUCTIONS: Candidates ability to express ideas and usage of expressions should be given due consideration Candidate may or may not use all the words, sentences etc given. The quality of the answer should be given greater consideration over the quantity or length of

answer

Q.No. Expected Answers Marks1(a) In call by value method, the called function creates its own copies of the original sent

to it. Any changes, that are made, occur on the called function’s copy of values and are not reflected back to the calling function.

In call by reference method, the called function access and works with the original values using their reference. Any changes, that occur, take place on the original values and are reflected back to the calling code.

EXAMPLE OF CALL BY VALUE EXAMPLE OF CALL BY REFERENCEvoid main( ){ int a = 5;cout<< “a=” << a;change (a);cout<< “\na =”<<a;}void change( int b){ b =10;}Output will be a = 5a = 5

void main( ){ int a = 5;cout<< “a=” << a;change (a);cout<< “\na =”<<a;}void change( int &b){ b =10;}Output will be a = 5a = 10

2

1 mark for differences1 mark for example

(b) <stdio.h> <string.h>

1

½ marks for each correct header file

(c) Given Code Error and Correction# include (iostream.h)void main( ){ first = 10, second = 20; jump( first; second); jump(second);} void jump(int n1, int n2 = 20) { n1 = n1+n2; cout<< n1>>n2; }

#include<iostream.h> void jump(int n1, int n2 = 20); void main( ) { int first = 10, second = 20; jump(first , second); jump(second); } void jump(int n1, int n2 = 20) { n1 = n1 + n2; cout<<n1<<n2; }

2

Page 137: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

½ marks for each correctionDeduct ½ marks if not rewritten and underlined the corrections

(d) 12233435

2

½ marks for each correct outputDeduct ½ marks if correct output written in the same line.

(e) 101 x 150 x 50

101 x 152 x 50

101 x 202 x 49

3

½ marks for each correct outputDeduct ½ marks if output written in same line

(f) (iv) 19@16@15@18@

As the value of variable Coins will be 5,4,3,2 in the four iterations and Mins remains 15.

The random( ) function will generate numbers depending on the value of it’s argument Coins i.e. between 0 and (Coins-1).

2

½ marks for correct option½ marks for justification

2. (a) Encapsulation means binding of code and data. In C++ it‟s implemented by defining

class. Object is real instance of a class.

The data members of an object is been assigned values by calling constructors (default, parameterized, copy) and calling member functions which performs user input.

2

1 mark for correct definition ( any other definition giving correct idea)1 mark for giving ways (any other similar example)

(b) (i). Destructor, it is invoked as soon as the scope of the object gets over(ii). Constructor Overloading (or Function overloading or polymorphism) CPPDPT C1; //Function 1 gets called CPPDPT C2(8); // Function 4 gets invoked

2

½ marks for correct answer of (i)½ marks for writing correct concept½ marks each for writing correct call definition.

(c) class SUPERMARKET { int Icode; char Item[20]; float Price; int Qty; float Discount; void FindDisc( ) {

Page 138: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

if(Qty <=50) Discount = 0; else if (Qty <=100) Discount = Price * Qty * 0.05; else Discount = Price * Qty * 0.10;}public: void Buy( ) { cout<< “Enter item Code:”; cin>> Icode; cout<< “Enter Item Name;”; gets(Item); cout<< “Enter Price of Each item:”; cin>>Price; cout<< “ Enter quantity of item:”; cin>> Qty; FindDisc( ); } void ShowAll( ) { cout<<”Code:”<<Icode<<”\nName:”<<Item<<”\nPrice:”<<Price; cout<<”\nQuantity;”<<Qty<<”\nDiscount:”<<Discount; }};

4

½ marks for writing correct starting and ending class definition½ marks for correct declaration of data members1 mark for correct definition of FindDisc( ) function1 mark for correct definition of Buy( ) function1 mark for correct definition of ShowAll( ) function

(d) (i) Multiple Inheritance

(ii) getEmp(),showEmp(),Input(),Output()

(iii) data members ½ and member function ½ mark each

(iv) 40 bytes

4

1 marks for each correct answer

3.(a) #include<iostream.h>

#include<conio.h>void main( ){ int i; int array[ ] = {1,2,3,4,5,6,7,8,9,10}; modify(int [ ]); clrscr( ); cout<<”\n Original Array is:\n”); for( i = 0; i<10; i++) cout<< array[ i ] << “\n”;

modify( array , 10); cout<< “\nModified Array is\n”; for( i = 0; i<10; i++)

3

Page 139: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

13

cout<< array[ i ] << “\n”; cout<<”\n\n\n\nPress any key to Exit”); getch( ); }

modify (int *arr, int n){ for( int i = 0; i < n; i++) { *arr = *arr * 3; arr++; }} ½ marks for initialization 2 marks for defining and invoking the correctly to modify( ) function½ marks for printing the array

(b) Base address be B = 6800

Size of elements S=2 bytes

Number of rows M= 50

Number of columns N=60

Lower bound of row Lr =0

Lower bound of column Lc =0

In column major implementation

Address of the [I,J]th element = B + S*[(I-Lr) + (J-Lc) * M]Address of A [10][20] = 6800 + 2*[(10-0)+ (20-0) * 50]

= 6800 +2*[10 + 20*50]= 6800 +2020= 8820

3

½ marks for correct formula ½ marks for correct steps 2 marks for correct base address

(c) #include <iostream.h>void UnitMatrix( mat[ ] [ ], int n ){ for( int i =0; i< n; i++) { for(int j =0; j<n; j++) { if(i = = j) mat[ i ] [ j ] = 1; else mat[ i ] [ j ] = 0; } }for( i =0; i< n; i++) { for( j =0; j<n; j++)

2

Page 140: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

{ cout<< mat[ i ] [ j ] <<”\t”; } cout<<”\n”; }

}1 ½ marks for assigning values of unit matrix½ marks for printing the matrix

(d) Adding ) at the end of given expression and inserting ( in the stack.(A + (B * C / D ) – (E * F ) / G)

Symbol Stack Postfix expression(

A ( A+ ( + A( (+( AB ( +( A B* ( +( * A B C ( + (* A B C/ ( + ( / A B C*D ( + ( / A B C* D) ( + A B C* D/- ( - A B C* D/+( ( - ( A B C * D / +E ( - ( A B C * D / + E* ( - ( * A B C * D / + EF ( - ( * A B C * D / + E F) ( - A B C * D / + E F * / ( - / A B C * D / + E F *G ( - / A B C * D / + E F *G) A B C * D / + E F * G / -

2

2 marks for correct answer after proper steps

(e) void pop(Student *top)

{

Student *ptr = top;

if(ptr = = NULL)

cout<<”Underflow”;

else

{

cout<< “element being deleted is “;

cout<< “Roll no”<<top ->Rollno;

cout<< “Name”<<top -> Name;

top = top -> Next;

deleteptr;

4

Page 141: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

}

}1 mark for correct line for pop( )1 mark for correct initialization of pointer 2 marks for correct definition

4.(a) Statement 1: f.seekg(ios::end);

Statement 2: f.tellg();

1

½ marks for statement 1½ marks for statement 2

(b) #include<fstream.h>

#include<string.h>

void count()

{

int c=0;

char word[80];

ifstream f("Amendment.txt");

while(!f.eof())

{

f>>word;

if(strstr(word,”amend”))

cnt++;

}

f.close();

cout<<"Number of words starting with amend are "<<cnt;

}

2

2 marks for the correct any correct program which gives correct output

(c) void search( long MNo){ ifstream ifile(“COMPUTER.DAT”, ios::in | ios::binary); if(!ifile) { cout<<”could not open COMPUTER.DAT file”; exit(-1); } else { COMPUTER c; int found = 0; while(!ifile.read( ( char *) &c, sizeof(c))) { if( c.getModelNo( ) ==MNo) {

3

Page 142: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

c.stockdisplay( ); found = 1; break; } } } if(found = =0) cout<< “Given Model No is Not found”; ifile.close( ); }½ marks for declaring stream½ marks for opening and closing the stream2 marks for writing any correct code which give the correct idea of function

5.(a) Data Independence is the ability to modify a scheme definition in one level without

affecting a scheme definition in the next higher level. There are two levels of data independence: Physical and LogicalPhysical Data Independence: refers to the ability to modify the scheme followed at the physical level without affecting the scheme followed at the conceptual level. i.e the application programs remains the same even though the scheme at the physical level gets modified.Logical Data Independence: refers to the ability to modify the conceptual scheme without causing any changes in the schemes followed at view level. The logical data independence ensures that the application programs remains the same.

2

½ marks for defining data independence.½ mars for giving the name of both the data independence1 mark for defining Physical and Logical data independence.

(b)

(c)

(i). SELECT CnorID from CONSIGNOR WHERE City = ‘Mumbai’;

(ii). SELECT CneeID, CnorName, CnorAddress, CneeName, CneeAddress FROM CONSIGNOR, CONSIGNEE WHERE CONSIGNOR.CnorID = CONSIGNEE.CnorID;

(iii). SELECT * FROM Consignee ORDER BY CneeName ASC;

(iv). SELECT CneeCity, COUNT(CneeCity) \ from CONSIGNEE GROUP BY CneeCity;

(v). ----------------- | CneeCity | ------------------ | Mumbai | ------------------- | New Delhi | ------------------- | Kolkata | ------------------(vi). R Singhal Rahul Kishor Amit Kumar S Mittal (vii). P Dhingra 16/J Moore Enclave B P Jain 13, Block D A Vihar

1

1

1

1

½

½

½

Page 143: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

x y z

xy

xy̅

x̅z

14

(viii). MU05 Rahul Kishor KO19 A P Roy

½

6.(a) DeMorgtan’s Theorem states that

(i). X + Y = X̅ . Y̅ (ii). X . Y = X̅ + Y̅

Proof: Assuming that DeMorgon’s laws are true. That means, all Boolean laws should hold on it. Let X + Y = P ---------------- (i)Therefore given theorem (i) we get P̅ = X̅ . Y̅ ---------------- (ii)Since Boolean laws hold on it, Complementarity law should also hold on it. P + P̅ = 1 and P . P̅ = 0 P + P̅ = 1 Replacing values of P̅, we get P + X̅ . Y̅ = 1L.H.S. = (P + X̅) (P + Y̅) from (ii)Replacing values of P, we get(X + Y + X̅) (X + Y + Y̅) = (X + X̅ + Y) (X + 1) = (1 + Y) ( X + 1) (since X + X̅= Y + Y̅ =1) 1 . 1 = 1 = R. H. S. (since 1 + Y = 1 + X =1)Similarly, replacing P and P̅ in P . P̅ = 0, we get(X + Y) X̅ . Y̅ = 0 L.H S. = X X̅ Y̅ + Y X̅ Y̅ 0 + 0 = 0 = R.H.S. (since XX̅ = 0 , YY̅ =0)Thus complementarity law fully hold on it DeMorgon’s Theorem is a legal Boolean algebra Theorem

2

½ for stating Demorgon’s Theorem½ marks for referring complementarity laws and assigning the value to P1 mark for rest and correct full derivation.

(b)

2 marks for correct diagram

2

(c) POS = (X +Y +Z) (X + Y’ + Z’) (X’ + Y’ + Z’)

SOP = X’Y’Z + X’YZ’ + XY’Z’ + XY’Z + XYZ’

1

1 mark for correct expression

Page 144: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

Development Office

Administrative BuildingFinance Office

bu

14

(d) 00 01 11 10

0 0

0

0 0

There are 4 groups : 2 quads and 2 pairs.Quad (M9 . M11 . M13 . M15) reduces to (P’ + Q’)Pair (M14 . M15) reduces to (P’ + Q’ + R’)

Final P – O – S expression will be (P’ + S’).(P’ + Q’ + R’)

3

½ marks for correct distribution of 0s½ marks for correct encircles of quad and pair½ marks each for correct expressions for quad and pairDeduct ½ marks if 1s are encircled.

7.(a) Telephone Cable, Ethernet Cable, Co-axial Cable, Optical Fiber 1

1 mark for correct order

(b) RJ-45 cable 11 mark for any similar correct answer

(c) (i). Finance Office. As most computers are situated in this building and as per 80:20 rule of networking, maximum traffic should be local traffic. So server should be in building with maximum computer i.e. Finance office(ii)

(iii)(a) Switches are needed in every building as they help share bandwidth in every

building.(b) Repeaters may be skipped as per above layout, (because distance is less than

100m) however if development Office and Finance office are directly connected, we can place a repeater as the distance between these two buildings is more than 100m.

1

1

1

10

11

01

00PQ

RS

Page 145: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

(iv) (a) Optical Fiber 11 mark for each correct answer

(d) Shareware FreewareShareware is a trail version of software which is offered without support, update of help and certain feature only available after license is purchased.

Freeware is free of cost, can be copied and redistributed but cannot be modified as no source code is available. It is generally proprietary available at zero price.

1

1 mark for similar or any correct difference.

(e) Cookie is a message given to a web browser by a web server, so that the web server can keep track of user’s activity on a specific web site.

1

1 mark for definition 1 mark for giving purpose

(f) It is the 3rd generation of Mobile communication Technology. 11 mark for correct answer

(g) Client side: Java script and VbScriptServer side: ASP and JSP

1

½ marks for any of the scripting language for client and server

PAPER V

COMPUTER SCIENCE (Theory)

Class XII - Code : 083

Blue Print

S.No. UNIT VSA

(1 Mark)

SA I

(2 Marks)

SA II

(3 Marks)

LA

(4 Marks)

TOTAL

1 Review of C++ covered in Class XI 1 (1) 8 (4) 3 (1) 12 (6)

2 Object Oriented Programming in C++

a) Introduction to OOP using C++

Page 146: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

b)Constructor & Destructor

c) Inheritance

2 (1)

2 (1)

4 (1)

4 (1)

6 (2)

2 (1)

4 (1)

3 Data Structure & Pointers

a) Address Calculationb) Static Allocation of Objectsc) Dynamic Allocation of Objectsd) Infix & Postfix Expressions

2 (1)

2 (1)

3 (1)

3 (1)

4 (1)

3 (1)

5 (2)

4 (1)

2 (1)

4 Data File Handling in C++

a) Fundamentals of File Handling

b) Text File

c) Binary Files

1 (1)

2 (1)

3 (1)

1 (1)

2 (1)

3 (1)

5 Databases and SQL

a) Database Concepts

b) Structured Query Language

2 (1)

2 (1) 4 (1)

2 (1)

6 (2)

6 Boolean Algebra

a) Introduction to Boolean Algebra& Laws

b) SOP & POS

c) Karnaugh Map

d) Basic Logic Gates

1 (1)

2 (1)

2 (1)

3 (1)

2 (1)

1 (1)

3 (1)

2 (1)

7 Communication & Open Source

Concepts

a) Introduction to Networking

b) Media,Dvices,Topologies &

Protocols

c) Security

d) Webservers

e) Open Source Terminologies

2 (2)

2 (2)

1 (1)

1 (1)

4 (1)

2 (2)

4 (1)

2 (2)

1 (1)

1 (1)

8 TOTAL 9 (9) 26 (13) 15 (5) 20 (5) 70 (32)

Page 147: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

Page 148: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

PAPER - V

COMPUTER SCIENCE (Theory)

Class XII - Code : 083

QUESTION PAPER

TIME : 3 HrsMM : 70

1.

(a) What is the difference between Actual Parameter and Formal Parameters?

Also, give a suitable C++ code to illustrate both. 2

(b) Which C++ header file(s) will be essentially required to be included to run /

execute the following C++ code: 1

void main() {

char Msg[ ]="Sunset Gardens"; for (int I=5;I<strlen(Msg);I++) puts(Msg);

}

(c) Rewrite the following program after removing the syntactical errors (if any).

Underline each correction. 2

#include [iostream.h] class MEMBER {

int Mno; float Fees; PUBLIC:

void Register(){cin>>Mno>>Fees;}

voidDisplay{cout<<Mno<<":"<<Fees<<endl;} };

void main() {

MEMBER M; Register();

M.Display();

Page 149: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

14

(d)Find the output of the following program: 3

#include <iostream.h> struct GAME

{ int Score, Bonus;};

void Play(GAME &g, int N=10) {

g.Score++;g.Bonus+=N; }

void main() {

GAME G={110,50}; Play(G,10);

cout<<G.Score<<":"<<G.Bonus<<endl; Play(G);

cout<<G.Score<<":"<<G.Bonus<<endl; Play(G,15);

cout<<G.Score<<":"<<G.Bonus<<endl; }

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

#include <iostream.h> void Secret(char Str[ ]) {

for (int L=0;Str[L]!='\0';L++); for (int C=0;C<L/2;C++) if (Str[C]=='A' || Str[C]=='E') Str[C]='#';

else

{ char Temp=Str[C];

Str[C]=Str[L-C-1]; Str[L-C-1]=Temp; }

}

void main() {

char Message[ ]="ArabSagar"; Secret(Message);

cout<<Message<<endl; }

(f)In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)? 2

#include <iostream.h> #include <stdlib.h>

Page 150: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

void main()

{

int Guess;

randomize(); cin>>Guess;

for (int I=1;I<=4;I++) {

New=Guess+random(I); cout<<(char)New;

}

}

(i)ABBC

(ii)ACBA

(iii)BCDA

(iv)CABD

2.

(a)What do you understand by Data Encapsulation and Data Hiding? Also, give a suitable C++ code to illustrate both.

2

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

class Seminar {

int Time; public:

Seminar() //Function 1

{

Time=30;cout<<"Seminar starts now"<<end1; }

void Lecture() //Function 2

{

cout<<"Lectures in the seminar on"<<end1; }

Seminar(int Duration) //Function 3

{

Page 151: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

Time=Duration;cout<<"Seminar starts now"<<end1; }

~Seminar()

//Function 4

{

cout<<"Vote of thanks"<<end1; }

};

i)In Object Oriented Programming, what is Function 4 referred as and when does it getinvoked/called?

ii)In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions.

(c)Define a class TEST in C++ with following description: 4

Private Members

• TestCode of type integer

• Description of type string

• NoCandidate of type integer

• CenterReqd (number of centers required) of type integer

• A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1)

Public Members

• A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres

• A function DISPTEST() to allow user to view the content of all the data members

(d)Answer the questions (i) to (iv) based on the following: 4

class PUBLISHER {

char Pub[12];

double Turnover; protected:

void Register(); public:

PUBLISHER(); void Enter(); void Display(); };

class BRANCH {

Page 152: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

char CITY[20]; protected:

float Employees;

public:

BRANCH(); void Haveit(); void Giveit(); };

class AUTHOR : private BRANCH , public PUBLISHER {

int Acode;

char Aname[20]; float Amount; public:

AUTHOR(); void Start(); void Show(); };

(i)Write the names of data members, which are accessible from objects belonging to class AUTHOR.

(ii)Write the names of all the member functions which are accessible from objects belonging to class BRANCH.

(iii)Write the names of all the members which are accessible from member functions of class AUTHOR.

(iv)How many bytes will be required by an object belonging to class AUTHOR?

3.(a)Write a function in C++ to merge the contents of two sorted arrays A & B into third array C. Assuming array A and B are sorted in ascending order and the resultant array C is also required to be in ascending order. 3

(b)An array S[40][30] is stored in the memory along the row with each of the element occupying 2 bytes, find out the memory location for the element S[20][10],if the Base Address of the array is 5000. 3

(c)Write a function in C++ to perform Insert operation in a dynamicallyallocated Queue containing names of students. 4

(d)Write a function in C++ to find the sum of both left and right diagonal elements from a two dimensional array (matrix). 2

(e)Evaluate the following postfix notation of expression: 2

20, 30, +, 50, 40, - ,*

4.

(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekp() and seekg() functions for performing the required task. 1

#include <fstream.h> class Item

{

int Ino;char Item[20];

Page 153: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

public:

//Function to search and display the content from a particular record number void Search(int );

//Function to modify the content of a particular record number void Modify(int);

};

void Item::Search(int RecNo) {

fstream File;

File.open("STOCK.DAT",ios::binary|ios::in);

//Statement 1

File.read((char*)this,sizeof(Item)); cout<<Ino<<"==>"<<Item<<endl; File.close();

}

void Item::Modify(int RecNo) {

fstream File;

File.open("STOCK.DAT",ios::binary|ios::in|ios::out);

cout>>Ino;cin.getline(Item,20);

//Statement 2

File.write((char*)this,sizeof(Item)); File.close();

}

(b)Write a function in C++ to count the number of lines present in a text file "STORY.TXT". 2

(c)Write a function in C++ to search for a BookNo from a binary file "BOOK.DAT",assuming the binary file is containing the objects of the following class. 3

class {

int Bno;

char Title[20]; public:

int RBno(){return Bno;}

void Enter(){cin>>Bno;gets(Title);}

void Display(){cout<<Bno<<Title<<endl;} };

5.

(a)What do you understand by Degree and Cardinality of a table?

Page 154: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

Consider the following tables ACTIVITY and COACH and answer (b) and (c) parts of this question:

Table: ACTIVITY

Table: COACH

(b)Write SQL commands for the following statements:

(i)To display the names of all activities with their Acodes in descending order.

(ii)To display sum of PrizeMoney for the Activities played in each of the Stadiumseparately.

(iii)To display the coach's name and ACodes in ascending order of ACode fromthe table COACH

(iv)To display the content of the Activity table whose ScheduleDate earlier than01/01/2004 in ascending

order of ParticipantsNum.

(c)Give the output of the following SQL queries:

(i)SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;

(ii)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY;

(iii)SELECT Name,ActivityName FROM ACTIVITY A,COACH C

WHERE A.Acode=C.Acode AND A.ParticipantsNum=10;

Page 155: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

(iv)SELECT DISTINCT Acode FROM COACH;

6.

(a)State and verify Demorgan's Laws algebraically.

(b)Write the equivalent Boolean Expression for the following Logic Circuit

(c) Write the POS form of a Boolean function F, which is represented in a truth table as follows:

(d)Reduce the following Boolean Expression using K-Map:

F(A,B,C,D)= (0,1,2,4,5,6,8,10)

7.

a)Compare any two Switching techniques.

b)Which of the following is not a Client Side script:

(i)VB Script (ii)Java Script

(iii)ASP (iv)PHP

c)If someone has hacked your Website, to whom you lodge the Complain?

d)What do you mean by IP Address? How is it useful in Computer Security?

e)Knowledge Supplement Organisation has set up its new center at Mangalorefor its office and web based activities. It has 4 blocks of buildings as shownin the diagram below:

4

U V W F

0 0 0 1

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

Page 156: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

Center to center distances between various blocks

Black A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

Block A to Block C 90 m

Number of Computers

Black A 25

Block B 50

Block C 125

Block D 10

e1)Suggest a cable layout of connections between the blocks.

e2)Suggest the most suitable place (i.e. block) to house the server of this organization with a suitable reason.

e3)Suggest the placement of the following devices with justification

(i) Repeater

(ii) Hub/Switch

e4)The organization is planning to link its front office situated in the city in a hilly region where cable connection is

not feasible, suggest an economic way to connect it with reasonably high speed?

f) What do you mean by Spam Mails? How can you protect your mailbox from Spams? 1

g) Mention any two advantages of Open Source Software over Proprietary Software.

Page 157: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

PAPER - V

COMPUTER SCIENCE (Theory) - Class XII

Subject Code – 083

Marking Scheme

1.

(a) Actual Parameter Formal Parameter 2

It is a parameter, which is used in It is a parameter, which is used in

function call to send the value from function header, to receive the value

calling environment from actual parameter

#include <iostream.h>

void Calc(int T) //T is formal parameter { cout<<5*T; }

void main() { int A=45;

Calc(A);//A is actual parameter }

(1 Mark for two differences)

(1 Mark for the suitable example)

OR

(Full 2 Mark for explanation of differences with the help of an example)

(b) (i) string.h (ii) stdio.h 1

( ½ Mark for mentioning each correct header filename)

(c) #include <iostream.h> 2

class MEMBER { int Mno;float Fees; public:

void Register(){cin>>Mno>>Fees;}

void Display(){cout<<Mno<<":"<<Fees<<endl;} };

void main() { MEMBER M;

Page 158: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

M.Register();

M.Display(); }

( ½ Mark each correction)

(d) 111:60

112:70

113:85

(1 Mark for each correct line of output)

(e) #agaSbarr

(2 Marks for correct line of output)

(f) (i) ABBC 2

(2 Marks for mentioning correct option)

2.

(a) Data Encapsulation: Wrapping up of data and functions together in a single unit is 2

known as Data Encapsulation. In a class, we wrap up the data and functions together

in a single unit.

Data Hiding: Keeping the data in private visibility mode of the class to prevent it from accidental change is known as Data Hiding.

class Computer

{

char CPU[10];int RAM;

public: Data Encapsulation

void STOCK(); void SHOW(); };

( ½ Mark each for appropriate definitions)

(1 Mark for appropriate example showing both)

Page 159: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

15

(b) i) Destructor, it is invoked as soon as the scope of the object gets over. 2

( ½ Mark for mentioning destructor)

( ½ Mark for remaining answer)

ii) Constructor Overloading (or Function Overloading or Polymorphism)

Seminar S1; //Function 1

Seminar S2(90); //Function 3

( ½ Mark for mentioning the correct concept)

( ½ Mark for the example)

(c) class TEST

{

int TestCode;

char Description[20];

int NoCandidate,CenterReqd; void CALCNTR();

public:

void SCHEDULE(); void DISPTEST(); };

void TEST::CALCNTR() {

CenterReqd=NoCandidate/100+1; }

void TEST::SCHEDULE() {

cout<<"Test Code :"; cin>>TestCode;

cout<<"Description:"; gets(Description);

cout<<"Number:"; cin>>NoCandidate;

CALCNTR(); }

void TEST::DISPTEST() {

cout<<"Test Code:"<<TestCode<<endl;

Page 160: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

cout<<"Description:"<<Description<<endl;

cout<<"Number:"<<NoCandidate<<endl;;

cout<<"Centres:"<<CenterReqd<<endl;;

}

(½ Mark for correct syntax for class header)

(½ Mark for correct declarations of data members)

(1 Mark for appropriate definition of function CALCNTR())

(1 Mark for appropriate definition of SCHEDULE() with a call for CALCNTR()) (1 Mark for appropriate definition of DISPTEST())

(d)(i)None of data members are accessible from objects belonging to class AUTHOR.

(1 Mark for correct answer)

(ii) Haveit(), Giveit()

(1 Mark for correct answer)

(iii) Data members: Employees, Acode, Aname, Amount

Member function: Register(), Enter(), Display(), Haveit(), Giveit(), Start(), Show(),

(1 Mark for correct answer)

(iv) 70

(1 Mark for correct answer)

3.(a)void AddNSave(int A[ ],int B[ ],int C[ ],int N,int M, int &K) 3

{

int I=0,J=0; K=0;

while (I<N && J<M) if (A[I]<B[J])

C[K++]=A[I++]; else

if (A[I]>B[J])

C[K++]=B[J++]; else

{

Page 161: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

C[K++]=A[I++]; J++;

}

for(;I<N;I++) C[K++]=A[I]; for(;J<M;J++) C[K++]=B[J]; }

( ½ Mark for correct Function Header)

( ½ Mark for correct initialization of required variables) ( ½ Mark for correct formation of loop)

( ½ Mark for appropriate conditions and assignments in the loop)

( ½ Mark for appropriately transferring the remaining elements from first array)

( ½ Mark for appropriately transferring the remaining elements from second array)

(b)Given, 3

W=2 N=40 M=30

Base(S)=5000

Row Major Formula:

Loc(S[I][J])=Base(S)+W*(M*I+J)

Loc(S[20][10])=5000+2*(30*20+10)

=5000+2*(600+10) =5000+1220 =6220

(1 Mark for writing correct formula (for column major) OR substituting formula with correct values)

(1 Mark for writing calculation step - at least one step) (1 Mark for correct address)

(c)struct NODE 4

{

char Name[20]; NODE *Link; };

class QUEUE

{ NODE *R,*F;

Page 162: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

public:

QUEUE(); void Insert(); void Delete(); };

void QUEUE::Insert() {

NODE *Temp;

Temp=new NODE; gets(Temp->Name); Temp->Link=NULL; if (Rear==NULL) {

Rear=Temp; Front=Temp; }

else {

Rear->Link=Temp; Rear=Temp;

}

}

(1 Mark for creating a new node and assigning/entering appropriate values in it)

(1 Mark for checking if Queue is Empty)

(1 Mark for assigning Rear and Front as Temp - if Queue is Empty) (1 Mark for eassigning Rear->Link as Front and Rear as Temp)

(d)void DiagSum(int M[][4],int N,int M) 2

{

int SumD1=0,SumD2=0; for (int I=0;I<N;I++)

{

SumD1+=M[I][I];SumD2+=M[N-I-1][I]; }

cout<<"Sum of Diagonal1:"<<SumD1<<endl; cout<<"Sum of Diagonal 2:"<<SumD2<<endl;

}

Page 163: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

( ½ Mark for correct function header)

( ½ Mark for initialization of SumD1 and SumD2 as 0)

( ½ Mark for appropriate loop)

( ½ Mark for correct expression for adding each diagonal elements)

(e) 2

(1 Mark for correctly evaluating each operator)

(1 Mark for the correct result)

4. a) 1

File.seekg(RecNo*sizeof(Item)); //Statement 1

File.seekp(RecNo*sizeof(Item)); //Statement 2

(½ Mark for each correct Statement)

(b) 2

void CountLine() {

ifstream FIL("STORY.TXT"); int LINES=0;

char STR[80];

while (FIL.getline(STR,80))

LINES++;

cout<<"No. of Lines:"<<LINES<<endl;

f.close();

}

(½ Mark for opening STORY.TXT correctly)

(½ Mark for initializing a counter variable as 0) (½ Mark for correctly reading a line from the file) (½ Mark for correctly incrementing the counter)

(c) void BookSearch()3

Page 164: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

{

fstream FIL;

FIL.open("BOOK.DAT",ios::binary|ios::in); BOOK B;

int bn,Found=0;

cout<<"Enter Book No. to search…";

cin>>bn; while (FIL.read((char*)&S,sizeof(S))) if (FIL.RBno()==bn)

{

S.Display(); Found++; }

if (Found==0) cout<<"Sorry! Book not found!!!"<<endl; FIL.close();

}

( ½ Mark for opening BOOK.DAT correctly)

( ½ Mark for reading each record from BOOK.DAT) ( ½ Mark for correct loop / checking end of file) ( 1 Mark for comparing Book number) ( ½ Mark for displaying the matching record)

5.

(a) Degree: Number of Columns in a table 2

Cardinality: Number of rows in a table

(1 Mark for each definition)

(b)(i)SELECT Acodes, ActivityName FROM ACTIVITY ORDER BY Acode DESC; 4

(1 Mark for correct query)

OR

(½ Mark for partially correct answer)

(ii)SELECT SUM(PrizeMoney), Stadium FROM ACTIVITY GROUP BY Stadium;

(1 Mark for correct query)

OR

(½ Mark for partially correct answer)

Page 165: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

(iii)SELECT Name, Acode FROM COACH ORDER BY Acode;

(1 Mark for correct query)

OR

(½ Mark for partially correct answer)

(v)SELECT * FROM ACTIVITY WHERE SchduleDate<'01-Jan-2004'

ORDER BY ParticipantsNum;

1 Mark for correct query)

OR

(½ Mark for partially correct answer)

(c) 2

(i) 3

(½ Mark for correct output)

(ii) 19-Mar-2004 12-Dec-2003

(½ Mark for correct output)

(iii) Ravinder Discuss Throw

(½ Mark for correct output)

(iv) 1001

1003 1008

(½ Mark for correct output)

6.

(X+Y)' = X'.Y' Verification

(X+Y)'.(X+Y) = X'.Y'.(X+Y) 0 = X'.Y'.X + X'.Y'.Y

0 = X'.X .Y'+ X'.0 0 = 0 .Y'+ 0

0 = 0 + 0

Page 166: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

0 = 0

L.H.S = R.H.S

(1 Mark for stating any one of the Demorgan's Law) (1 Mark for verifying the law)

(b) 2

F(P,Q)=(P'+Q).(P+Q')

(2 Marks for the final expression )

OR

(1 Mark for any one of the correct terms out of P'+Q or P+Q')

(c) F(U,V,W) = (U+V+W').(U+V'+W').(U'+V+W')1

(d)3

F(A,B,C,D)=A'C'+A'D'+B'D'

( ½ Mark for placing all 1s at correct positions in K-Map) ( ½ Mark for each grouping)

(1 Mark for writing final expression in reduced/minimal form) Note: Deduct ½ mark if wrong variable names are used

7. a)Appropriate comparison between any two out of Circuit Switching, Message 1

Switching, Packet Switching

(1 Mark for writing Appropriate comparison between any two switching technique)

b)(iii) ASP and (iv) PHP are not client side scripts 1

(1 Mark for correct answer)

c)The complaint has to be lodged with the Police under IT Act 1

(1 Mark for correct answer)

d)An Internet Protocol (IP) address is a numerical identification and logical address 1

that is assigned to devices connected in a computer network.

An IP Address is used to uniquely identify devices on the Internet and so one can quickly know the location of the system in the network.

( ½ Mark for meaning of IP Address)

Page 167: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

( ½ Mark for mentioning the usefulness in network security)

e) e1)

(1 Mark for showing any of the suitable cable layout)

e2) The most suitable place / block to house the server of this organisation would be Block C, as this block contains the maximum number of computers, thus decreasing the cabling cost for most of the computers as well as increasing the efficiency of the maximum computers in the network.

( ½ Mark for suggesting suitable place and ½ for appropriate reason)

e3) (i)

( ½ Mark for suggesting suitable place for connecting repeater)

(ii) In each layouts, a hub/switch each would be needed in all the blocks, to interconnect the group of cables from the different computers in each block .

( ½ Mark for suggesting suitable place for connecting hub)

e4) The most economic way to connect it with a reasonable high speed would be to use radio wave transmission, as they are easy to install, can travel long distances, and penetrate buildings easily, so they are widely used for communication, both indoors and outdoors. Radio waves also have the advantage of being omni directional, which is they can travel in all the directions from the source, so that the transmitter and receiver do not have to be carefully aligned physically.

( 1 Mark for appropriate answer)

f)Spam mails, also known as junk e-mail, is a subset of spam that involves nearly 1

identical messages sent to numerous recipients by e-mail.

We can protect our mailbox from spams by creating appropriate filters.

( ½ Mark for the definition of Spam Mails)

( ½ Mark for the appropriate suggestion for protecting mailbox from it)

g) Open Source's proponents often claim that it offers significant benefits when compared to typical Proprietary Software. Proprietary Software typically favour visible features (giving marketing advantage) over harder-to measure qualities such as stability, security and similar less glamorous attributes.

Open Source Software developers are evidently motivated by many factors but favouring features over quality is not noticeable amongst them. For many developers, peer review and acclaim is important, so it's likely that they will prefer to build software that is admired by their peers. Highly prized factors are clean design, reliability and maintainability, with adherence to standards and shared community values preeminent. ( 1 Mark for appropriate answer)

PAPER VI

Page 168: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

Computer Science(083)

CLASS XII

BLUE PRINT

Max Marks:70

S.No Name of Chapter Q.No Sub

Questions

(1)

Mark

(2)

Mark

(3)

Mark

(4)

Mark

Grand

Total

1 Review of C++ covered in Class XI 1

a) (2)

12

b) (1)

c) (2)

d) (2)

e) (3)

f) (2)

2 Object Oriented Programming in C++ 2

a) (2)

12b) (2)

c) (4)

d) (4)

3 Data Structures and Pointers 3

a) (3)

14

b) (3)

c) (2)

d) (2)

e) (4)

4 Data File Handling in C++ 4

a) (1)

06b) (2)

c) (3)

5 DBMS and SQL 5a) (2)

08b) (2) (4)

6 Boolean Algebra 6 a) (2) 08

b) (2)

Page 169: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

16

c) (1)

d) (3)

7 Networking and Open Source Software 7

a) (2)

10

b) (2)

c) (4)

d) (1)

e) (1)

PAPER VI

KENDRIYA VIDYALAYA SANGATHAN

MODEL QUESTION PAPER

CLASS XII

Subject: Computer Science

Time: 3Hrs Max Marks: 70

GENERAL INSTRUCTIONS:

1. All questions are compulsory2. Programming Language : C++

1. (a) Differentiate between multiple and multilevel inheritance with suitable diagram. (2)

(b) Write the names of the header files to which the following belong:

(i) isupper( ) (ii) abs()(1)

(c) Rewrite the following program after removing the syntax errors. Underline each correction.(2)

#include<iostream.h>

#include<conio.h>

class Exam

{

charNameOfExam[20];

int Year;

public

Page 170: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

voidgetexamdetails()

{

cout<<"Enter name of the exam: ";

gets(NameOfExam);

cout<<"Enter year of exam: ";

cin>>Year;

}

voidshowexamdetails()

{

cout<<NameOfExam<<"\n”<<Year;

}

}

void main(){

Exam E1;

getexamdetails();

showexamdetails();

}

(d) Observe the following C++ code carefully and write output. (2)

#include<iostream.h>

#include<string.h>

int main()

{

char *STR="AeroDynamics";

int A=1;

STR+=3;

while(A<9)

{

cout<<*STR<<strlen(STR)<<"\n";

STR++;

Page 171: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

A=A+2;

}

return 0;

}

(e) Write output for the following program. (3)

#include<iostream.h>

#include<conio.h>

struct ITEM

{

intICode,Qty;

};

voidassigndetail( ITEM & I, int Q=5)

{

I.ICode++;

I.Qty*=Q;

}

void main()

{

clrscr();

ITEM T={200,25};

assigndetail(T,10);

cout<<T.ICode<<":"<<T.Qty<<"\n";

assigndetail(T);

cout<<T.ICode<<":"<<T.Qty<<"\n";

assigndetail(T,6);

cout<<T.ICode<<":"<<T.Qty<<"\n";

getch();

}

(f) Study the following program carefully and select the option which is NOT a possible output.(2)

Page 172: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

constint VALUE=15;

int main()

{

clrscr();

int INCR=5;

randomize();

for(int i=1;i<5;i++)

{

int bid=VALUE+random(INCR);

cout<<bid<<":";

INCR+=2;

}

getch();

return 0;

}

(i) 16:19:22:25:(ii) 19:16:15:24:(iii) 15:18:20:16:(iv) 18:22:23:19:

2. (a) What is function overloading? Explain with a suitable example. (2)

(b) Study the following program code and answer the questions given below.class TIME{

intHrs,Min,Sec;public:TIME(){Hrs=Min=Sec=0;} //Function 1TIME(intH,intM,int S) //Function 2{

Hrs=H;Min=M;Sec=S;

}TIME(TIME & T); //Function 3

~TIME(){} //Function 4

Page 173: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

};(i) Which feature of OOP is implemented by functions 1,2 and 3.

(1)(ii) In OOP what is function 4 and when it is invoked?

(1) (c) Define a class LAPTOP with the details given below.

(4)

Company of type char array ModelNoof type char array Screensize of type integer Price of type integer A function setPrice() to supply value for Price as follows

o If screensize is 14 and Company is HP then Price will be 45000o If screensize is 15 and Company is HP then Price will be 43000o If screensize is 14 and Company is DELL then Price will be 44000o If screensize is 15 and Company is DELL then Price will be 42000

Public members:

A default constructor to supply initial values for Company,ModelNo,Screensize, Price as “Not Assigned” , “Not Assigned” , 0, 0

A function setdetails() that supplies values for Company, ModelNo, size and invokes setPrice() function.

A function display() to display all details. (d) Answer the questions (i) to (iv) based on the following code.

(4)

class COMPANY

{

char Location[20];

double Budget,Income;

protected:

void Accounts();

public:

COMPANY();

void Register();

void Show();

};

class FACTORY: public COMPANY

{

char Location[20];

int Workers;

Page 174: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

protected:

double salary;

void Compute();

public:

FACTORY();

void Enter();

void Show(); };

class SHOP: private COMPANY

{

char Location[20];

float Area;

double Sale;

public:

SHOP();

void Input();

void Output();

};

(i) Name the type of inheritance illustrated in the above C++ code.(ii) Write the names of the data members, which are accessible from member functions of

class SHOP.(iii) Write the names of all member functions which are accessible from objects of class

FACTORY(iv) Write the names of all the members , which are accessible from the objects of class

SHOP. 3. (a) Write a function voidmodifylist( int A[], int Size) in C++ , which modifies the elements present

in an array in such a way that the elements, which are multiples of 7 swap with the value present in the very next position in the array.

(3) For example:

If the content of the array A is 42, 12, 57, 63, 25, 78

The content of the array should become12, 42, 57, 25, 63, 78

(b) An array S[30][20] is stored in the memory along the row with each of the element occupying 2 bytes .find out the memory location for the element S[15][10] , if the base address of the array is 3200.

(3)(c) Write a function voidshowabove(int A[4][4], int R, int C)to display all the elements above the Right Diagonal in a 2D array.

(2)

Page 175: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

(d) Evaluate the following postfix stack notation of expression:(2)

6,7,+,4,*,32,-,5,/(e) Write a function in C++ to perform insertion operation in a circular queue.

(4)4. (a) Observe the program code given below and fill in the blanks marked as Statement1 and

Statement2 using seekg() and tellg() functions for performing the required task:(1)

#include<fstream.h>

class Movie

{

char moviename[25];

charactorname[25];

public:

int count(); // A function to count no.of records

};

int Movie:: count()

{

fstream file;

file.open(“Movie.DAT”,ios::binary| ios::in);

………………………………….. //Statement1

intTotalbytes= …………………….. //Statement2

intnumber_of_records=Totalbytes / sizeof(Movie);

file.close();

returnnumber_of_records;

}

(b) Write a function in C++ to count the number of lowercase alphabets present in a text file “BOOK.TXT”.

(2)

(c) Assume the class STUDENT as declared below

class STUDENT

{

char name[20];

Page 176: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

intstd;

charschoolname[20];

int age;

public:

void register();

void show();

intget_std();//returns std;

}; Write a function BACKUP() in C++, that would copy only those records having std as12 from

“STUDENT.DAT” to “STUDENTBACK.DAT”. (3)

5. (a) What do you understand by degree and cardinality of a table? (2)

(b) Consider the following tables WORKER and PAYLEVEL and answer questions (1) and (2)Table: WORKERECODE NAME DESIGNATION PLEVEL DOJ DOB

11 VinayKatiyar Supervisor P001 13-Sep-2004 23-Aug-1981

12 Ritesh Operator P003 22-Feb-2006 12-July-1987

13 Abhinav Operator P003 14-May-2009 14-Oct-1983

14 Dharaneedhar

Mechanic P002 21-Apr-2008 21-Nov-1985

15 Manoj Clerk P002 22-Dec-2009 24-Jun-1984

Table: PAYLEVEL

PLEVEL PAY ALLOWANCE

P001 26000 12000

P002 24000 10000

P003 18000 6000

1) Write SQL queries for the following statements:(4)

(i) To display details of all Workers in descending order of DOJ.(ii) To display NAME and DESIGNATION of those Workers whose PLEVEL is either P001 or

P002.(iii) To display details of all Workers whose DOB is between 10-Mar-1984 and 31-Dec-1986.(iv) To add a new row with following values:

Page 177: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

16, Ketan, Clerk, P002, 14-Feb-2007, 25-Jan-19842) Write output for the following SQL queries:

(2)(i) Select PLEVEL, count(*) from WORKER group by PLEVEL;(ii) Select Max(DOB), Min(DOB) from WORKER;(iii) Select NAME,PAY from WORKER, PAYLEVEL where WORKER.PLEVEL=PAYLEVEL.PLEVEL and

ECODE>13;(iv) Select PLEVEL,PAY+ALOWANCE from PAYLEVEL where PLEVEL=”P002”;

6. (a) State and prove DeMorgan’s laws in Boolean Algebra. (2)

(b) Draw a logical circuit for the following Boolean expression: (2)

X’. (Y’ + Z )(c) Write SOP form of a Boolean function G, which is represented in a truth as follows:

(1)

P Q R G

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 0

(d) Reduce the following Boolean Expression using K-Map:(3)

F(A,B,C,D) = Σ(2,3,4,5,6,7,8,10,11)7. (a) Differentiate between Bus and Star topology with a neat diagram.

(2)(b) Expand the following:

(2)(i) GSM (ii) CDMA (iii) WLL (iv) SMTP

(c) Knowledge Supplement Organization has set up its new centre at Mangalore for its office and web based activities. It has four buildings Alpha, Beta, Gamma, Lambda. Answers questions (i)to (iv) based on data given.

Center to center distance between various buildings Number of Computers

Alpha to Beta 50m Alpha 25

Page 178: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

Beta to Gamma 150m Beta 50

Gamma to Lambda 25m Gamma 125

Alpha to Lambda 170m Lambda 10

Beta to Lambda 125m

Alpha to Gamma 90m

i) Suggest a cable layout of connections between the buildings(1)

ii) Suggest the most suitable place (i.e. building) to house the server of this organization with a suitable reason.

(1)iii) Suggest the placement of the following devices with justification: ( ½ +

½ ) i. Repeater

ii. Hub/Switch

iv) The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed?

(1)(d) Write the differences between open source and proprietary software.

(1)(e) What is http?

(1)**************

Page 179: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

17

PAPER VI

KENDRIYA VIDYALAYA SANGATHAN

MARKING SCHEME

CLASS XII

Subject: Computer Science

Q.No

Sub Question

Answer Marks

Distribution

1 a) Correct Definition Diagram

Multiple- Hierarchical

1+1

b) ctype.h

math.h

½ + ½

c) Header file stdio.h to be included Colon (:) after public is missing Semicolon (;) at the end of class missing E1.getexamdetails() E1.showexamdetails

½ Mark for each identified error.

d) o9 ½ Mark for each correct line of output

Page 180: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

D8

y7

n6

e) 201:250

202:1250

203:7500

1 Mark for each correct line of output

f) Option (iv) 2 Marks

2 a) Same function name with different number and type of arguments.

1 Mark for definition

1 Mark for example

b) (i) constructor overloading/polymorphism/function over loading.

(ii) destructor, invoked when object goes out of scope

1 Mark each

c) (i) Correct syntax for class and private members declaration

(ii) default constructor

(iii) function setPrice() definition

(iv) function setdetails(), display() definitions

½ + ½

1

1

1

d) (i) Hierarchical inheritance

(ii) Location, Area, Sale

(iii) Enter(),Show(),Register(),ShowC()

(iv) Input(),Output()

1

1

1

1

3 a) Any correct logic 3M

b) 1 mark for formula

2 marks for procedure and result

1+2

c) Any correct logic 2

d) 1 mark for showing step by step stack contents

1 mark for final answer

1+1

e) void insert()

{

If(rear=size-1 && front ==0|| front=rear+1)

4

Page 181: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

{

cout<<”queue full….”;

return;

}

else if( rear= -1){

rear++;

front++;}

else if(rear==size-1)

rear=0;

else

{

rear++;

//add element

}

Any other logic

4 a) File.seekg(0,ios::end)

File.tellg()

½ + ½

b) For correct opening of file 1mark For correct logic for count 1 mark

1+1

c) For correct opening of file 1mark For selecting correct record 1 mark For writing to backup file 1mark

1+1+1

5 a) Degree – No.of columns present in a table

Cardinality – No.of rows present in a table

1+1

b) (1) (i) select * from WORKERS ORDER BY DOJ DESC;

(ii) select NAME,DESIGNATION FROM WORKERS where PLEVEL IN(“P001”, “P002);

(iii) select * from WORKERS where DOB between “10-Mar-1984” and “31-Dec-1986”;

(iv) insert into WORKERS values(16,”Ketan”,”Clerk”,”P002”,”14-Feb-2007”, “25-Jan-1984”);

1+1+1+1

½ + ½ + ½ + ½

Page 182: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

(2) (i) PLEVEL count(*)

P001 1

P002 2

P003 2

(ii) Max(DOB) Min(DOB)

12-July-1987 23-Aug-1981

(iii) NAME PAY

Dharaneedhar 24000

Manoj 24000

(iv) PLEVEL PAY+ALLOWANCE

P002 34000

6 a) (X + Y)’ = X’ Y’

(XY)’ = X’ + Y’

1 Mark each for proof

( algebraically or using truth table)

b) Marks for correct logical circuit 2

c) G= P’QR’+PQ’R’+PQR’ 1

d) One mark for placing all 1’s correctly One mark for grouping properly One mark for final reduced expression

1+1+1

7 a) Correct diagram and explanation 1+1

b) GSM- Global System for Mobile Communication

CDMA- Code Division Multiple Access

WLL- Wireless in Local Loop

SMTP –Simple Mail Transfer Protocol

c) (i) Any possible cable layout

(ii) Gamma, More number of computers

(iii) Repeater- Justification with cable type used

Hub/switch – in all buildings

(iv) Any wireless technology can be given 1 Mark

1+1+1+1

Page 183: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

d) Any two difference ½ + ½

e) Definition 1

Page 184: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

PAPER VII

Subject: Computer Science(083)Weightage to different topics/content units

S. No

UNIT VSA

1 Mark

SA I

2 Marks

SA II

3 Marks

LA

4 Marks

Total

1 Review of C++ covered in Class XI 1 (1) 8 (4) 3 (1) 12 (6)

2 Object Oriented Programming in C++

a) Introduction to OOP using C++

b) Constructor & Destructor

c) Inheritance

2 (1)

2 (1)

4 (1)

4 (1)

6 (2)

2 (1)

4 (1)

3 Data Structure & Pointers

a) Address Calculation

b) Static Allocation of Objects

c) Dynamic Allocation of Objects

d) Infix & Postfix Expressions

2 (1)

2 (1)

3 (1)

3 (1)

4 (1)

3 (1)

5 (2)

4 (1)

2 (1)

4 Data File Handling in C++

a) Fundamentals of File Handling

b) Text File

c) Binary Files

1 (1)

2 (1)

3(1)

1 (1)

2 (1)

3 (1)

5 Databases and SQL

a) Database Concepts

b) Structured Query Language

2 (1)

2 (1) 4 (1)

2 (1)

6 (2)

6 Boolean Algebra

a) Introduction to Boolean Algebra & Laws 2 (1) 2 (1)

Page 185: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

b) SOP & POS

c) Karnaugh Map

d) Basic Logic Gates

1 (1)

2 (1)

3 (1)

1 (1)

3 (1)

2 (1)

7 Communication & Open Source Concepts

a) Introduction to Networking

b) Media, Devices, Topologies & Protocols

c) Security

d) Webservers

e) Open Source Terminologies

2 (2)

2 (2)

1 (1)

1 (1)

4 (1)

2 (2)

4 (1)

2 (2)

1 (1)

1 (1)

TOTAL 9 (9) 26 (13) 15 (5) 20 (5) 70 (32)

Page 186: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

Paper – VII

Sub. – Computer Science (083)

Duration : 3 hrs M.M.-70

Instructions:

i. All Questions are Compulsory. ii. Programming Language: C++

1 (a) Give the difference between object oriented programming and procedural programming?

2

(b) Find the output of the following program

#include<iostream.h>

void Withdef(int HisNum=30)

{ for (int I=20;I<=HisNum;I+=5)

cout<<I<<”,”;

cout<<endl;

}

void Control(int &MyNum)

{

MyNum+=10;

Withdef(MyNum);

}

void main()

{ int YourNum=20;

Control(YourNum);

Withdef();

cout<<”Number= “<<YourNum<<endl;

}

2

(c) Name the header file to be included for the use of following built in function

(i) frexp() (ii) puts() (ii)) setw() (iv) islower()

4

(d) Rewrite the following program after removing syntactical error(s) if any underline each correction.

#included < iostream.h>

2

Page 187: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

void main()

{ First =10, Second = 20;

Jumpto(First,Second);

Jumpto(second); }

void Jumpto(int N1, int N2=20)

{ N1=N1+N2

cout<<N1>>N2;}

(e) Find the output of the following program :

#include<iostream.h>

#include<ctype.h>

void Encrypt(char T[])

{ for(int i=0;T[i]!=’\0’;i+=2)

if(T[i]==’A’ || T[i]==’E’) T[i]==’#’;

else if (islowar(T[i])) T[i]=toupper(T[i]);

else T[i]=’@’;

}

void main()

{ char Text[]=”SaVE EArtH”;

Encrypt(Text);

cout<<Text<<endl;

}

2

(f) Read the following C++ code carefully and find out which of the given options (i) to (iv) are the expected correct output(s) of it. Also, write the maximum and minimum value that can be assigned to the variable Taker used in the code :

void main()

{ int GuessMe[4]={ 100,50,200,20};

int Taker=random(2)+2;

for(int Chance=0;Chance<Taker; Chance++)

cout<<GuessMe[Chance]<<”#”;

2

Page 188: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

}

(i) 100# (ii) 50#200#(ii) 100#50#200# (iv) 100#50

2(a) What is destructor? Give any two characteristics of destructors. 2

(b) Observe the following program and answer the question (i) and (II). #include<iostream.h>

#include<string.h>

class AirIndia

{

char flightno[5];

int noofpassenger;

public:

AirIndia() // FUNCTION 1

{ strcpy(flightno,””);

noofpassenger=0;

}

AirIndia(char str, int n) // FUNCTION 2

{

strcpy(flightno,str);

noofpassenger=n;

}

void input() // FUNCTION 3

{ cin>>flightno;

cin>>noofpassenger;

}

~AirIndia() // FUNCTION 4

{ cout<<”counter closed”<<endl;}

};

(i) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 2? Write the statement to call theses function.

(ii) What is the scope of two data members of the class AirIndia? What does the scope of data members depend upon?

2

Page 189: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

18

(c) Define a Class BOOK with the following specification

Private Members of the class BOOK are

BOOK_NO integer type

BOOK_TITLE 20 characters

PRICE float (price per copy)

TOTAL_COST() a function to calculate the total cost for

N number of copies Where N is passed to

the function as arguments

Public Members of the class BOOK are

INPUT() function to read BOOK_NO,BOOK_TITLE, PRICE

PURCHASE() function to accept input the number of copies

to be purchase It invoke TOTAL_COST() and

print the total cost to be paid by user

4

(d) Consider the following class declaration and answer the questions (i) - (iv)

class Trainer

{

char Tno[5], Tname[20];

int Days;

protected:

float Remu;

void Assign();

public:

Trainer();

void TEntry(); void TDisplay();

};

class Learner

{

char Regno[10],LName[15],Program[10];

4

Page 190: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

protected:

int Attendance, Grade;

public:

Learner();

void LEntry(); void LDisplay();

};

class Institute : public Learner, public Trainer

{

char ICode[10],IName[20];

public:

Institute();

void IEntry(); void IDisplay();

};

(a) Which type of inheritance is depicted by the above example?(b) Identify the member function(s) that cannot be called directly from the objects

of class Institute from the followingTEntry()

LDisplay()

IEntry()

(c) Write name of all the member(s) accessible from member functions of class Institute.

(d) If class Institute was derived privately from class Learner and privately from class Trainer then name the member function(s) that could be accessed through Objects of class Institute.

Page 191: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

3.(a) Wrtie a function Exchange(int A[],int B[], int Size) in C++ to create the elements of Array B{ } with the help of corresponding erlements of Array A{ } i.e. if A{N} is positive number, B[N} should be 1. IF A[N] is negative number, B[N] should be -1 and if A[N] is zero, B[N] should also be 0.

For Example

If the contenct of the Array A is

-78,25,0,-58,-47,32

The content of the Array B should become

-1,1,0,-1,-1,1

2

(b) An array A[10][20] is stored in the memory along with column, with each of the element occupying 2 bytes, find out the memory location for element A[2][5], if an element A[5][10] is stored at the memory location 3020.

3

(c) Each node of a STACK contains the following information , in addition to required pointer field

(i)Roll number of the student (ii)Age of the student Give the structure of the node for the linked stack in question TOP is a pointer points to the topmost node of the STACK. Write the following function (i) PUSH() – to push a node in to the stack which is allocated dynamically.(ii) POP()- to remove a node from the stack and release the memory

4

(d) Write a user-defined function Upper-half() which takes a two dimensional array A, with size N rows and N columns as argument and point the upper

half of the array. e.g. O/P

2 3 1 5 0 2 3 1 5 0

7 1 5 3 1 1 5 3 1

2 5 7 8 9 7 8 9

3 8 9 0 3 0 3

1 3 4 7 6 6

2

(e) Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.

(A-B) * (C / D) + E

2

4.(a) Observe the program segment given below carefully, and fill in the blanks

marked as Statement 1 and Statement 2 using seekg(), seekp(), tellp()

Page 192: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

and tellg() functions for performing the required task.

#include<iostream.h>

class Product

{ int Pno;

char PName[20];

int Qty;

public:

:

void ModifyQty();

};

void Product :: ModifyQty()

{ fstream File;

File.open(“PRODUCT.DAT”,ios::binary | ios:: in | ios::out);

int MPno;

cout<<”Enter product no to modify”;

cin>>MPno;

while(File.read((char *)this,sizeof(PRODUCT)))

{ if(MPno = = Pno)

{ cout<< “Present Quantity :”<<Qty<<endl;

cout<<”changed Quantity:”;

cin>>Qty;

int Position = _________ ; //Statement 1

____________________ ; //Statement 2

File.write((char * this, sizeof(PRODUCT));

}

}

File.close();

}

(b) Write a function in C++ to count the number of spaces present in a text file

“ABC.TXT”.

2

Page 193: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

(c) Assuming a Binary file Film.dat is containing objects belonging to a class Film(as defined below). Write a user defined function in C++ to add more objects belonging to class Film at the bottom of it.

class Film

{ char Fgrade;

char lang[10];

char filmDesc[250];

public:

void NewFilmEnty()

{ cin>>Fgrade;

gets(lang);

gets(filmDes);

}

void ShowFilm()

{

cout<<Fgrade<<”:”<<lang<<endl<<filmDes<<endl;

}

};

3

5 (a) What are primary key and candidate key in a table? 2

(b) Study the following tables DOCTOR and SALARY and write commands for question number (i) to (iv)and give outputs for SQL queries (v) to (vi).

DOCTOR

ID NAME DEPT SEX EXPERIENCE

101 JOHN ENT M 12

104 SMITH ORTHOPEDIC M 5

107 GEORGE CARDIOLOGY M 10

114 LARA SKIN F 3

109 K GEORGE MEDICINE F 9

105 JOHNSON ORTHOPEDIC M 10

117 LUCY ENT F 3

111 BILL MEDICINE F 12

6

Page 194: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

130 MORPHY ORTHOPEDIC M 15

SALARY

ID BASIC ALLOWANCE CONSULATION

101 12000 1000 300

104 23000 2300 500

107 32000 4000 500

114 12000 5200 100

109 42000 1700 200

105 18900 1690 300

130 21700 2600 300

(I) Display NAME of all Doctors who are in MEDICINE having more than 10 year experience from the Table DOCTOR.

(II) Display the average salary of all doctors working in ENT department using the table DOCTOR and SALARY.salary=BASIC + ALLOWANCE

(III) Display the minimum ALLOWANCE of female doctors.(IV) Display the highest consultation fee among all male doctors.(V) SELECT count(*) from DOCTOR where SEX=”F”;(VI) SELECT NAME,DEPT, BASIC from DOCTOR, SALARY WHERE DEPT=”ENT” AND

DOCTOR.ID=SALARY.ID;6. (a) State and verify Idempotence law. Verify the law using truth table 2

(b) Write the equivalent expression for the following logical circuit. 1

(c) Convert the following Boolean expression into its equivalent Canonical Product of Sum Form (POS).

A.B’.C+A’.B.C+A’B.C’

2

(d) If F(a,b,c,d)=Σ(0,2,4,5,7,8,10,12,13,15), obtain the simplified form using K-Map. 3

7. (a) What is a HUB? 1

Page 195: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

(b) Name two switching techniques used to transfer data between two terminals (computers) 1

(c) Write two characteristics of Web 2.0. 1

(d) Expand the following abbreviations :

(1) GSM (2) SMS

1

(e) Write one difference between internet and intranet. 1

(f) What is cookies? 1

(g) Nagpur University is setting up its Academic school at Campus and planning to set up a network. The university has 3 academic schools and one administration center as shown in the diagram bellow:

Law school to Business school 60m

Law school to Technology School 90m

Law school to Admin Center 115m

Business school to Technology School

40m

Business school to Admin Center 45m

Technology school to Admin Center 25m

Law school 25 computers

Technology school

50 computers

Admin center 125 computers

Business school 35 computers

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

(iv) The university is planning to connect its admission office in the closest big city, which is more than 250 km from university, which type of network out of LAN, MAN or WAN will be

4

Page 196: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

formed. Justify your answer.

Page 197: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

MARKING SCHEME

Q.NO.

ANSWER MARKS DISTRIBUTION

1 (a) The difference between object oriented programming and procedural programming are as given below:

Object Oriented Programming

i. It emphasis on objects.

ii. It treated data and functions are single entity.

Procedural Programming

i. It emphasis on procedure.

ii. It treated data and functions are separate entities.

1 mark for each correct difference between them.

(b) 20,25,30

20,25,30

Number =30

1 /2 marks for each correct line of answer

+ ½ marks for complete answer

(c) (i) math.h

(ii) stdio.h

(ii) iomanip.h(iv) ctype.h

1 mark for each correct answer

(d) #included < iostream.h>

void main()

{ int First =10, Second = 20;

Jumpto(First,Second);

Jumpto(Second);

}

void Jumpto(int N1, int N2=20)

{ N1=N1+N2;

cout<<N1<<N2;

}

½ marks for each correction

(e) @a@E@E#rTH ½ mark for first two characters.

Page 198: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

½ mark for next two characters

½ mark for next three characters

½ mark for next three characters.

(f) Option (ii) 100#50#200#

Minimum Value=0

Maximum Value=3

1 Mark for correct option.

½ mark for min. value

½ mark for max. value

2(a) A destructor is a special member functions whose task is to destroy the objects that have been created by a constructor.

a. The name of constructor and class must be same.b. Destructor is preceded by tilde sign (~).c. They are invoked automatically whenever the scope of

object gets over.

1 Mark for correct definition

½ marks for any two characteristics.

(b) (i) CONSTRUCTOR OVERLOADING concept

To call function 1 – AirIndia ();

To call function 2- AirIndia(“F1”,20)

(ii) The scope of two data members of class AirIndia is private. These members can be access only by the member function of class. They may not be access directly by using object

½ mark for concept

½ mark for calling function (with parameter and without parameter)

1 marks for scope + member access

(c) class BOOK { int BOOK_NO;

char BOOK_TITLE[20];

float PRICE ;

float TOTAL_COST(int N)

{ float TOTAL;

TOTAL=N*PRICE;

return TOTAL;

}

public :

void INPUT()

1 marks for define class

1 marks for public members

1 marks for define private members

1 marks for calling function

Page 199: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

19

{ cout<<”\n Enter Book no.”;

cin>> BOOK_NO;

cout<< “\n Enter Book Title”;

gets(BOOK_TITLE);

cout<<”\n Enter Price:”;

cin>>PRICE;

}

void PURCHASE ();

{ int n;

flaot TOT;

cout<<”\n Enter No of copies”;

cin>>n;

TOT=TOTAL_COST(n);

cout<<”\n total Amount is:”TOT;

}

};

(d) (a) Multiple Inheritance

(b) None

(c) Data Members

Remu, Attendance, Grade,ICode, Iname

Member Functions

Assign(), TEntry(), TDisplay(),LEntry(),

LDisplay(), IEntry(),IDisplay()

(d) IEntry(), IDisplay()

1 mark for each correct answer.

3(a) void Exchange(int A[ ], int B[ ], int Size[ ])

{

int i;

for(i=0;i<Size;i++)

{

if(A[i]<0)

1 mark for prototype

1 mark for correct logic.

Page 200: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

B[i]=-1;

else

B[i]=1;

}

for(i=0;i<Size;i++)

cout<<B[i]<<”\t”;

}

(b) In column major arrangement , address of a particular location (I,J) is calculated as

Address[I][J]= B+W[n(J-0)+(I-0)

Here B is base Address , W is element size

n- number of rows

given is

A[5][10]=B+W[10(10-0)+(5-0)]

3020=B+2[10*10+5]

3020=B+2*105

B= 2810

Now base address for the array is 2810

Now calculate the same for A[2][5]

A[2][5]= 2810+2[10(5)+2]

A[2][5]=2810+2(50+2)

A[2][5]=2810+104

A[2][5]=2914

1 marks for formula

1/2 marks for implementation of formula

1/2 marks for result

(c) struct STACK

{ int rollno, age;

STACK *next;

} *top, *nptr,*ptr;

void pop()

{ if (!top)

½ marks for define stac k

½ mark for variable and pointer declaration

1 & ½ marks for pop operation

1 & ½ marks for push

Page 201: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

{ cout<<”\n Underflow”;

exit(1);

else

{ cout<<’\n’<<top->roll no<<’\t’<top->age;

ptr=top;

top=top->next;

ptr->next=NULL;

delete prt;

}

}

void push

{ nptr= new STACK; /// allocate memory

cout<<”\n Enter roll number & age to insert”;

cin>>nptr->rollno>>nptr->age;

nptr ->next=NULL;

if (!top) top=nptr’

else

{ ptr->next=top;

top=nptr;

}

}

(d) void Upper_half( int A[10][10], int N)

{

int i,j;

for(i=0;i<N;i++)

{

for(j=0;j<N;j++)

{

if(j>=i)

{

1 mark for correct function header

1 mark for correct logic

Page 202: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

cout<<A[i][j]<<”\t”;

}

else

{

cout<<”\t”;

}

}

cout<<endl;

}

}

(e) AB-CD/*E+ 1 mark for stack representation

1 mark for correct answer

4.(a) int Position=File.tellg(); //Statement 1

File.seekp((Position-sizeof(Product), ios::beg); //Statement 2

½ Mark for Statement 1

½ Mark for Statement 2

(b) void display()

{

ifstream ifs(“ABC.TXT”);

int c=0;

char ch;

while(ifs)

{

ifs.get(ch);

if(ch==’ ‘)

c++;

}

cout<<”\n The no. of spaces =”<<c;

ifs.close();

}

½ mark for opening the file.

½ mark for correct use of loop.

½ mark for checking with space.

1/2 mark for correct increment.

Page 203: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

(e) void add( )

{

fstream f;

Film fm;

f.open(“Film.dat”,ios::binary|ios::app);

int i,n;

cout<<”\n Enter the no. object to be added”;

cin>>n;

for(i=1;i<=n;i++)

{

Fm.NewFilmEnty();

f.write((char *)&Fm, sizeof(Fm));

}

f.close();

}

1 mark for opening and closing the file.

1 mark for correct use of loop.

1 mark for correct logic.

5 (a) Primary Key :- A primary key is a set of one or more attributes that can uniquely identify tuples within the relation.

Candidate Key:- All attribute combinations inside a relation that can serve as primary key are candidate key.

1 mark for Primary key definition.

1 mark for Candidate key definition.

(b) (i) SELECT NAME FROM DOCTOR WHERE DEPT=’MEDICINE’ AND EXPERIENCE >10;

(ii) SELECT avg(BASIC+ALLOWANCE) FROM Salary, Doctor WHERE (DEPT=’ENT’ and Doctor.ID = Salary.ID);

(iii) SELECT min(ALLOWANCE) FROM Salary, Doctor WHERE (SEX=’F’ and Doctor.ID = Salary.ID);

(iv) SELECT CONSULTATION FROM SALARY, DOCTOR WHERE SEX=’M’ AND DOCTOR.ID=SALARY.ID;

(v) 4

(vi) NAME DEPT BASIC

John ENT 12000

1 mark for each correct answer.

Page 204: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

6 (a) Idempotence Law

(i) x + x = x (ii) x . x = x

1 marks for writing law

1 marks for prove it by truth table

(b)

A’B+AB+AB’

1 marks for framing expression

1 marks for steps to get answer

(c) Given A.B’.C + A’.B.C + A’.B.C’

(1 0 1) (0 1 1) (0 1 0)

=M5 +M3 + M2

=∑(2,3,5)

=> POS is equal to (excluding position of minterms)

=π(0,1,4,6,7)

=M0.M1.M4.M6.M7

=(A+B+C) (A+B+C’) (A’+B+C) (A’+B’+C) (A’+B’+C’)

1 mark for summation result.

1 mark for POS result.

(d) F(a,b,c,d)=Σ(0,2,4,5,7,8,10,12,13,15) F(a,b,c,d)=B1+B2+B3 B1=m0+m4+m12+m8==c’d’ B2=m5+m7+m13+m15=bd B3=m0+m2+m8+m10=b’d’ F(a,b,c,d)=c’d’+bd+b’d’

1 marks for framing terms

1 marks for solving steps

1 marks for draw K map

Page 205: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

7 (a) A HUB is a Hardware device used to connect several computers together

1 marks for definition

(b) Packet switching , Circuit switching ½ marks for each switching

(c) 1. Web 2.0 refers to added features and applications to WWW that make the web more interactive, support easy online-information exchange and interoperability.

2. It provides blogs, wikis, video-sharing websites, social networking websites, RSS etc.

1 mark for each character

(d) 1. GSM- Global System Mobile for Communication

2. SMS- Short Message Services

½ mark for each correct abbreviations.

(e) Intranet is designed for private space while internet is an open, public space.

1 mark for difference between.

(f) Cookies are messages that a web server transmits to a web browser so that web server can keep track of user’s activity on a specific web site.

1 mark for correct definition.

(g) (i) Admin Center because it contains maximum number of computers.(ii) BUS topology is the best suitable cable layout.

(iii) Switch

(iv) WAN because LAN and MAN cannot cover 250 kms.

1 marks for each correct answer

Page 206: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

Page 207: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

PAPER VIII

SUBJECT : COMPUTER SCIENCE (083)

DESIGN OF QUESTION PAPER

Time: 3 hours Max. Marks: 70

A. Weightage to different topics/ content units

S.No. Topics Marks

1. Review of C++ covered in class XI 12

2. Object oriented programming in C++ 12

3. Data Structures & Pointers 14

4. Data File Handling in C++ 06

5. Databases and SQL 08

6. Boolean Algebra 08

7. Communication and Open Source Concepts 10

Total 70

B. Weightage to different FORMS OF QUESTIONS

S.No. Forms of Questions Marks for each question

No. of Questions

Total Marks

1. Very Short answer questions (VSA) 01 09 09

2. Short answer questions - Type I (SA-I) 02 13 26

3. Short answer questions - Type II (SA-II) 03 05 15

4. Long Answer Questions (LA) 04 05 20

Total 32 70

Page 208: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

20

SUBJECT: COMPUTER SCIENCE (083)

BLUE PRINT OF QUESTION PAPER

S.No. UNIT VSA

(1 Mark)

SA I

(2 Marks)

SA-II

(3 Marks)

LA

(4 Marks)

Total

1. Review of C++ covered in class XI 1(1) 8(4) 3(1) 12(6)

2. Object Oriented Programming in C++

(d) Introduction to OOP using C++ 2(1) 4(1) 6(2)

(e) Constructor & Destructor 2(1) 2(1)

(f) Inheritance 4(1) 4(1)

3. Data Structure & Pointers

(e) Address Calculation 3(1) 3(1)

(f) Static Allocation of objects 2(1) 3(1) 5(2)

(g) Dynamic Alocation of Objects 4(1) 4(1)

(h) Infix & Postfix expressions 2(1) 2(1)

4. Data File Handling in C++

(d) Fundamentals of File Handling 1(1) 1(1)

(e) Text File 2(1) 2(1)

(f) Binary File 3(1) 3(1)

5. Databases and SQL

(c) Database Concepts 2(1) 2(1)

(d) Structured Query Language 2(1) 4(1) 6(2)

6. Boolean Algebra

(a) Introduction to Boolean Algebra & Laws 2(1) 2(1)

(b) SOP & POS 1(1) 1(1)

(c) Karnaugh Map 3(1) 3(1)

(d) Basic Logic Gates 2(1) 2(1)

7. Communication & Open Source Concepts

(f) Introduction to Networking 2(2) 2(2)

Page 209: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

General Instructions

All Questions are Compulsory. Language is C++. Please check that this question paper contains 7 questions. Please write down the serial number of question before attempting it. 15 minutes extra should be given to read the question paper. During this reading time students will read

the question paper only and will not write anything on answer-sheet during this period.

20

(g) Media. Devices. Topologies & Protocols 4(1) 4(1)

(h) Security 2 (2) 2(2)

(i) Webservers 1(1) 1(1)

(j) Open Source Terminologies 1(1) 1(1)

Total 9(9) 26(13) 15(5) 20(5) 70(32)

COMPUTER SCIENCE (083)

PAPER- VIII

CLASS XII

MAX. MARKS: 70 TIME: 3:00 Hrs

Page 210: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

1 (A) What is Global & Local variable? Explain with Example. 2

(B) Observe the following code and write the name(s) of the header files essentially required to compile it.

void main()

{

char ch; cin>>ch;

int x=isdigit(ch);

if(x)

cout<<”It is a digit”;

}

1

(C) Find out the syntax errors (if any) in the following program. (Assuming all the required header files are included.

typedef char[30] string;

void main()

{

string s;

for(i=0,i<10,i++)

s[i]=65+i;

s[i]="\0";

cout<<s;

}

2

(D) Find the output of the following program.

#include<iostream.h>

void main()

{

int a[]={5,10,15,20,25,30};

int *p=a+3;

for(int i=0;i<3;i++)

{

p[i]=a[i];

a[i]=p[i]*2;

}

for(i=0;i<6;i++)

cout<<*(a+i)<<" ";

3

Page 211: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

(E) Find the output of the following program.

#include <iostream.h>

#include<string.h>

void encode(char S[ ])

{

int L=strlen(S);

for (int C=0;C<L/2;C++)

if (S[C]=='A' || S[C]=='E')

S[C]='#';

else

{

char T=S[C];

S[C]=S[L-C-1];

S[L-C-1]=T;

}

}

void main()

{

char Text[ ]="AISSCE 2015";

encode(Text);

cout<<Text<<endl;

}

2

(F) In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)?

#include <iostream.h>

#include <stdlib.h>

void main()

{

int Guess;

randomize();

2

Page 212: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

cin>>Guess;

for (int I=4;I>=1;I--)

{

New=Guess+random(I);

cout<<(char)New;

}

}

(i) ACBA (ii) BBCA

(iii) CDBA (iv) DABA

2. (A) What do you understand by Data Encapsulation and Data Hiding? 2

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

class Exam

{

int year;

public :

Exam(int y) { year=y; } //constructor 1

Exam(Exam &t); //constructor 2

}

(iii) Create an object, such that it invokes constructor 1.(iv) Write complete definition for constructor 2.

2

(C) Define a class Show in C++ with the description given below:

Private Members:

name_of_Show of type character array(string)

date_of_release of type character array(string)

name_of_director of type character array(string)

star of type int

total_print_release of type int

Public Members:

4

Page 213: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

A constructor to assign initial values as follows:

name_of_Show NULL

date_of_release 1_1_2007

name_of_director NULL

star 2

total_print_release 100

A function calculate_star() which calculates and assigns the value of data member Star as follows:

Total Print Release Star

>= 1000 5

< 1000 & >=500 4

< 500 & >=300 3

< 300 & >=100 2

< 100 1

A function EnterShow() to input the values of the data members name_of_Show, date_of_release, name_of_director and total_print_release and invokes the function calculate_star( ).

A function DisplayShow() which displays the contents of all the data members for a play.

(D) class COMP { private : char Manufacturer [30];

char addr[15]; public: toys( ); void RCOMP( ); void DCOMP( ); };class TOY: public COMP{ private: char bcode[10]; public:

double cost_of_toy; void RTOY ( ); void DTOY( ); }; class BUYER: public TOY

{ private: char nm[30];

char delivery date[10];

char baddr;

4

Page 214: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

public: void RBUYER( ); void DBUYER( ); };void main ( ){ BUYER MyToy; }

iv) Mention the member names that are accessible by MyToy declared in main( ) function.

v) Name the data members which can be accessed by the functions of BUYER class.

vi) Name the members that can be accessed by function RTOY( ). (iv) How many bytes will be occupied by the objects of class BUYER?

Page 215: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

3. (A) Write a function in C++ which accepts an integer array and its size as

arguments/parameters and exchanges the values of first half side elements with the second half side elements of the array. 3

Example:

If an array of eight elements has initial content as

2,4,1,6,7,9,23,10

The function should rearrange the array as

7,9,23,10,2,4,1,6

2

(B) An array PP[20][25] is stored in the memory along the row with each of the elements occupying 4 bytes. Find out the memory location for the element PP[13][20], if the element PP[7][10] is stored at memory location 3454.

3

(C) Write a function in C++ to display the sum of all the positive and even numbers , stored in a two dimensional array. The function prototype is as follows:

voidSumPosEven(int Array[5][5]);

3

(D) Write a function in C++ to perform insert operation on a dynamically allocated Queue. struct Node

{

int Code;

char Description[10];

Node * link;

}

4

(E) Evaluate the following postfix notation of expression :(Show status of Stack after each operation)

True,False,NOT,OR,False,True,OR,AND

2

4. (A) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task.

#include <fstream.h>

class Employee

{

int Eno;char Ename[20];

1

Page 216: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

public:

//Function to count the total number of records

int Countrec();

};int Item::Countrec()

{ fstream File;

File.open(“EMP.DAT”,ios::binary|ios::in);

______________________ //Statement 1

int Bytes = ______________________ //Statement 2

int Count = Bytes / sizeof(Item);

File.close();

return Count;

}

(B) Write a function in C++ to read the content of a text file “PLACES.TXT” and display all those lines on screen, which are either starting with ‘P’ or starting with ‘S’.

2

(C) Write a function in C++ to search for a Pcode from a binary file “PRODUCT.DAT”, assuming the binary file is containing the objects of the following class.

class PRODUCTS

{

int Pcode;

char Pname[20];

float Price;

public :

void getproducts()

{

cin>>Pcode>>Pname>>Price;

}

3

Page 217: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

void showproducts()

{

cout<<Pcode<<Pname<<Price<<endl;

}

int *getproduct()

{

return Pcode;

}

};

Q.5. (A) What do you understand by Candidate Keys in a table ? Give a suitable example. 2

(B) Consider the following tables SHOP and SUPPLIER and answer the following questions:

TABLE : SHOP

TABLE : SUPPLIER

SCODE SNAME

11 Arya Stationers

12 Stationery House

13 Sapna Stores

Write SQL commands for the following statements i to iv and Output for v to viii

(I) To display details of all the items in the shop table in ascending order of

Buydate. 1 Mark

1

ICODE INAME SCODE QTY RATE BUYDATE

1005 Note Book 13 120 24 03-May-13

1003 Eraser 12 80 5 07-Aug-13

1002 Pencil 12 300 10 04-Mar-13

1006 Bag 11 70 300 27-Dec-12

1001 Pen 13 250 20 18-Jul-13

1004 Sharpener 12 100 10 23-Jun-13

1009 Box 11 50 80 17-Dec-12

Page 218: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

(II) To display ICODE and INAME of the items with QTY more than 100. 1

(III) To diplay the ICODE, INAME and TOTAL AMOUNT of each item ( TOTAL AMOUNT is the product of QTY and RATE.

1

(IV) To display SCODE and Number of items supplied for each Supplier. 1

(V) SELECT COUNT (DISTINCT SCODE) FROM Shop; ½

(VI) SELECT SUM(QTY) FROM Shop where SCODE=11; ½

(VII) SELECT INAME, SNAME FROM Shop S, Supplier P WHERE S.Scode =

P.Scode AND ICODE = 1006 ;

½

(VIII) SELECT MIN (BUYDATE) FROM Store ; ½

6. (A) Prove that A+ A B=A+B 2

(B) Draw the logic circuit for the following Boolean expression((A+B')(B+C)')'

2

(C) A B C F0 0 0 10 0 1 00 1 0 10 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1

Write the POS expression for the Boolean function given by the above truth table:-

1

(D) Minimize the given Boolean function using k-map and draw the logic circuit for the reduced expression.

F(A,B,C,D)=∑(0,1,2,4,5,6,8,12)

3

7. (A) What is WAN? What does the MAC address refer to? 1

(B) Define the term Bandwidth. 1

(C) Which of the following is/are not a Client Side script:

(i) PHP (ii) Java Script (iii) VB Script (iv) ASP

1

(D) What is the use of Cloud Computing? 1

“Eduminds University” is starting its first campus in a small town Parampur of Central India with its central admission office in Delhi. The University has 3 major

Page 219: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

21

buildings comprising of Admin building, Academic Building and Research Building in the 5 KM area Campus.

As a network expert, you need to suggest the network plan as per (i) to (iv) to the authorities keeping in mind the distances and other given parameters.

(E)

INDIA

Expected wire distances between various locations:

Research Building to Admin Building 90m

Research Building to Academic Building 80m

Academic Building to Admin Building 15m

Delhi Admission Office to Parampur campus 1450Km

Expected number of computers to be installed at various locations in the University are as follows:

Research Building 20

Academic Building 150

Admin Building 35

Delhi Admission Building 5

(v) Suggest to the authorities, the cable layout amongst various buildings inside University campus for connecting the buildings.

(vi) Suggest the most suitable place (i.e. building) to house the server of this organization with a suitable reason.

(vii) Suggest an effective device from the following to be installed in each of

4

Eduminds University

Parampur Campus

Academic

Building

Research

Building

Admin

Building

Delhi Admission Office

Page 220: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

the buildings to connect all the computers: Gateway Modem Switch

(viii)Suggest the most suitable (very high speed) service to provide data connectivity between Admission building located in Delhi and the campus located in Parampur from the following options:

Telephone line Fixed line Dial-up connection Co-axial Cable Network GSM Satellite Connection

(F) Write the full forms of the followings:

(iii) XML(iv) FLOSS

1

(G) Write one advantage and one disadvantage of BUS topology. 1

Paper- VIII MARKING SCHEME

Q.1 (A) 1 Marks for correct definition & 1 Marks for Example.

(B) iostream.h, ctype.h – ½ mark for each file name

(C) typedef char string[30]; - ½ mark for each correction

void main()

{

string s;

for(int i=0 ; i<10 ; i++)

s[i]=65+i;

s[i]='\0';

cout>>s;

}

(D) 10 20 30 5 10 15 – ½ mark for each correct value

(E) #102 ECSSI5 – 2 mark for the correct output

(F) (i) & (iv) – 1 mark for each

2. (a) Data Encapsulation: Wrapping up of data and function together in a single unit is known as Data Encapsulation. In a class, we wrap up the data and function together in a single unit.

Data Hiding: Keeping the data in private visibility mode of the class to prevent it from accidental change is known as Data Hiding.

Page 221: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

class Computer

{

char CPU[10];int RAM;

public:

void STOCK();

void SHOW();

};

(1 Mark for each definition and explanation)OR(Full 2 marks for explaining both with the help of an example)

(B) i. Exam E1(2007);

ii. Exam(Exam &t)

{

year=t.year;

}

1 mark for Each correct answer

(C) class show

{

char name_of_show[20];

char date_of_release[20], name_of_director[20];

int star;

int total_print_release;

public:

show()

{

strcpy(Nameofshow,” ”);

strcpy(dateof release,”1_1_2007”);

strcpy(nameof director,” ”);

Data Hiding

Data Encapsulation

Page 222: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

star=2;

totalprintrelease=100;

}

calculate_star()

{

if(totalprintrelease >=1000)

star =5;

else if(totalprintrelease >=500)

star=4;

else if(totalprintrelease >=300)

star=3;

else if(totalprintrelease >=100)

star =2;

else

star =1;

}

void EnterShow(){gets(name_of_Show,);gets(date_of_release); gets(name_of_director); cin>>total_print_release;calculate_star();}

void DisplayShow(){cout<< name_of_Show<<date_of_release;cout<< name_of_director<<total_print_release<<Star;}(½ Mark for correct syntax for class header)(½ Mark for correct declaration of data members)(½ Mark for constructor)(1 Mark for calculation of correct star for each condition)(1 Mark for correct definition of EnterShow() with proper invocation of calculate_star()) (½ Mark for correct definition of function DisplayShow())

(D) iv. RBUYER(), DBUYER(),RTOY(), DTOY(),RCOMP(), DCOMP(), Cost_of_toy

v. nm,baddr,delieverdate,cost_of_toy

Page 223: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

vi. Members functions : Bcode,cost_of_toy,DTOY(),RCOMP(),DCOMP(), RBUYER(), DBUYER(),

Data Member s: nm, baddr,delieverdate iv 104 bytes

Q.3 (A) void Exchange (int A [ ], int N)

{

for (int I=0;I<N/2;I++)

{

int Temp=A[I];

A[I]=A[N/2+I];

A[N/2+I]=Temp;

}

}

OR

void Exchange(int A[], int N)

{

for (int I=0,J=N/2;I<N/2;I++,J++)

{

int Temp=A[J];

for (int K=J;K>I;K--)

A[K]=A[K-1];

A[I]=Temp ;

}

}

Any other equivalent logic producing the correct result

[1 Mark for correct formation of loop]

[1 Mark for exchanging the content correct

(B) FOR ROW-MAJOR

A[I][J]=B + W[N(I-1) + (J-1)]

PP[7][10]=B+4[25*(6) + 9] ½ mark

3454=B+636

Page 224: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

B=28181 mark

PP[13][20]=2818+4[25*(12) +1 9] ½ mark

PP[13][20] =40941 mark

(C) void SumPosEven( intArr[5][5])

{ int s=0;

for(inti=0;i<5;i++) ½ mark

for(int j=0;j<5;j++) ½ mark

{ if(Arr[i][j]>0) ½ mark

{ if(Arr[i][j]%2==0) ½ mark

s=s+Arr[i][j]; ½ mark

}

}

cout<<”Sum of Positive even numbers=”<<s; ½ mark

return;

}

(D) voidins_Queue(Node * rear)

{

Node * nptr=new Node; ½mark

cout<<”\n Enter the value for Code::”;

cin>>nptr-> code;

cout<<”\n Enter the value for Description::”;

gets(nptr-> description); 1½mark for assigning values

nptr->link=Null;

if(rear = = Null)

front=rear=nptr; 1mark

else

{ rear->link=nptr; ½mark

rear=nptr; ½mark

Page 225: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

}

}

(E) The operation is as follows: 2mark

Elements Scanned Stack

TrueFalseNOTORFalseTrueORAND

TrueTrue, FalseTrue, TrueTrueTrue, FalseTrue, False, TrueTrue, TrueTrue

Result : True

Q.4 (A) File.seekg(0,ios::end); //statement1 1 (½ Mark for each correct statement)

File.tellg(); //statement2

(B) void readfile( )

{ ifstream fin;

fin.open(“PLACES.TXT”);

char line[256];

while (!fin.eof( ))

{ fin.getline(line,255);

if (line[0]= = ‘P’ || line[0]==’S’)

cout<< line;

}

fin.close();

}(½ mark for correct syntax of function header and opening the file in ‘in’ mode)

( ½ mark for reading content from file)

( ½ mark for correct condition for searching)

(½ mark for displaying the result)(C) void ProductSearch( )

{

ifstream fin;

Page 226: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

fin.open(“PRODUCT.DAT”,ios::binary|ios::in);

PRODUCTS P;

int p_code, Found=0;

cout<<”Enter Product Code to be search:”;

cin>> p_code;

while (!fin.eof( ))

{ fin.read((char*)&P,sizeof(P));

if (P.getproduct( )= = p_code)

{

P.showproducts();

Found++;

}

}

if (Found==0)

cout<<”Sorry! Product not found!!!”<<endl;

fin.close();

}

(½ mark for correct syntax of function header and body)

( ½ mark for opening the file in ‘in’ mode)

( ½ mark for reading content from file into the ob ject of P)

( ½ mark for appropriate loop)

( ½ mark for correct condition for searching)

(½ mark for displaying the content of the object)

Q.5 (A) 1 mark for definition, 1 mark for example

(B) ½ mark for selecting relevant attributes, ½ mark for valid condition

(i) SELECT * FROM SHOP ORDER BY BUYDATEA ASC.

(II)SELECT ICODE, INAME FROM SHOP WHERE QTY> 100.

(III) SELECT ICODE, INAME, QTY*RATE “TOTAL AMOUNT” FROM SHOP;

(IV) SELECT, SCODE, COUNT(*) FROM SHOP GROUP BY SCODE;

½ mark for completely correct answer(Column headings not to be considered)

Page 227: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

(v) 3

(vi) 120

(vii)Bag Arya Stationers

(viii) 17-Dec-12

Q.6 (A) (b) LHS A + A'B = A.1 + A'.B (using A.1=A)= A. (1+B) + A'.B (using 1+B=1)= A + A.B + A'.B (using distributive law)= A + (A+A').B (using distributive law)=A + 1.B (using A+A'=1)

= A +B (RHS) (using 1.B=B)

Or RHS= A + B = A + 1. B= A + (A+A').B= A + A.B + A'.B= A.(1+B) + A'.B= A.1 + A'.B=A + A'B LHS

(Full 2 marks for correct proof using laws of Boolean algebra)

(B) Logic circuit for ((A+B')(B+C)')'

( ½ mark for representing A+B', ½ mark for (B+C)', 1 mark for ((A+B')(B+C)')

(C) POS expression for given truth table is (A+B+C').(A'+B+C).(A'+B'+C)A B C F M0 0 0 10 0 1 0 A+B+C'0 1 0 10 1 1 11 0 0 0 A'+B+C1 0 1 11 1 0 0 A'+B'+C1 1 1 1

(1 mark for correct POS form)

Page 228: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

A

C

D

A'C'

A'D'

C'D' A'C' + C'D'+ A'D'

22

(D) Simplification of Boolean expression is A'C'+A'D'+C'D'

00(C'D') 01(C'D) 11(CD) 10(CD')

00(A'B') 1 1 01

01(A'B) 1 1 0 1

11(AB) 1 0 0 0

10(AB')1

0 00

Logic circuit for reduced expression is

(1 mark for drawing k-map & placing 1s at correct position, ½ mark for correct grouping, 1 mark for writing correct minimal form, ½ mark for logic circuit)

Q.7 (A) (1 mark for correct answer)

(B) (½ marks for definition)

(½ marks for examples)

(C) (i)PHP (iv)ASP

(½ marks for each answer)

(D) (1mark for appropriate Answer)

(E) (i) for correct lay out design

(ii) Academic Building because it has the maximum number of computers.

(iii)Switch

(iv) Satellite Connection

(1 mark for each answer)

(F) (i) eXtensible mark-up language

Quad1 = A'D'

Quad2 = A'C'

Quad3 = C'D'

Page 229: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

22

(ii) Free Libre and Open Source Software

(½ mark for each correct full form)

(G) Advantage- low cost

Disadvantage- fault cannot be easily identified

(½ marks each for advantage & disadvantage)

Paper- 9TIME 3 HRS CLASS XII

M. Marks 70

BLUEPRINT

UNIT LEARNING LEVEL KNOWLEDGE UNDERSTANDING APPLICATION/SKILLTOTAL

S.NO TOPICS VSA SAI SAII LA VSA SAI SAII LA VSA SAI SAII LA

1. PROGRAMMING IN C++ 1(1) 2(1) 3(1) 4(1) 2(2) 3(1) 4(1) 1(1) 2(2) 4(1) 30

2. DATA STRUCTURE 2(2) 3(1) 1(2) 3(1) 1(1) 3(1) 14

3. DATABASES AND SQL 4(1) 1(4) 08

4. BOOLEAN ALGEBRA 2(1) 2(1) 1(1) 3(1) 08

5. COMMUNICATION & NETWORKING CONCEPTS 1(1) 2(1) 1(1) 2(1) 4(1) 10

TOTAL 26 23 21 70

Page 230: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

Paper- 9MODEL QUESTION PAPER

COMPUTER SCIENCE (THEORY)

TIME - 3 HRS CLASS XIIM. Marks 70

GENERAL INSTRUCTION :

1. ALL QUESTIONS ARE COMPULSORY.

2. PROGRAMMING LANGUAGE : C++

Q1. Answer the following questions:

Name the header file(s) that shall be needed for successful compilation of the following C++ code.

a) void main( )(1)

{

int n;

n=strlen(”AISSCE”);

cout<<n;

}

b) Rewrite the following program after removing the syntax error(s) if any. Underline each correction.

(2)

#include<iostream.m>

void main( )

[

int One=10,Two=20;

three=One + Two;

Page 231: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

cout>>three;

}

c) Find the output of the following program: (3)

#include<iostream.h>

#include<ctype.h>

void main( )

{

char Mystring[ ] = "what@OUTPUT!";

for(int I=0; Mystring[I]!=’\0’;I++)

{

if(!isalpha(Mystring[I]))

Mystring[I]=’*’;

else if(isupper(Mystring[I]))

Mystring[I]=Mystring[I]+1;

else

Mystring[I] =Mystring[I+1];

}

cout<<Mystring;

}

d) What will be the output of the following code segment (2)

#include<iostream.h>

#include<stdlib.h>

const int LOW=25;

void main()

{ randomize();

int POINT=5, Number;

for(int I=1;I<=4;I++)

{

Number=LOW+random(POINT);

cout<<Number<<":" <<endl;

Page 232: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

POINT--; } }

(i) 29:26:25:28:

(ii) 24:28:25:26:

(iii) 29:26:24:28;

(iv) 29:28:25:26:

e) Find the output of the following code.(2)

#include<iostream.h>

#include<conio.h>

void main()

{

int arr[] = {10, 20, 30, 40};

for(int i=0;i<4;i++)

if(arr[i]%8==0)

cout<<arr[i];

}

f) How you will declare a Character Constant and a String Constant in C++ give example of each.(2)

Q2. Answer the following questions:

a) Illustrate the concept of function overloading with the help of example.(2)

b) Answer the questions (i) and (ii) after going through the following program:(2)

class SCI

{

char subject[20];

int marks;

public:

SCI ( ) //Function 1

{

strcpy (subject, “IP” );

marks = 70;

cout<<“IP Subject ”;

}

Page 233: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

~SCI( ) //Function 2

{

cout<<”Subject deleted”;

}

};

(i) Name the specific features of class shown by Function 1 and Function 2 in the above example.

(ii) How would Function 1 and Function 2 get executed?

c) Define a class Store with the following specification : (4)

private data members

Item_name string (45 characters) [ Item Name]

price long

Discount long

Net long

Dis_type char (F or N)

Calculate() – The store gives a 5% discount on every product it sells. However at the time of festival season the store gives 10% festival discount after 5% regular discount. The discount type an be checked by tracking the discount type. Where ‘F’ means festival and ‘N’ means Non- festival. The Calculate() will calculate the Discount and Net on the basis of the following table.

public members

Constructor - to initialize the Item_Name with “NULL”, and numeric variable with 0 and character elements with ‘N’.

Accept() - Ask the store manager to enter Item name, Price and discount type . The function will invoke Calculate to calculate Discount Price and Net Price .

ShowBill() - To generate the bill to the customer with all the details of his/her purchase along with the bill amount including discount price and net price.

d) Consider the following declarations and answer the questions given below: (4)

class Newdata

{ protected:

Item Name Price(Rs.)

Washing Machine

10000

TV 15000

Refrigerator 20000

Oven 8000

VCD 5000

Page 234: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

int data;

public:

void Get_newdata(int);

void Manip_newdata(int);

void Show_newdata(int);

Newdata( );

~Nydata( );

};

class Personal_info

{

private:

int data1;

public:

void Get_personalinfo(int);

void Show_personalinfo(int);

Personal_info ( );

~ Personal_info ( );

};

class Person: private Newdata, Personal_info

{

public:

void Show_person(void);

person( );

~person( );

};

a) How many bytes will be required by an object belonging to class Person?

b) Which type of inheritance is depicted in the above example?

c) List the data members that can be accessed by the member function Show_person( )

d) What is the order of constructor execution at the time of creating an object of class Person?

Q3. Answer the following questions:

Page 235: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

a) Write a function in C++ which accepts an integer array and its size as arguments and find the sum of all the elements which are fully divisible by 3 and 5. Example: if an array of five elements initially contains the element as

(3)

3,5,1,15,25,30

The output will be

45

b) An array A[30][10] is stored in the memory along the column with each element occupying 4 bytes. Find out the Base address and address of the element A[2][5] if the element A[20][10] is stored at the address 10000.

(3)

c) Define member function insert( ) to insert and del( ) to delete nodes of a linked list implemented class Queue having the following Definitions:

(4)

struct Node

{

char name[20];

int age;

Node *Link;

};

class Queue

{ Node *Rear, *Front;

public:

Queue( ) { Rear=NULL; Front = NULL}

void insert( );

void del( );

};

d) Evaluate the following postfix expression given below, show the contents of the stack during the evaluation

(2)

20, 6, 2, ^,10,4,%,-,+

e) Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements which lie on diagonals.

(2)[Assuming the 2D array to be square matrix with odd dimension i.e. 3*3, 5*5, 7*7 etc….]

Eg: 5 4 3

6 7 8

Page 236: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

1 2 9

Output through the function should be :

Diagonal one : 5 7 9

Diagonal two : 3 7 1

Q4. Answer the following questions:

a) Observe the program segment given below carefully, and answer the question that follows:(1)

class Candidate

{

int Id; //Candidate’s Id

char Name[20]; // Candidate’s Name

float Score; // Candidate’s Score

public:

void Enrollment();

void ShowData();

void Marks(); //Function to change Score

long R_id() {return Aid;}

};

void Update(int Id)

{

fstream File;

File.open(“AllData.DAT”,ios::binary|ios::in|ios::out);

candidate cn;

int Record=0,Found=0;

while (!Found&&File.read((char*)&cn, sizeof(cn)))

{

if (Id==A.R_id())

{

cout<<”Enter Marks…”;

cin>>A.Marks();

Page 237: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

_________________ //statement 1

_________________ //statement 2

Found = 1;

}

Record++;

}

if(Found==1) cout<<”Record Updated”;

File.close();

}

Write the Statement1 to position the File Pointer at the beginning of the Record for which the Candidate’s Id matches with the argument passed, and Statement2 to write the updated Record at that position

b) Write a function in C++ to count the number of lines started with letter ‘A’ present in a text file “temp.txt” .

(2)

c) Write a function in C++ to read and display the detail of all the students whose gender type is ‘M’ from a binary file “STUDENT.DAT”. Assuming the binary file “STUDENT.DAT” is containing objects of class STUDENT, which is defined as follows:

(3)

class STUDENT

{

int rollno;

char name[20];

char Gender; //Member Type: M for Male F for female

public:

void enroll( );

void Display( );

char Type( ) { return Gender; }

};

Q5 Answer the following questions:

a) What do you understand by Domain of column and Cardinality of a table? (2)

Consider the following tables Employees and EmpSalary and answer (b) and (c) parts of this question:

Page 238: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

Employees

Empid Firstname Lastname Address City

010 Ravi Kumar Raj nagar GZB

105 Harry Waltor Gandhi nagar GZB

152 Sam Tones 33 Elm St. Paris

215 Sarah Ackerman 440 U.S. 110 Upton

244 Manila Sengupta 24 Friends street New Delhi

300 Robert Samuel 9 Fifth Cross Washington

335 Ritu Tondon Shastri Nagar GZB

400 Rachel Lee 121 Harrison St. New York

441 Peter Thompson 11 Red Road Paris

EmpSalary

Empid Salary Benefits Designation

010 75000 15000 Manager

105 65000 15000 Manager

152 80000 25000 Director

215 75000 12500 Manager

244 50000 12000 Clerk

300 45000 10000 Clerk

335 40000 10000 Clerk

400 32000 7500 Salesman

441 28000 7500 salesman

(B) Write the SQL commands for (i-iv) & write Output for (v-viii) SQL commands :- (4+2)

i. To show firstname,lastname,address and city of all employees living in New Delhi

ii. To delete the record of an employee with Empid is 215.

iii. To display the firstname,lastname and salary of that employee who is getting Maximum salary among all employees.

iv. To display the sum of salary of all the different designation using group clause on designation .

v. Select firstname,salary from employees ,empsalary where designation = ‘Clerk’ and employees.empid=Empsalary.empid;

vi. Select count(*) from empsalary;

vii. Select designation, sum(salary) from empsalary group by designation having count(*) <3;

viii. Select avg(benefits) from empsalary where designation =’Manager’;

Q6. Answer the following questions:

Page 239: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

23

a) Write the equivalent Boolean Expression F for the following circuit diagram :(2)

b) Reduce the following Boolean expression using K – Map(3)

F (A, B, C, D) = π(0,2,3,4,6,7,8,10,12)

c) Prove Commutative Law algebraically.(2)

d) Write the POS form of a Boolean function F, which is represented in a truth table as follows: (1)

U V W F

0 0 0 1

0 0 1 0

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 0

1 1 0 1

Q7 Answer the following questions:

a) Expand the following

(i) GSM (ii) NIC(1)

b) What is the difference between XML and HTML? Write two differences. (2)

c) Which protocol is used for sending and receiving emails?(1)

d) What do you understand by open source software? Write names of any two open source software.

(2)

e) “AYS Software Inc.” is planning to expand their network in India, starting with two cities in India to provide Software services. The company has planned to set up their main office units in Punjab at three locations and have named their offices as “Coding Unit”, “Testing Unit” and “Finance Unit”. The company has its corporate unit in Shimla. A rough layout of the same is as follows:

(4)

Main Unit

SHIMLA

Page 240: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

24

Approximate distances between these Units are as follows:

From To Distance

Coding Unit Testing Unit 10 KM

Coding Unit Finance Unit 50Mtr

Finance Unit Testing Unit 10KM

In continuation of the above, the company experts have planned to install the following number of computers in each of their office units:

Coding Unit 100

Testing Unit 70

Finance Unit 10

i) Suggest the kind of network required (out of LAN,MAN,WAN) for connecting each of the following office units:

Coding Unit and Testing Unit

Coding Unit and Finance Unit

ii) Which one of the following devices will you suggest for connecting all the computers within each of their office units?

Switch/Hub

Modem

Bluetooth

iii) Which of the following communication media, will you suggest to be procured by the company for connecting their local offices in Pubjab for very effective (High Speed) communication?

Coaxial cable

Optical fiber

Wi Fi network

(iv) Suggest a cable/wiring layout for connecting the company’s local office units located in Pubjab and Main Unit.

Coding Unit

Testing Unit Finance Unit

Punjab

Page 241: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

24

PAPER - 9

MARKING SCHEME/ DISTRIBUTION OF MARKS

Question Answer MarksAllotment

1 a)

string.h

iostream.h½

½

b)

#include<iostream.h>

void main( )

{

int One=10,Two=20;

three=One + Two; //variable not declared

cout<<three;

}

½

½

c)Correct Output

hat@*PVU@VU3

d)

Correct out put

29:28:25:26:

Explanation

1

1

e) 40 2

f)Definition

Example

1

1

2 a)Definition

Example

1

1

b)

Function1- Constructor()

Function2- ~Destructor()

Function1- when object is created

Function2- when the scope of object is over

1

1

c) Class definition 1

Page 242: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

24

Store ()

Calculate()

Accept();

ShowBill()

1

1

1

d) 1 mark for each corrected answer 4X1

3a)Declaration of function

Logic & body

1

2

b)

Correct

A[20][10]=8720

A[2][5]=9328

2

2

c)insert()

del()

2

2

d) Correct Answer=54 2

e)Function Declaration

Logic & Body½

4a)Line1File.seekg()-1*sizeof(cn),ios::cur);

Line2:file.write((char*)&c,sizeof(cn);

½

½

b)Function Definition

Opening the file and for loop

1

1

c)

Function Declaration

File input& output file stream format

While loop and file close

½

1

5 a)Definition for each

Explain

1

1

b) i) Select * from Employee where City=”New Delhi”;ii) Delete from Employee where Empid=215;iii) Select fistname, lastname max(salary) from Employee,empSalary

1

1

Page 243: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

24

where Employee.Empid=EmpSalary.empidiv) Select sum(Sarary) from EmpSalary group by Designationv) Manila 50000

Rober 45000

Ritu 40000

vi) 9vii) Designation Sum(Salary)

Director 80000

Salesman 60000

viii) Sum(Benefits) 215000

1

½

½

½

½

6 a)I) De Morgan’s First Theoram; (X+Y)’=x’.Y’,(X.Y)’=X’+Y’

II) Truth Table

½ x½

1

1

b)

k-Map Drawn

Groups making

Solution

1

1

1

c) Correct lawCorrect prove

1

1

d) Correct Answer 1

7 a) Global System for Mobile CommunicationNetwork Interface Card

½

½

Page 244: · Web viewWrite a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.[Assuming the 2D array to

24

b)Correct difference:Two difference each

1

1

c) Correct answer 1

d) DefinitionExplanation

1

1

e)

E1) MANE2 switch

E3 Optical Fiber

E4 Lay out

1

1

1

1

Main Unit

SHIMLACoding Unit

Testing Unit

Finance Unit

Punjab