Computer Science Cbse XII 2010

Embed Size (px)

Citation preview

  • 8/2/2019 Computer Science Cbse XII 2010

    1/12

    I , I[Seri'es oss I ,BollNo.

    CodeCandidates must write the I e ,the title page of the answElir-baQ).

    I "I Please check that this question paper contains 16 printed pages.

    Code number given on the right hand side of the question paper sllould-k~bewritten on the title page of the answer-book by the candidate.Please check that this question paper- contains 7 questions.Please write down the Serial Number of the questfon i be','~ ..'.attempting it.15 minutes time has been allotted to' read this question paper. The ~ue8tton;paper will be distributed at 10j5 a.m. From 10.15 a.m. to 10.30 alm., thestudent will read the question paper only and will not write any aln,wer onthe answer script during this period. '; .

    COMPUTER SCIENCETUne allowed :3hours iMaximum Ma,...:',I_ructions :

    91

    (i) All questions are compulsory.(ii) Programming Language: C++

    1. (a) What IS the difference between call by value' and call b~reference ? Also, give asuitable c++ code to illustrate both. e

  • 8/2/2019 Computer Science Cbse XII 2010

    2/12

    (b) Which C++ header file(s) will be essentially required to beincluded to run/execute the following C++ code: 1void main ()

    int Rno=24; char Name[]="Amen Singhania";coutsetw(lO)Rnosetw(20)Nameendl;

    (c) Rewrite the following C++ program code after removing thesyntax error(s) (if any). Underline each correction. 2include class FLIGHT

    long FlightCode;char Description[25];

    publicvoid AddInfo ()

    cinFlightCode; gets (Description) ;

    void ShowInfo ()

    coutFlightCodeI:"Descriptionendl;

    } ;void main ()

    FLIGHT F;AddInfo. F (); ShowLn fo ,F ();

    91 2

  • 8/2/2019 Computer Science Cbse XII 2010

    3/12

    Find the output of the following program :#include struct THREE D

    int X,Y,Zi}ivoid Moveln (THREE_D &T, int Step=l){

    T.X+=StepiT.Y-=StepiT.Z+=Stepi

    }

    void MoveOut(THREE_D &T,int Step=l)T.X-=StepiT.Y+=StepiT.Z-=Stepi

    }void main ()

    THREE D Tl={lO,20,S},T2={30,lO,40};Moveln(Tl);MoveOut(T2,S);coutTl.X","Tl.Y","Tl.Zendl;coutT2 .X" ,"T2 .Y" ,,.T2 ..Zendl iMoveln(T2,lO);coutT2.X","T2.Y","T2.Zendl;

  • 8/2/2019 Computer Science Cbse XII 2010

    4/12

    (e)

    91

    Find the output of the following program : 2#include #include void MyCode (char Msg[ ] ,char CH)

    for (int Cnt=O;Msg[Cnt] !=' \0' ;Cnt++)

    if (Msg[Cnt]>='B' && Msg[Cnt]

  • 8/2/2019 Computer Science Cbse XII 2010

    5/12

    (f) The following code is from a game, which generates a set IOf4 random numbers. Praful is playing this game, help him toidentify the correct optionls) out of the four choices given belOiWas the possible set of such numbers generated from the program

    I

    code so that he wins the game. Justify your answer.#include #include const int LOW=25;void main ()

    randomize(};int POINT=5, Number;for (int 1=1;1

  • 8/2/2019 Computer Science Cbse XII 2010

    6/12

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

    91

    class Exam

    int Rno,MaxMarks,MinMarks,Marks;pUblic:

    Exam () //Module 1

    Rno=101;MaxMarks=100;MinMarks=40;Marks=7S;

    Exam (int Prno, int Pmarks) /IModule 2

    Rno=Prno;MaxMarks=100;MinMarks=40;Marks=Pmarks;

    +Ex am () //Module 3

    cout"Exam Over" endl;

    void Show () /IModule 4

    coutRno":"MaxMarks":"MinMarksendl;cout" [Marks Got] "Marksendl;

    } ;

    (i) As per Object Oriented Programming, which concept ISillustrated by Module 1 and Module 2 together ?(ii) What is Module 3 referred as ? When do you think,

    Module 3 will be invoked/called?

    6

  • 8/2/2019 Computer Science Cbse XII 2010

    7/12

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

    Private Members

    ICode of type integer (Item Code) Item of type string (Item Name) . ,

    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 FindDiscO to calculate discount 4s

    per the following rule :

    IfQty

  • 8/2/2019 Computer Science Cbse XII 2010

    8/12

    (d)

    91

    Answer the questions (i) to (iv) based on the followingclass 'Director

    IIDirector Identification Numberong DID;char Name[20);

    protected:char Description[40];void Allocate () ;

    public:Director() ;void Assign () ;void Show () ;

    } ;class Factory:public Director

    int FID; IIFactory IDchar Address[20];

    protected:int NOE; I INo. of Employees

    public:Factory() ;void Input () ;void Output () ;

    } ;class ShowRoom:private Factory

    int SID;char City[20];

    public:ShowRoom() ;void Enter () ;void Display () ;

    IIShowroom ID

    };8

    4

  • 8/2/2019 Computer Science Cbse XII 2010

    9/12

    ~

    (i) Which type of"iflheri"'~,out of the. following is illustr~in the above C++"~? .'. i . ." . I(a) Single Letei.~ce. (b) Multi Level ~ce(c) Multiple ~ . , ' t - . . !(ii) Write the naril_6fi'" members, which are accessibl~.y. objects of class type ~Room. ,.

    (iii) Write the nameso ..aU member functions which~eaccessible by objec;ts,telass type ShowRoom. .'.

    (iv) Write the names ofatt,members, which are accessible ~o.,.member functionsofc.f. Factory. .

    Write afunctionREASSla~ in, C:+-+,which accepts an array , fintegers and its size as ~rs and divide all those a r t ...elements by 5 which\.re.di .... ~e by 5 and multiply other a r t *

    elements by 2.Sample Input Data of the ~J

    32

    A[O] A[I] A[21 AI'), /', ..,20 12 15 'it

    A[4T

    Conteht of the array after .... REASSIGNO functionA[O] A[I] A[2] A[414 24 3 h 64

    An array T[90][100] is store.' in the memory along the colu~ .with each of the elements 'ocu.pying .4 bytes. Find out ~I

    memory location for the elemtnt 1'[10][40], if the Base Address :of, . iIthe array is 7200.

    ' ; J -Write a complete program in C++ to implement a dynami~al~allocated Queue containing namesofCities.

    9

  • 8/2/2019 Computer Science Cbse XII 2010

    10/12

    (d)

    4. (a)

    91

    Write a function lint ALTERSUM (int B [] [5] , int N, in~ in C++ tofind and return the sum of elements from all alternate elementsof a two-dimensional array starting from B[O][O].Hint:If the following is the content of the array

    2

    B[O][O] B[O][l] B[O][2]4 5 1

    B[l][O] B[l][l] B[1][2]2 8 7

    B[2][O] B[2][1] B[2][2]9 6 3

    The function should add elements B[O][O], B[O][2], B[l][l], B[2][O]and B[2][2],

    (e) Evaluate the following postfix notation of expression :(Show status of Stack after each operation)True, False, NOT, OR, False, True, OR,AND

    2

    Observe the program segment given below carefully and fill theblanks marked as Statement 1 and Statement 2 using tellgt) andseekpO functions for performing the required task. 1#include class Customer

    long Cno;char Name[20J,Mobile[12J;public://Function to allow user to enter the Cno, Name, Mobile

    void Enter();I/Function to allow user to enter (modify) mobile numbervoid Modify();//Function to return value of Cnolong GetCno () {return Cno;}

    } ;

    10

  • 8/2/2019 Computer Science Cbse XII 2010

    11/12

    .11 P .T tO, .

    void ChangeMobile(){

    Customer Cifstream FiF. open ("CONTAcT. DAT ",Los ::binary I ios ::in Iios: :out) ilong Cnoci IICus tomer no. whose mobile number needs to hecinCnociwhile (F.read ((char*) &C,sizeof (C)))

    if (Cnoc==C.GetCno(

    C.ModifyO iI/Statemeht 1

    int Pos= IITo fi.ndt.hecur rent;position of file poirtter;t~I';

    IIStatement 2liTo move the file pointer to write theIlmodified record back onto the fileIlfor the dead red Cnoc

    F.write((char*)&C,sizeof(C;

    } ,F.close()i

    J

  • 8/2/2019 Computer Science Cbse XII 2010

    12/12

    ( D

    (g)

    91

    (el) Suggest a cable layout of connections between thebuildings.

    (e2) Suggest the most suitable place (i.e. building) to house theserver for this NGO. Also, provide a suitable reason foryour suggestion.

    (e3) Suggest the placement of the following devices withjustification :(i) Repeater(ii) Hub/Switch

    (e4) The NGO is planning to connect its International officesituated in Delhi. Which out of the following wiredcommunication links, will you suggest for a very high speedconnectivity?(i) Telephone Analog Line(ii) Optical Fiber(iii) Ethernet Cable

    Write the full forms of the following :(fl) FTP(2) FSF

    1

    Name any two common Web browsers. 1

    16 74,000