XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

57
XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks

Transcript of XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Page 1: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

XII CBSE Previous Year Question

Paper

QUESTION NO 1 (C)

2 Marks

Page 2: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

1(c) Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. Delhi 2006 2

#include<iostream.h>void main( ){ struct STUDENT{ char stu_name[20];char stu_sex;int stu_age=17;} student;gets(stu_name);gets(stu_sex);}

Page 3: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Corrected Program: Delhi 2006#include<iostream.h>#include<stdio.h> // Error 1void main(){ struct STUDENT{ char stu_name[20];char stu_sex;int stu_age; //Error 2} student;gets(student.stu_name); //Error 3cin>>student.stu_sex; //Error 4student.stu_age = 17; //Ignored}( ½ mark each for removing four errors)OR(1 Mark to be given for only identification of all the errors without rectification)Note: If student replaces gets by cin>> or cin.getline( )and does not mention <stdio.h> then full marks to be given if other errors are corrected.

Page 4: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical error(s), if any.Underline each correction. OD 2006 2#include <idstream.h>void main(){ struct movie{ char movie_name[20];char movie_type;int ticket_cost = 100}MOVIE;gets(movie_name);gets(movie_type);}

Page 5: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) #include<iostream.h>#include<stdio.h> // Error 1 - needed for gets()void main(){struct movie{char movie_name[20];char movie_type;int ticket_cost = 100; //Error 2 - assignment not//possible inside structure definition}MOVIE;gets(MOVIE.movie_name);//Error 3 -members must be//accessed using objectcin>>MOVIE.movie_type; //Error 4 -cant use gets for//char variable and member must//be accessed using object.}

Page 6: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

#include<iostream.h>void main(){struct movie{char movie_name[20];char movie_type;int ticket_cost = 100; //Error 1 – initialization‘ not//possible inside structure definition}MOVIE;cin.getline(MOVIE.movie_name,20);//Error 2 -members must be accessed using objectcin>>MOVIE.movie_type; //Error 3 -cant use gets for//char variable and member must//be accessed using object.}(1 mark for identifying and correcting any one Error)(1 ½ mark for identifying and correcting any two errors)(2 marks for identifying and correcting more than two errors)OR(1 mark for only identifying all errors)

Page 7: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. Delhi 2007 2#include <iostream.h>const int Size 5;void main(){int Array[Size];Array = {50,40,30,20,10};for(Ctr=0; Ctr<Size; Ctr++)cout>>Array[Ctr];}

Page 8: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) #include<iostream.h> Delhi 2007const int Size =5;void main( ){int Array[Size]={50,40,30,20,10};for(int Ctr=0;Ctr<Size;Ctr++)cout<<Array[Ctr];}(½ Mark for each correction)OR(1 Mark for identifying at least three errors, without suggestingcorrection)

Page 9: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical error(s) if any.Underline each correction. OD 2007 2# include <iostream.h>const int Max 10;void main ( ){int Numbers [Max];Numbers = { 20, 50,10, 30,40 } ;for (Loc= Max-1 ; Loc > = 0 ; Loc - -)cout>>Numbers [Loc];}

Page 10: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) #include<iostream.h> OD 2007const int Max = 10; //OR const int Max = 5;void main(){int Numbers[Max]= {20,50,10,30,40};// OR int Numbers[]= {20,50,10,30,40};int Loc;for(Loc=Max-1; Loc>=0; Loc—)cout<<Numbers[Loc];}(½ Marks for each correction)OR(1 Mark for identifying at least three errors, without suggestingcorrection)

Page 11: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. Delhi 2008 2#include < iostream.h >void main ( ){First = 10, Second = 20;Jumpto (First; Second);Jumpto (Second);}void Jumpto (int N1, int N2=20){N1 = N1 + N2;cout<<N1>>N2;}

Page 12: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

#include <iostream.h>void Jumpto(int N1, int N2=20); // Error 1void main( ){int First = 10, Second = 20; // Error 2Jumpto(First, Second); // Error 3Jumpto(Second) ;}void Jumpto(int N1, int N2=20){N1 = N1 + N2;cout<<N1<<N2; // Error 4}

Page 13: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

OR#include <iostream.h>void Jumpto(int N1, int N2=20) // Error 1{N1 = N1 + N2;cout<<N1<< N2; // Error 2}void main ( ){int First = 10, Second = 20; // Error 3Jumpto(First, Second); // Error 4Jumpto (Second) ;}(½ Mark for each correction)OR(1 Mark for identifying at least three errors, without suggestingcorrection)

Page 14: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntax error(s), if any. Underline each correction. OD 2008 2#include <iostream.h>void main ( ){One = 10, Two = 20;Callme (One;Two) ;Callme (Two) ;}void Callme (int Arg1, int Arg2=20){319Arg1 = Arg1 + Arg2;cout<<Arg1>> Arg2;}

Page 15: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

#include <iostream.h> OD 2008void Callme (int,int Arg2=20); //Error 1void main (){int One=10,Two=20; //Error 2Callme(One,Two); //Error 3Callme (Two);}void Callme (int Argl, int Arg2=20){Argl=Argl +Arg2 ;cout<<Argl<<Arg2; //Error 4}(½ Mark for each correction)OR(1 Mark for only identifying at least three errors, without suggestingcorrection)

Page 16: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction.

Delhi 2009 2#include [iostream.h]#include [stdio.h]class Employee{int EmpId = 901;char EName [20] ;publicEmployee ( ) { }void Joining () {cin>>EmpId; gets (EName);}void List ( ) {cout<<EmpId<<“ : ”<<EName<<endl;}} ;contd…

Page 17: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void main ( ){Employee E ;Joining.E ( ) ;E. List ( )}

Page 18: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Ans Delhi 2009 #include <iostream.h>#include <stdio.h>class Employee{ int EmpId;char EName[20];public :Employee() {EmpId=901;}void Joining() {cin>>EmpId; gets (EName);}void List () {cout<<EmpId<<”: “<<EName<<endl;}};

Page 19: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void main (){ Employee E;E.Joining ();E.List ();}(½ Mark for writing both header files inside < >)(½ Mark for removing = 901 from int Empld = 901;)(½ Mark for writing: after public and; after E.List())(½ Mark for writing E.Joining ( ); correctly)Note: ½ mark for identifying any two errors without valid correction and 1mark for identifying all five errors without valid correction

Page 20: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction.

Outside Delhi 2009 2include <iostream.h>include <stdio.h>class MyStudent{

int StudentId = 1001;char Name [20] ;publicMyStudent( ){ }void Register ( ) {cin>>StudentId; gets (Name) ;}void Display ( ) {cout<<StudentId<< “:” <<Name<<end1;}} ;contd...

Page 21: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void main ( ){MyStudent MS ;Register.MS( ) ;MS.Display( ) ;}

Page 22: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Ans Outside Delhi 2009 # include <iostream.h># include <stdio.h>class MyStudent{ int StudentId;char Name[20];public :MyStudent() {StudentId = 1001;}void Register(){ cin>>StudentId; gets (Name);}void Display () {cout«StudentId<<”:“<<Name<<endl;}};

Page 23: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void main (){MyStudent MS;MS. Register ();MS. Display () ;}(½ Mark for writing both include as #include)(½ Mark for removing = 1001 from int StudentId = 1001;)(½ Mark for writing: after public)(½ Mark for writing MS. Register ( ) ; correctly)Note: ½ mark for identifying any two errors without valid correction and1 mark for identifying all five errors without valid correction

Page 24: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following c++ program code after removing the syntax error(s) (if any). Underline each correction. Delhi 2010 2include <iostream.h>class TRAIN{long TrainNo;char Description[25];publicvoid Entry ( ){cin >>TrainNo; gets(Description);}

Page 25: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Void Display ( ){cout<<TrainNo<<“:”<<Description<<endl;}};void main( ){TRAIN T;Entry. T( ); Display. T( );}

Page 26: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Ans. #include<iostream.h>#include<stdio.h>class TRAIN{long TrainNo;char Description [25];public:void Entry (){cin>>TrainNo; gets (Description);}

Page 27: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void Display (){cout<<TrainNo<<“:”<<Description<<end1;}};void main (){TRAIN T;T.Entry(); T.Display();}(½ Mark for writing # before include<iostream.h>(½ Mark for writing # include <stdio.h>(½ Mark for writing: after public)(½ Mark for writing T.Entry(); and T.Display(); correctly)

Page 28: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following C++ program code after removing the syntax error(s) (if any). Underline each correction. OD 2010 2include <iostream.h>class FLIGHT{long FlightCode;char Description[25];publicvoid AddInfo(){cin>>FlightCode; gets (Description) ;{

Page 29: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void ShowInfo()(cout<<FlightCode<<“:”<<Description<<endl;}} ;void main(){FLIGHT F;AddInfo.F(); ShowInfo.F();}

Page 30: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Ans. #include <iostream.h> / / Error 1#include <stdio.h> / / Error 2class FLIGHT{long FlightCode;char Description[25];public : / / Error 3void AddInfo ( ){cin>>FlightCode; gets (Description) ;}correction)

Page 31: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

void ShowInfo ( ){cout<<FlightCode<<”:”<<Description<<endl;}} ;void main ( ){FLIGHT F;F.AddInfo( ) ; F. ShowInfo ( ) ; / / Error 4}(½ Mark for each correction)OR(1 mark for identifying at least three errors, without suggesting

Page 32: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. Delhi 2011 2#include[iostream.h]typedef char Text(80) ;void main ( ){Text T= "Indian";int Count=strlen(T) ;cout<<T<<'has'<<Count<< 'characters' <<end1;}

Page 33: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Ans #include<iostream.h>#include<string.h>typedef char Text [80];void main ( ){Text T= "Indian";int Count=str1en(T);cout<<T<< "has" <<Count<< "cbaracters"<<end1 ;}(½ Mark for writing # include<iostream.h>(½ Mark for writing # include<string.h>(½ Mark for writing typedef char Text(80];(½ Mark for writing "has" and "characters")

Page 34: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. OD 2011 2include<iostream.h>typedef char [80] String;void main ( ){String S= "Peace";int L=strlen(S) ;cout<<S<< 'has'<<L<< 'characters'<<end1;}

Page 35: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Ans #include<string.h>#include<iostream.h>typedef char String [80];void main ( ){String S = "Peace";int L= strlen(S) ;cout<<S<< "has" << L << "characters"<<end1;}(½ Mark for writing # include<string.h>(½ Mark for adding # before include<iostream.h>(½ Mark for writing typedef char string[80];)(½ Mark for writing "has" and "characters")

Page 36: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET I

c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2#include [iostream.h]class PAYITNOW{int Charge;PUBLIC: void Raise(){cin>>Charge;} void Show{cout<<Charge;}}; CONTD…

Page 37: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET I

void main(){PAYITNOW P;P.Raise();Show();}

Page 38: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET I

Answer:#include <iostream.h>class PAYITNOW{int Charge;public: void Raise(){cin>>Charge;} void Show(){cout<<Charge;}};CONTD…

Page 39: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET I

Answer:void main(){PAYITNOW P;P.Raise();P.Show();}(1/2 Mark for correcting each error)OR(1 Mark for identifying all the 4 errors with no

correction)

Page 40: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET IIc) Rewrite the following program

after removing the syntactical errors (if any). Underline each correction. 2#include <iostream.h>struct Pixels{ int Color,Style;}void ShowPoint(Pixels P){ cout<<P.Color,P.Style<<endl;}

CONTD…

Page 41: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET II

void main(){

Pixels Point1=(5,3);ShowPoint(Point1);

Pixels Point2=Point1;Color.Point1+=2;

ShowPoint(Point2);}

Page 42: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET II#include <iostream.h>struct Pixels{ int Color,Style;};void ShowPoint(Pixels P){

cout<<P.Color<<P.Style<<endl;}void main(){

Pixels Point1={5,3};ShowPoint(Point1);

Pixels Point2=Point1;CONTD…

Page 43: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2009 SET II

Point1.Color+=2;ShowPoint(Point2);}(1/2 Mark for correcting each error)OR(1 Mark for identifying all the 4 errors with no

correction)

Page 44: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. SP 2010 2#include [iostream.h]class MEMBER{int Mno;float Fees;PUBLIC:void Register(){cin>>Mno>>Fees;}void Display{cout<<Mno<<" : "<<Fees<<endl;}}; CONTD…..

SAMPLE PAPER 2010 SET I

Page 45: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET I

void main(){MEMBER M;Register();M.Display();}

Page 46: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET I

(c) #include <iostream.h>class MEMBER{int Mno;float Fees;public:void Register(){cin>>Mno>>Fees;}void Display(){cout<<Mno<<":"<<Fees<<endl;}};CONTD….

Page 47: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET I

main(){MEMBER M;M.Register();M.Display();}( ½ Mark each correction)

Page 48: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET II

(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. SP 2010 2#include <iostream.h>struct Pixels{ int Color,Style;}void ShowPoint(Pixels P){ cout<<P.Color,P.Style<<endl;}

CONTD….

Page 49: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET II

void main(){Pixels Point1=(5,3);ShowPoint(Point1);Pixels Point2=Point1;Color.Point1+=2;ShowPoint(Point2);}

Page 50: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET II (c) #include <iostream.h> 2struct Pixels{ int Color,Style;};void ShowPoint(Pixels P){ cout<<P.Color<<P.Style<<endl;}

Contd…

Page 51: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2010 SET II

void main(){Pixels Point1={5,3};ShowPoint(Point1);Pixels Point2=Point1;Point1.Color+=2;ShowPoint(Point2);}( ½ Mark for each correction)

Page 52: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2012 SET I

Page 53: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2012 SET I

Page 54: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2012 SET II

Page 55: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

SAMPLE PAPER 2012 SET II

Page 56: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

Outside Delhi 2012

Page 57: XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks.

THANK YOU