Marking Scheme of Class XII PB-III Computer Sc. Question Paper

Transcription

Marking Scheme of Class XII PB-III Computer Sc. Question Paper
KENDRIYA VIDYALAYA SANGATHAN
(KOLKATA REGION)
Second Pre Board Examination (2014-15)
COMPUTER SCIENCE (Theory)
Class-XII
Marking Scheme
Ques. 1
a)
[1]
Automatic Type Conversion
Type casting
It is also called implicit type
It is also called explicit type
conversion.
conversion
In this type, conversion is performed
It is user-defined that forces an
by compiler.
expression to be of specific type.
Automatic conversion takes place
Here conversion takes place when it
automatically when data types are
appears as (type) expression
intermixed in an expression.
Conversion takes place always upto
Conversion takes place to the specific
the type of the largest operand.
data type that appears in type.
Suitable example
b) i) iostream.h
[1]
[2 x ½ =1]
ii) string.h
c)
#include<iostream.h>
class MEMBER
{
int Mno;
float Fees;
public:
void Register ( )
{cin>>Mno>>Fees;}
void Display( )
{cout<<Mno<<" : "<<Fees<<endl;}
1
[½ x4=2]
};
void main()
{
MEMBER d;
d.Register();
d.Display();
}
d) JjIANS!
[2]
e)
[3]
20, 25, 30,
20, 25, 30, 35,
Number=34
f)
iii) ######99-@@999
iv) ####99-@@@999
[1]
Justification
[1]
Ques. 2
a)
[2]
We will make the function inline only when it is small as if we make large
function inline, there would be heavy memory penalty. When the function
becomes inline, the compiler does not have to jump to function and then jump
back to called function, thus saves time. Function call is replaced by function
definition by the compiler.
b)
(i)
Function1 is called automatically, when the scope of an object gets over. It
is known as Destructor.
ii)
Function4 will be called on execution of statement written as Statement 2.
It is Copy Constructor.
c) class Stock
{
int ICode;
char Item[10];
2
[½+½]
[ ½ + ½]
float price;
int Qty;
float Discount ;
void FindDisc( )
{
if (Qty<=50)
Discount=0 ;
else
if(Qty>=51 && Qty<=100) Discount=5 ;
else
if(Qty>100) Discount=10;
}
public:
Stock() {
ICode=0; Price=0.0; Qty=0; strcpy(Item,”NULL”);
}
void Buy( ) {
cout << “Enter item code : “; cin >> ICode;
cout << “Enter item name : “; gets(Item);
cout << “Enter price : “ ; cin >>price;
cout << “Enter quantity : “ cin >> Qty;
FindDisc( );
}
void ShowAll( ) {
cout<< “Item Code : “ <<ICode;
cout<< “Item Name : “;puts(Item);
cout<<”Price : “<<price;
cout<<”Quantity: “<<Qty;
cout<<”Discount: “<< Discount;
}
};
d)
3
(i)
Multiple inheritance
[1]
(ii)
Register(), Input(), Output(), Sitein(), Siteout()
[1]
(iii)
Data members: None
[1]
Member Function: Register(), Show()
(iv)
Function Output( ) is not accessible inside the function SiteOut( ). Online
and FacetoFace classes are independent classes.
[1]
But after inheriting Output () is accessible inside function SiteOut() as both
are member functions of the same class.
Ques. 3
a) void SumUnit2(int A[ ],int size)
[3]
{
int S=0,i;
for(i=0;i<size;i++)
if((A[i]%10)%2==0)
S+=A[i];
cout<<S;
}
[3]
b) Formula for column major:
Address of T[i][j]=B+W*((i-ir)+(j-jr)*R)
As per question:
9800=b+4*(25+50*10)
or, b=9800-4*525
or, b=9800-2100=7700
Therefore base address is 7700.
Therefore, address of T[30[15]=7700+4*(30+15*50) = 7700+4*(30+750) =
7700+4*780=7700+3120=10820
c) void remove(BOOK *front)
{
BOOK *Temp;
If(front==NULL)
cout<< “Queue underflow……….”;
else
{
Temp=front;
4
[4]
cout<<Element removed : “ << Temp->bprice;
if(front->Link==NULL)
front=NULL;
else
front=front->Link;
}
\\Output;
for(temp=front; temp->Link!=NULL; temp=temp->Link)
cout<< temp->bprice;
cout<< temp->bprice;
}
d) int sum(int B[ ][3], int r, int c)
{
int count=0,I,j,s=0;
for(i=0;i<r;i++)
for(j=0;j<c;j++) {
if(count%2==0) s+=B[i][j];
count++;
}
return count;
}
e)
[2]
Scanned element Operation
Stack
Intermediate
Result
True
Push
True
False
Push
True, False
NOT
Pop one ele and
True, True
NOT(False)=True
True
True OR True=
push result
OR
Pop two ele and
push result
False
5
Push
True
True, False
True
Push
True, False,
True
OR
Pop two ele and
True, True
False OR True
True
True AND True
push result
AND
Pop two ele and
push result
Ques. 4.
a)
[1]
#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);
File.seekg(0,ios::end) // Statement 1
int Bytes = File.tellg() // Statement 2
int count = Bytes/sizeof(Employee);
File.close( );
return count;
}
6
b)
[2]
void COUNT(void)
{
ifstream fin;
char wd[10]; int c=0;
fin.open(“coordinate.txt”, ios::in);
while(!fin.eof())
{
fin>>wd;
if(isupper(wd[0])) c++;
}
cout<<”No. of words with first capital letter : “<<c;
fin.close();
}
c)
[3]
void TRANSFER( )
{
ifstream fin;
ofstream fout;
Phonlist P;
fin.open(“PHONE.DAT”,ios::in);
fout.open(“PHONBACK.DAT”,ios::out);
while(!fin.eof())
{
fin.read((char *)&P,sizeof(P));
if(P.CheckCode(“DEL”)==0)
fout.write((char *)&P,sizeof(P));
}
fin.close();
fout.close();
}
7
Ques. 5
a)
[2]
DDL (Data Definition Language) commands are commands used for defining
the data structures specially database schemas. Example: CREATE,
ALTER, DROP
DML(Data Manipulation Language) commands are used for data
manipulation. Example: SELECT, UPDATE, DELETE, INSERT
b)
[6]
(i)
SELECT * FROM CONSUMER WHERE ADDRESS = ‘DELHI’;
(ii)
SELECT * FROM STATIONARY WHERE PRICE>=8 AND PRICE <=15;
(iii)
SELECT CONSUMERNAME, ADDRESS, COMPANY, PRICE FROM
CONSUMER C, STATIONARY S WHERE S.S_ID=C.S_ID;
(iv)
UPDATE STATIONARY SET PRICE=PRICE+2;
(v)
DISCTINCT ADDRESS
Delhi
Mumbai
Banglore
(vi)
(vii)
(viii)
8
Company
MAX(Price)
MIN(Price)
COUNT(*)
ABC
15
10
2
XYZ
7
6
2
CAM
5
5
1
Consumer.ConsumerName Stationary.StationaryName Stationary.Price
Good Learner
Pencil
5
Write Well
Gel Pen
15
Topper
Dot Pen
10
Write & Draw
Pencil
6
Motivation
Pencil
5
StationaryName Price*3
Dot Pen
30
Pencil
18
Eraser
21
Pencil
15
Gel Pen
45
Ques.6
a)
LHS :
[2]
(A’+B’).(A+B) = A’.A + A’.B +B’.A+B’.B = 0+ A’.B+A.B’+0 = A’.B+A.B’ = RHS
b) A.(B+C’)
[2]
c)
[1]
Canonical SOP form: (0,2,4,5) = F(X,Y,Z)=X’Y’Z’+X’YZ’+XY’Z’+XY’Z
d)
[3]
Octet-1 (m0+m1+m4+m5+m12+m13+m8+m9) = c’
Octet-2 (m1+m3+m5+m7+m13+m15+m9+m11) = d
Therefore, reduced expression using K-map is (c’+d)
Ques.7
a)
[2]
Message switching technique
Packet switching technique
1.No limit on block size
1. Tight upper limit on block size
2. Data packets are stored on the disk 2.Packets are stored in main memory
9
3.Throughput is less improved in
3.Throughput is more improved in
comparison to packet switching
comparison to message switching
b) ii) Mbps(Mega bits per second)
[1]
c)
[1]
d)
(i)
FTP- File Transfer Protocol
(ii)
(ii) GSM- Global System for Mobile communication
(i)
ii) The most suitable building to house the server will be ‘Training
Building’ as it contains maximum number of computers and as per
80-20 rule that states that 80% of traffic must be local.
iii)
i. Repeater will be placed between Training Building & Accounts
Building as the distance between them is more than 100m.
ii. Hub/Switch in every building to connect computers in each
building
iv) The NGO is planning to connect its International office situated in
Delhi. Optical Fibre will be better for very high speed connectivity.
e) A Trojan horse is a computer program which carries out malicious operations
without the user’s knowledge. It is a piece of harmful code placed within a
healthy program which destroys files.
[1]
f)
[1]
STAR Topology
BUS Topology
Requires more cable length than bus
Requires less cable length than star
topology
topology
Difficult to expand
Easy to expand
-----------------------XXXXX-----------------------
10