Xii cbse previous year question paper
Download
1 / 59

XII CBSE Previous Year Question Paper - PowerPoint PPT Presentation


  • 99 Views
  • Uploaded on

XII CBSE Previous Year Question Paper. QUESTION NO 1 (D) 2 or 3 Marks. 1. (d) Find the output of the following program : Delhi 2006 3 #include<iostream.h> #include<string.h> class state { char *state_name; int size; public:

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' XII CBSE Previous Year Question Paper' - magda


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Xii cbse previous year question paper
XII CBSE Previous Year Question Paper

QUESTION NO

1 (D)

2 or 3 Marks


1. (d) Find the output of the following program :

Delhi 2006 3

#include<iostream.h>

#include<string.h>

class state

{ char *state_name;

int size;

public:

state( ); { size=0; state_name=new char[size+1]; }

state(char *s)

Contd…


{ size = strlen(s) ; state_name = new char[size+1];

strcpy(state_name,s);

}

void display( ) {cout<<state_name<<endl;}

void Replace (state & a, state & b)

{ size = a.size + b.size;

delete state_name;

state_name = new char[size+l];

strcpy(state_name, a.state_name);

strcat(state_name, b.state_name);

}

}; contd…


void main( )

{ char * temp = “Delhi”;

state state1 (temp), state2(“Mumbai”), state3(“Nagpur”), S1, S2;

S1.Replace(state1, state2);

S2. Replace(S1, state3);

S1.display( );

S2.display( );

}


Answer:

(d) DelhiMumbai

DelhiMumbaiNagpur

(3 full marks for identifying error in definition of the constructor

state() in Line 7)

OR

(3 marks for the correct lines of output)

OR

(2 marks for any one correct line of output)

OR

(1 Mark for showing the output starting with Delhi)


2 (d) Find the output of the following program : OD 2006 3

#include<iostream.h>

#include<string.h>

class student

{ char *name;

int l;

public:

student() { l=0; name=new char[1+1]; }

student(char *s)

{ l=strlen(s); name=new char[1+1];

strcpy (name,s);

} contd…


void display() { cout<<name<<endl;} 2006 3

void manipulate(student & a, student & b)

{ l=a.l + b.l;

delete name;

name=new char[l+l];

strcpy(name, a.name);

strcat(name, b.name);

}

};


void main() 2006 3

{ char * temp =''Jack'';

student name1(temp), name2('' Jill''), name3('' John'' ),S1,S2;

S1.manipulate(name1,name2);

S2.manipulate(S1,name3);

S1.display();

S2.display();

}


Answer : 2006 3

(d) JackJill

JackJillJohn

(2 marks for any one correct line)

(Full 3 marks for both lines correct)

(½ mark to be deducted from full 3 marks, if endl is not considered)


3 (d) Find the output of the following program : Delhi 2007 2

#include<iostream.h>

void main()

{

int Numbers[] = {2,4,8,10};

int *ptr = Numbers;

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

{

cout<< *ptr << [email protected];

ptr++;

}


3 (d) Find the output of the following program : Delhi 2007 2

cout<<endl;

for(C = 0; C<4; C++)

{

(*ptr)*=2;

--ptr;

}

for(C = 0; C<4; C++)

cout<< Numbers [C]<< “#”;

cout<<endl;

}


(d) 2 @ 4 @ 8 @ Delhi 2007 2

4 # 8 # 16 # 20 #

(1 Mark for each correct line of output)

Note:

· ½ Mark to be deducted for missing symbols in each line of output

· ½ Mark to be deducted if endl is not considered in the output

· As Borland C++ Compiler declares for loop variable locally,the program will result in syntax errors. So, any studentspecifying Variable C not declared OR mentioning that the program will not RUN


4 (d) Find the output of the following program : OD 2007 2

# include < iostream.h>

void main ()

{

intArray[] = {4,6,10,12};

int *pointer = Array ;

for (int I=1 ; I<=3 ; I++)

{

cout<<*pointer<<#”;

pointer ++;

}


4 (d) Find the output of the following program : OD 2007 2

cout<<endl;

for (I=1 ; I<=4 ; I++)

{

(*pointer)*=3 ;

-- pointer;

}

for(I=l; I<5; I + + )

cout << Array [I-1] << [email protected];

cout << endl;

}


(d) 4 # 6 # 10 # 2007 2

12 @ 18 @ 30 @ 36 @

(1 Mark for each correct line of output)

Note:

· ½ Mark to be deducted for missing symbols in the output

· ½ Mark to be deducted if endl is not considered in the output

· As Borland C++ Compiler declares for loop variable locally,the program will result in syntax errors. So, any student specifying Variable I not declared OR mentioning that the program will not RUN due to incorrect syntax should be awarded full 2 Marks


5 (d) Find the output of the following program: Delhi 2008 3

#include<iostream.h>

#include<ctype.h>

void main ( )

{

char Text [ ] = [email protected]!”;

for (int I = 0; Text (I)! = ‘\0’; 1++)

{

if (!isalpha (Text[I]))

Text [I] = ‘*’;

else if (isupper (Text[I]))

Text [I] = Text [I] + 1 ;


5 (d) Find the output of the following program: Delhi 2008 3

Text [I] = Text [I] + 1 ;

else

Text (I) = Text [I+ 1];

}

cout<<Text;

}


Ans: 2008 3

Nnd@*Xrk!*

(½ Mark for N in the 1st position)

(½ Mark for nd in the 2nd and 3rd position)

(½ Mark for @ in the 4th position)

(½ Mark for * in the 5th position)

(½ Mark for Xrk!)

(½ Mark for * at the end)

332

OR

(Fu1l 3 Marks If error is mentioned in the code for Text (I) after last else)


6. (d) Find the output of the following program : OD 2008 3

#include<iostream.h>

#include<ctype.h>

void main ( )

{

char Mystring[ ] [email protected]!” ;

for(int I = 0; Mystring [I] ! =’ \0'; I++)

{

if (!isalpha (Mystring[I]))

Mystring [I] = ‘*’;

else if (isupper (Mystring[I]))


6. (d) Find the output of the following program : OD 2008 3

Mystring [I] = Mystring[I] +1;

else

Mystring [I] = Mystring [I+1];

}

cout<<Mystring;

}


Ans: 2008 3

Xat@*PVUQVU*

(½ Mark for X in the first position)

(½ Mark for at in the 2nd & 3rd positions)

(½ Mark for @ in the 4th position)

(½ Mark for * in the 5th position)

(½ Mark for PVUQvu)

(½ Mark for * at the end)


7 (d) Find the output of the following program : Delhi 2009 3

#include<iostream.h>

void main ( )

{

int X[ ] = {10, 25, 30, 55, 100};

int *p = X ;

while ( *p < 110)

{

if (*p%3 ! = 0)

*p = *p + 1 ;

else

*p = *p + 2 ;


7 (d) Find the output of the following program : Delhi 2009 3

p++;

}

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

{

cout << X[I] << “*” ;

if ( I%3 = = 0) cout<<endl ;

}

cout<<X[0]*3<<endl ;

}


  • Ans 2009 3

    • 1110*56*

    • 32*26*33

  • (½ Mark for each correct value)

  • (½ Mark for all correct endl and *)


  • 8 (d) Find the output of the following program: OD 2009 3

    #include<iostream.h>

    void main ( )

    {

    int A[ ] = {10, 15, 20, 25, 30}

    int *p = A;

    while (*p < 30)

    {

    if (*p%3 ! = 0)

    *p = *p + 2 ;

    else

    *p = *p + 1;


    8 (d) Find the output of the following program: OD 2009 3

    p++;

    }

    for (int J = 0; J<=4; J++)

    {

    cout << A[J] << “*” ;

    if ( J%3 = = 0) cout<<end1;


    Ans 2009 3

    12*

    16*22*27*

    30*90

    (1 Mark for each line with correct values)

    Note:

    Deduct ½ Mark if any/all ‘*’ missing

    Deduct ½ Mark if endl is not considered at the right positions


    9 (d) Find the output of the following program : Delhi 2010 3

    #inc1ude <iostream.h>

    struct POINT

    {int X, Y, Z;};

    void StepIn(POINT & P, int Step=1)

    {

    P.X+=Step;

    P.Y -=Step;

    P.Z+=Step;

    }


    9 (d) Find the output of the following program : Delhi 2010 3

    void StepOut(POINT & P, int Step=1)

    {

    P.X-=Step;

    P.Y+=Step;

    P.Z–=Step;

    }


    9 (d) Find the output of the following program : Delhi 2010 3

    void main ( )

    {

    POINT P1={15, 25, 5}, P2={10, 30, 20};

    StepIn(P1);

    StepOut(P2,4);

    cout<<P1.X<<“,”<<P1.Y<<“,”<<P1.Z<<endl;

    cout<<P2.X<<“,”<<P2.Y<<“,”<<P2.Z<<endl;

    StepIn(P2,12);

    cout<<P2.X<<“,”<<P2.Y<<“,”<<P2.Z<<endl;

    }


    • Ans. 2010

      • 16, 24, 6

      • 6, 34, 16

      • 18, 22, 28

  • (1 Mark for each line with -correct values)

  • OR

  • (½ Mark for any two correct values in each line)

  • Note:

  • Deduct (½ Mark if any/all ‘,’ missing

  • Deduct (½ Mark if endl is not considered at the right positions


  • 10 (d) Find the output of the following program: OD 2010 3

    #include <iostream.h>

    struct THREE_D

    {int X,Y,Z;};

    void MoveIn(THREE_D &T, int Step=l)

    }

    T.X+=Step;

    T.Y-=Step;

    T.Z+=Step

    }


    10 (d) Find the output of the following program: OD 2010 3

    void MoveOut(THREE_D &T, int Step=l)

    {

    T.X-=Step;

    T.Y+=Step;

    T.Z-=Step;

    }


    10 (d) Find the output of the following program: OD 2010 3

    void main ()

    {

    THREE_D Tl={lO,20,5},T2={30,lO,40};

    MoveIn(T1);

    MoveOut(T2,5);

    cout<<Tl.X<<“,”<<Tl.Y<<“,”<<T1.Z<<endl;

    cout<<T2.X<<“,”<<T2.Y<<“,”<<T2.Z<<endl;

    MoveIn(T2,l0);

    cout<<T2.X<<“,”<<T2.y<<“,”<<T2.Z<<endl;

    }


    • Ans. 2010 3

      • 11, 19, 6

      • 25, 15, 35

      • 35, 5, 45

  • (1 Mark for each line with correct values)

  • OR

  • (½ Mark for any two correct values in each line)

  • Note:

  • Deduct ½ Mark if any/all ',' missing

  • Deduct ½ Mark if endl is not considered at the right positions


  • 11 (d) Find the output of the following program: Delhi 2011 3

    #inc1ude<iostream.h>

    void ChangeArray(int Number, int ARR[ ], int Size)

    {

    for (int L =0; L<Size; L++)

    if (L<Number)

    ARR [L] +=L;

    e1se

    ARR [L] *=L;

    }


    11 (d) Find the output of the following program: Delhi 2011 3

    void Show (int ARR [ ], int Size)

    {

    for (int L=0; L<Size; L++)

    (L%2!=0) ?cout<<ARR[L] <<"#": cout<<ARR[L]<<end1 ;

    }

    void main ( )

    {

    int Array [ ] = {30, 20, 40, 10, 60, 50};

    ChangeArray (3, Array, 6) ;

    Show (Array, 6) ;

    }


    • Ans 2011 3

      • 30

      • 21#42

      • 30#240

      • 250#

  • (½ Mark for each correct value)

  • Note:

  • Deduct ½ Mark for not writing # at proper places

  • Deduct ½ Mark for not considering endl at proper places


  • 12 (d) Find the output of the following program: OD 2011 3

    #include <iostream.h>

    void SwitchOver(int A [ ], int N, int Split)

    {

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

    if (K<Split)

    A(K]+ =K;

    else

    A [K]*=K;

    }


    12 (d) Find the output of the following program: OD 2011 3

    void Display (int A [ ], int N)

    {

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

    (K%2==0)? cout<<A[K]<<"%":cout<<A(K]<<end1;

    }

    void main ( )

    {

    int H[ ]= {30,40,50,20,10,5};

    SwitchOver (H, 6, 3);

    Display (H, 6);

    }


    • Ans 2011 3

      • 30%41

      • 52%60

      • 40%25

  • (1 Mark for each line with correct values)

  • Note:

  • Deduct ½ Mark if any/all '% t missing

  • Deduct ½ Mark if endl is not considered at the right positions


  • 13 (d) Find the output of the following program: 2011 3SP 2010 SET I 3

    #include <iostream.h>

    struct GAME

    { int Score, Bonus;};

    void Play(GAME &g, int N=10)

    {

    g.Score++;g.Bonus+=N;

    }


    13 2011 3 (d) Find the output of the following program: SAMPLE PAPER 2010 SET I 3

    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;

    }


  • (1 Mark for each correct line of output)


  • 14 (d) Find the output of the following program: SAMPLE PAPER 2010 SET II 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);


    14 (d) Find the output of the following program: SAMPLE PAPER 2010 SET II 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] <<'#';

    }


    • d) PAPER 2010 SET II 3

      • 7#9#5#

      • 30#50#70#40#

      • 2100#1200#

  • (1 Mark for each line of output)


  • 15 SAMPLE PAPER 2012 SET I PAPER 2010 SET II 3


    15 SAMPLE PAPER 2012 SET I PAPER 2010 SET II 3


    16 SAMPLE PAPER 2012 SET II PAPER 2010 SET II 3


    16 SAMPLE PAPER 2012 SET II PAPER 2010 SET II 3


    17 (d) Find the output of the following program: PAPER 2010 SET II 3

    SAMPLE PAPER 2009 SET I 3

    #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);


    17 (d) Find the output of the following program: PAPER 2010 SET II 3

    SAMPLE PAPER 2009 SET I 3

    cout<<PL.Score<<”:”<<PL.Bonus<<endl;

    Calculate(PL);

    cout<<PL.Score<<”:”<<PL.Bonus<<endl;

    Calculate(PL,15);

    cout<<PL.Score<<”:”<<PL.Bonus<<endl;

    }


  • (1 Mark for each correct line of output)

  • Note:

  • Deduct ½ Mark for not showing : in the output

  • Deduct ½ Mark for not considering endl


  • 18 (d) Find the output of the following program: SAMPLE PAPER 2009 SET II 3

    #include <iostream.h>

    void Changethecontent(int Arr[], int Count)

    {

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

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

    }


    18 (d) Find the output of the following program: SAMPLE PAPER 2009 3

    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++)


    18 (d) Find the output of the following program: SAMPLE PAPER 2009 SET II 3

    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] <<’#’;

    }


  • (1 Mark for each correct line of output)

  • Note:

  • Deduct ½ Mark for not showing : in the output

  • Deduct ½ Mark for not considering endl


  • THANK YOU program: SAMPLE PAPER 2009 SET II 3


    ad