MODEL ANSWER

PRE – BOARD – 1

COMPUTER SCIENCE (083)

1 / (a) / In call by Value the called function creates its own copies of the original values passed as parameter. In a call by reference method, the called function accesses and work with the original values using their references.
For e.g
void Change(int X, int &Y) // here X is accepting by value and Y by reference
{
X+=10;
Y+=10;
}
void main()
{
int A=100, B=200;
Change(A,B); // Change on A by function will not affect its value but for B it will due to reference
cout<A<”,”<B;
}
(1 marks for difference)
(1 marks for suitable example)
(b) / (i) getch() conio.h
(ii) exit() process.h OR stdlib.h
(½ marks for each header file)
(c) / #include<iostream.h
void Assign(int,int);
void main()
{
intPresent = 21,Past = 10;
Assign(Present , Past );
Assign(Past);
}
void Assign(int Default1, intDefault2 = 3)
{
Default1 = Default1 + Default2;
cout<Default1Default2;
}
(½ marks for each correction)
(d) / 78#80#83#
234@240@249@249@
(1 ½ marks for each output line)
(e) / ramuKjaR
(2 marks for correct output)
(f) / Maximum value = 80
Minimum value = 41
(1 marks for each correct value)
2 / (a) / A Constructor is a member function having the same name as that of the class and which gets invoked every time a new object is created. It is used to initialize object values.
A Destructor is also having the same name as that of class but it is preceded by Tilde(~) sign. It gets invoked when the object goes out of scope. It is used to destroy the object
For e.g.
class Sample
{
int X;
public:
Sample()
{
X = 10;
}
~Sample()
{
cout<”Bye!”;
}
};
(½ marks for each definition)
(1 marks for suitable example)
(b) / (i) It illustrate the concept of Polymorphism through constructor overloading
Interview obj;
Interview obj2(“Trainee”,20);
(½ marks for mentioning constructor overloading and ½ for the rest)
(ii) Interview (Interview &I)
{
No_Of_Candidate = I.No_Of_Candidate;
Strcpy(Post, I.Post);
}
(1 marks for correct answer)
(c) / class RESORT
{
intRNo;
char Name[20];
int Charges;
int Days;
int CALC();
public:
void CHECKIN();
void CHECKOUT();
};
int RESORT::CALC()
{
int Amount = Days * Charges;
if(Amount>10000)
Amount = Amount * 1.25;
return Amount;
}
void RESORT::CHECKIN()
{
cout<"Enter Room No :"; cinRno;
cout<"Enter Name :"; gets(Name);
cout<"Enter Charges :"; cin>Charges;
cout<"Enter Days :"; cin>Days;
}
void RESORT::CHECKOUT()
{
cout<"Room Number :"<RNoendl;
cout<"Name :"<Name<endl;
cout<"Charges :"<Charges<endl;
cout<"Days :" <Days<endl;
cout<"Amount :" < CALC();
}
½ marks for correct syntax for class header
½ marks for correct declaration of data members
1 marks for correct definition of CALC()
1 marks for correct definition of CHECKIN()
1 marks for correct definition of CHECKOUT()
(d) / (i) Multiple Inheritance
(ii) Enter(), Display(), Input(), Output()
(iii) No Data member
(iv) MID, MDName, Profile, Input(), Output()
(1 makrsfo each correct answer)
3 / (a) / void INSORT(int A[],int size)
{
int i, j, temp;
for(i = 1 ; i < size ; i++)
{
temp = A[i];
for(j = i-1; j>=0 & A[j]>temp; j--)
{
A[j+1] = A[j];
}
A[j+1] = temp;
}
}
½ marks for function header
1 ½ makrs for looping and statements
1 marks for correct logic
No marks will be given if sorting is done by using any other sorting technique
(b / Let the Base Addess = B
Size of elements S = 8 bytes
Number of Rows M = 15
Number of Columns N = 35
Lower bounds of Row Lr = 0
Lower bounds of Columns Lc = 0
In column major implementation
Address of (I,J) = B + S [(I-Lr) + M(J-Lc)]
Address of (5,10) = B + 8[(5-0) + 15(10-0) ]
4000 = B + 8[5 + 150]
4000 = B + 1240
B = 4000 – 1240
B = 2760
Now Address of (2,5) = 2760 + 8[(2-0) + 15(5-0)]
= 2760 + 8[2+ 75]
=2760 + 616
=3376
½ marks for writing correct formula and ½ marks for substituting values in formula
1 marks for base address calculation
1 marks for address of A[2][5]
(c) / void QINSERT(QUEUENODE *FRONT, QUEUENODE *REAR, int value)
{
QUEUENODE *temp = new QUEUENODE;
temp->DATA = value;
temp->NEXT = NULL;
if(REAR==NULL)
{
FRONT = REAR = temp;
}
else
{
REAR->NEXT = temp;
REAR = temp;
}
1 marks for creating new node and assigning appropriate values in it
1 marks for checking queue empty
1 marks for insertion operation
1 marks for creating link to new node
(d) / void DIA_SUM(int M[][],int R, int C)
{
int Sum = 0;
for(int i =0; i<R; i++)
{
for(j=0; j<C; j++)
{
if(i==j || i+j==2)
Sum = Sum + M[i][j];
}
}
}
½ marks for function header
½ marks for appropriate loop
1 marks for correct expression for calculating the sum
(e) / True
1 marks for correctly evaluating each operator
1marks for correct answer
4 / (a) / ios::out will write the content by overwriting the previous content whereas ios::app is used to append the new data in an existing file i.e. it will not overwrite it will add new content after previous content
½ marks for each correct mode
(b) / void count()
{
ifstream file("EXAMPLE.TXT");
int count1 = 0, count2 = 0;
char word[10];
while(!file.eof())
{
file>word;
if(strcmp(word,"to")==0)
count1++;
else if(strcmp(word,"is")==0)
count2++;
}
file.close();
cout<"Total TO ="<count1<endl;
cout<"Total IS ="<count2;
}
½ for opening file correctly
½ marks for initializing counter variables as 0
½ marks for correctly reading words from file
½ marks for correctly incrementing the counter variables
(c) / void COPYAREA()
{
ifstream file1("COSUMER.DAT",ios::in|ios::binary);
ofstream file2("BACKUP.DAT",ios::out|ios::binary);
Consumer C;
while(file1.read((char*)&C,sizeof(C)))
{
if(C.CheckCode("NORTH")==0)
{
C.Display();
file2.write((char*)&C,sizeof(C));
}
}
file1.close();
file2.close();
}
½ marks for opening file correctly
½ marks for reading each record from file
½ marks for correct loop/checking end of file
1 marks for correctly comparing value
½ marks for displaying matching record
5 / (a) / Degree means total number of attributes or columns present in any table where as Cardinality means total number of rows or records present in any table
For e.g.
ProjectCode / Projectname / ProjectHead
P001 / Online Shopping / Amit
P002 / Food Plaza / Sumit
In the above table Degree = 3 (Project Code, Project Name, and Project Head) and Cardinality =2 (records of P001 and P002)
(b) / (b1)
(i) Select * from consumer where Address='Delhi';
(ii) Select * from Stationary where price between 8 and 15;
(iii) Select C.ConsumerName, C.Address,S.Company, S.Price from Consumer C, Stationary S where C.S_ID = S.S_ID;
(iv) UPDATE Stationary set price = prince + 2;
1 marks for each correct query ½ marks for partial correct query
(b2)
(i)
Address
------
Delhi
Mumbai
Bangalore
(ii)
CompanyMAX(Price)MIN(Price)Count(*)
------
ABC 1510 2
XYZ 7 6 2
CAM 5 5 1
(iii)
ConsumerNameStationaryNamePrice
------
Good Learner Pencil 5
Write Well Gel Pen15
Topper Dot Pen10
Write And Draw Pencil 6
Motivation Pencil 5
(iv)
StationaryNamePrice*3
------
Dot Pen 30
Pencil 18
Eraser 21
Pencil 15
Gel Pen 45
½ marks for each correct output
6 / (a) / A+B.C = (A+B).(A+C)
A.(B+C) = A.B+A.C
Verifying using Truth Table
½ marks for each statement
½ marks for each validation
(b) /
XX.(Y’+Z)
Y’
Y(Y’+Z)

Z
(c) / U / V / W / G / POS
0 / 0 / 0 / 1
0 / 0 / 1 / 1
0 / 1 / 0 / 0 / U+V’+W
0 / 1 / 1 / 0 / U+V’+W’
1 / 0 / 0 / 1
1 / 0 / 1 / 1
1 / 1 / 0 / 0 / U’+V’+W
1 / 1 / 1 / 1
In POS we have to take those output where the value is 0 so the result (POS) will be
(U+V’+W).( U+V’+W’).( U’+V’+W)
½ marks for correct expression
½ marks for correct POS form
(d) / R’S’ / R’S / RS / RS’
P’Q’ / 0 / 1 / 1
3 / 2
P’Q / 4 / 1
5 / 1
7 / 6
PQ / 12 / 1
13 / 1
15 / 14
PQ’ / 8 / 9 / 1
11 / 1
10
Quad(3,7,15,11) = RS
Quad(5,7,13,15) = QS
Pair(10,11) = PQ’R
Answer = RS + QS + PQ’S
½ marks for placing all 1’s at correct position in K-map
½ marks for each grouping
1 marks for writing All Quad and Pair value
1 marks for writing final expression
7 / (a) / It is a method if transmitting messages through a communication network in which long messages are subdivided into short packets
1 marks for correct answer
(b) / Protocol is a set of rules that two or more machines must follow to exchage messages
Examples – TCP/IP, FTP, HTTP etc
½ marks for definition
½ marks for example
(c) / (i) PHP (iv) ASP
½ marks for each correct answer
(d) / URL is used to specify where an identical resource is available in the network and the mechanism for retrieving it. A URL is also referred as Web Address
1 marks for appropriate explanation
(e) / (i)
Eduminds University Parampur Campus




Or


(ii) Academic Building because it has the maximum number of computers
(iii) Switch
(iv) Satellite Connection
1 marks for each correct answer
(f) / (i) World wide web consortium
(ii) Free Libre open source software
½ marks for each correct full form
(g) / Advantage
Faulty nodes do not affect the network
Set up easy
Disadvantage
Dependency on Switch/Hub/Server
More cable length required
½ marks for each appropriate advantage and disadvantage