Class 12 Computer Science Solved Sample Paper 1 - 2012
Class 12 Computer Science Solved Sample Paper 1 - 2012
Local Variable
l
It is a variable which is declared outside all the functions It is accessible throughout the program
It is a variable which is declared with in a function or with in a compound statement It is accessible only within a function/ compound statement in which it is declared
l l
#include <iostream.h> float NUM=900; void LOCAL(int T) { int Total=0; for (int I=0;I<T;I++) Total+=I; cout<<NUM+Total; } void main() { LOCAL(45); } //Total is a local variable //NUM is a global variable
Answers
Marks
OR (Full 2 Mark for explanation of differences with the help of an example) OR (1 Mark for only example with no explanation)
(b)
(i)
string.h
(ii)
stdio.h
(c)
#include <iostream.h> class MEMBER { int Mno;float Fees; public: void Register(){cin>>Mno>>Fees;} void Display(){cout<<Mno<<":"<<Fees<<endl;} }; void main() { MEMBER M; M.Register(); M.Display(); } ( Mark each correction)
(d)
No.
Answers
Marks
(e)
(f)
2. (a) Data Encapsulation: Wrapping up of data and functions together in a single unit is 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: void STOCK(); void SHOW(); }; ( Mark each for appropriate definitions) (1 Mark for appropriate example showing both) Data Encapsulation 2
(b)
i)
Destructor, it is invoked as soon as the scope of the object gets over. ( Mark for mentioning destructor) ( Mark for remaining answer)
ii)
Constructor Overloading (or Function Overloading or Polymorphism) Seminar S1; Seminar S2(90); //Function 1 //Function 3
( Mark for mentioning the correct concept) ( Mark for the example) 17
No.
Answers
Marks
(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; 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. 18
No. (1 Mark for correct answer) (ii) (iii) Haveit(), Giveit() (1 Mark for correct answer)
Answers
Marks
Data members: Employees, Acode, Aname, Amount Member function: Register(), Enter(), Display(), Haveit(), Giveit(), Start(), Show(), (1 Mark for correct answer) 70 (1 Mark for correct answer) void AddNSave(int A[ ],int B[ ],int C[ ],int N,int M, int &K) { 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 { C[K++]=A[I++]; J++; } for (;I<N;I++) C[K++]=A[I]; for (;J<M;J++) C[K++]=B[J]; } 3
(iv) 3. (a)
( 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) 19
No. (b) Given, W=2 N=40 M=30 Base(S)=5000 Row Major Formula: Loc(S[I][J]) Loc(S[20][10])
Answers
Marks 3
(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 { char Name[20]; NODE *Link; }; class QUEUE { public: QUEUE(); void Insert(); void Delete(); }; void QUEUE::Insert() { 20 NODE *R,*F;
No. NODE *Temp; Temp=new NODE; gets(Temp->Name); Temp->Link=NULL; if (Rear==NULL) { Rear=Temp; Front=Temp; } else { Rear->Link=Temp; Rear=Temp; } }
Answers
Marks
(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) { 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 Diagonal 1:"<<SumD1<<endl; cout<<"Sum of Diagonal 2:"<<SumD2<<endl; 21
No. }
Answers
Marks
( 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
22
No.
Answers
Marks
( Mark for correctly evaluating each operator) ( Mark for the correct result)
4.
23
Answers
Marks
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() { 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) 24 3
No. 5. (a)
Answers
Marks
Degree: Number of Columns in a table Cardinality: Number of rows in a table (1 Mark for each definition)
(b)
(i)
SELECT Acodes, ActivityName FROM ACTIVITY ORDER BY Acode DESC; (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)
(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)
25
Answers
Marks
( 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 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) 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)
No. (d)
Answers
Marks 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 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 Mark for correct answer) c) The complaint has to be lodged with the Police under IT Act (1 Mark for correct answer) d) An Internet Protocol (IP) address is a numerical identification and logical address 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) ( Mark for mentioning the usefulness in network security) 1 1 1 1
27
No.
Answers
Marks
e)
e1)
Layout Option 2: Since the distance dis between Block A and Block B is quite short
e2)
The most suitable place plac / block to house the server of this organisatio 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 maximu computers in the network. ( Mark for suggesting suitable place and for appropriate reason)
28
No.
Answers
Marks
e3) (i)
For Layout 1, since the cabling distance between Blocks A and C, and that between B and C are quite quit large, so a repeater each, would ideally be needed along their path to avoid avoi loss of signals during the course of data flo flow in these routes.
For layout 2, since the distance ance between Blocks A and C is large so a repeater would ideally be placed in between this path
29
No. (ii)
Answers In both the layouts, a hub/switch each would be needed in all the blocks, to interconnect the group p of cables from the different computers in eac each block
Marks
Layout 1
Layout 2
( Mark for suggesting suitable place for connecting hub) e4) The most economic way to connect connec it with a reasonable high speed would d 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 als have the advantage of being omni directional 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 carefull aligned physically. ( 1 Mark for appropriate answer) f) Spam mails, also known as junk jun e-mail, is a subset of spam that involves nearly identical messages sent to numerous numerou 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) 30 1
No.
Answers
Marks
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)
31