Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "XII CBSE Previous Year Question Paper QUESTION NO 1 (C) 2 Marks."— Presentation transcript:

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

2 1(c) Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. Delhi 2006 2 #include void main( ) { struct STUDENT { char stu_name[20]; char stu_sex; int stu_age=17; } student; gets(stu_name); gets(stu_sex);}

3 ( c) Corrected Program: Delhi 2006 #include #include // Error 1 void main() { struct STUDENT { char stu_name[20]; char stu_sex; int stu_age; //Error 2 } student; gets(student.stu_name); //Error 3 cin>>student.stu_sex; //Error 4 student.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 then full marks to be given if other errors are corrected.

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

5 (c) #include #include // 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 object cin>>MOVIE.movie_type; //Error 4 -cant use gets for //char variable and member must //be accessed using object. }

6 #include 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 object cin>>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)

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

8 (c) #include Delhi 2007 const int Size =5; void main( ) { int Array[Size]={50,40,30,20,10}; for(int Ctr=0;Ctr { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_8.jpg", "name": "(c) #include Delhi 2007 const int Size =5; void main( ) { int Array[Size]={50,40,30,20,10}; for(int Ctr=0;Ctr

9 (c) Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. OD 2007 2 # include 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]; }

10 (c) #include OD 2007 const 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< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_10.jpg", "name": "(c) #include OD 2007 const 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<=0; Loc—) cout<

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

12 #include void Jumpto(int N1, int N2=20); // Error 1 void main( ) { int First = 10, Second = 20; // Error 2 Jumpto(First, Second); // Error 3 Jumpto(Second) ; } void Jumpto(int N1, int N2=20) { N1 = N1 + N2; cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_12.jpg", "name": "#include void Jumpto(int N1, int N2=20); // Error 1 void main( ) { int First = 10, Second = 20; // Error 2 Jumpto(First, Second); // Error 3 Jumpto(Second) ; } void Jumpto(int N1, int N2=20) { N1 = N1 + N2; cout<

13 OR #include void Jumpto(int N1, int N2=20) // Error 1 { N1 = N1 + N2; cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_13.jpg", "name": "OR #include void Jumpto(int N1, int N2=20) // Error 1 { N1 = N1 + N2; cout<

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

15 #include OD 2008 void Callme (int,int Arg2=20); //Error 1 void main () { int One=10,Two=20; //Error 2 Callme(One,Two); //Error 3 Callme (Two); } void Callme (int Argl, int Arg2=20) { Argl=Argl +Arg2 ; cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_15.jpg", "name": "#include OD 2008 void Callme (int,int Arg2=20); //Error 1 void main () { int One=10,Two=20; //Error 2 Callme(One,Two); //Error 3 Callme (Two); } void Callme (int Argl, int Arg2=20) { Argl=Argl +Arg2 ; cout<

16 (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] ; public Employee ( ) { } void Joining () {cin>>EmpId; gets (EName);} void List ( ) {cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_16.jpg", "name": "(c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction. Delhi 2009 2 #include [iostream.h] #include [stdio.h] class Employee { int EmpId = 901; char EName [20] ; public Employee ( ) { } void Joining () {cin>>EmpId; gets (EName);} void List ( ) {cout<

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

18 Ans Delhi 2009 #include class Employee { int EmpId; char EName[20]; public : Employee() {EmpId=901;} void Joining() {cin>>EmpId; gets (EName);} void List () {cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_18.jpg", "name": "Ans Delhi 2009 #include class Employee { int EmpId; char EName[20]; public : Employee() {EmpId=901;} void Joining() {cin>>EmpId; gets (EName);} void List () {cout<>EmpId; gets (EName);} void List () {cout<

19 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 1 mark for identifying all five errors without valid correction

20 (c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. Outside Delhi 2009 2 include class MyStudent { int StudentId = 1001; char Name [20] ; public MyStudent( ){ } void Register ( ) {cin>>StudentId; gets (Name) ;} void Display ( ) {cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_20.jpg", "name": "(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction.", "description": "Outside Delhi 2009 2 include class MyStudent { int StudentId = 1001; char Name [20] ; public MyStudent( ){ } void Register ( ) {cin>>StudentId; gets (Name) ;} void Display ( ) {cout<

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

22 Ans Outside Delhi 2009 # include class MyStudent { int StudentId; char Name[20]; public : MyStudent() {StudentId = 1001;} void Register(){ cin>>StudentId; gets (Name);} void Display () {cout«StudentId<<”:“< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_22.jpg", "name": "Ans Outside Delhi 2009 # include class MyStudent { int StudentId; char Name[20]; public : MyStudent() {StudentId = 1001;} void Register(){ cin>>StudentId; gets (Name);} void Display () {cout«StudentId<< : <>StudentId; gets (Name);} void Display () {cout«StudentId<< : <

23 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 and 1 mark for identifying all five errors without valid correction

24 (c) Rewrite the following c++ program code after removing the syntax error(s) (if any). Underline each correction. Delhi 20102 include class TRAIN { long TrainNo; char Description[25]; public void Entry ( ) { cin >>TrainNo; gets(Description); }

25 Void Display ( ) { cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_25.jpg", "name": "Void Display ( ) { cout<

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

27 void Display () { cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_27.jpg", "name": "void Display () { cout<

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

29 void ShowInfo() ( cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_29.jpg", "name": "void ShowInfo() ( cout<

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

31 void ShowInfo ( ) { cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_31.jpg", "name": "void ShowInfo ( ) { cout<

32 (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< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_32.jpg", "name": "(c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction. Delhi 2011 2 #include[iostream.h] typedef char Text(80) ; void main ( ) { Text T= Indian ; int Count=strlen(T) ; cout<

33 Ans #include #include typedef char Text [80]; void main ( ) { Text T= "Indian"; int Count=str1en(T); cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_33.jpg", "name": "Ans #include #include typedef char Text [80]; void main ( ) { Text T= Indian ; int Count=str1en(T); cout<

34 (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. OD 2011 2 include typedef char [80] String; void main ( ) { String S= "Peace"; int L=strlen(S) ; cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_34.jpg", "name": "(c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction. OD 2011 2 include typedef char [80] String; void main ( ) { String S= Peace ; int L=strlen(S) ; cout<

35 Ans #include #include typedef char String [80]; void main ( ) { String S = "Peace"; int L= strlen(S) ; cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_35.jpg", "name": "Ans #include #include typedef char String [80]; void main ( ) { String S = Peace ; int L= strlen(S) ; cout<

36 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< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_36.jpg", "name": "SAMPLE PAPER 2009 SET I c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction.2 #include [iostream.h] class PAYITNOW { int Charge; PUBLIC: void Raise(){cin>>Charge;} void Show{cout<

37 SAMPLE PAPER 2009 SET I void main() { PAYITNOW P; P.Raise(); Show(); }

38 SAMPLE PAPER 2009 SET I Answer: #include class PAYITNOW { int Charge; public: void Raise(){cin>>Charge;} void Show(){cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_38.jpg", "name": "SAMPLE PAPER 2009 SET I Answer: #include class PAYITNOW { int Charge; public: void Raise(){cin>>Charge;} void Show(){cout<>Charge;} void Show(){cout<

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

40 SAMPLE PAPER 2009 SET II c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. 2 #include struct Pixels {int Color,Style;} void ShowPoint(Pixels P) {cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_40.jpg", "name": "SAMPLE PAPER 2009 SET II c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction. 2 #include struct Pixels {int Color,Style;} void ShowPoint(Pixels P) {cout<

41 SAMPLE PAPER 2009 SET II void main() { Pixels Point1=(5,3); ShowPoint(Point1); Pixels Point2=Point1; Color.Point1+=2; ShowPoint(Point2); }

42 SAMPLE PAPER 2009 SET II #include struct Pixels {int Color,Style;}; void ShowPoint(Pixels P) {cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_42.jpg", "name": "SAMPLE PAPER 2009 SET II #include struct Pixels {int Color,Style;}; void ShowPoint(Pixels P) {cout<

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

44 (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< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_44.jpg", "name": "(c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction. SP 2010 2 #include [iostream.h] class MEMBER { int Mno;float Fees; PUBLIC: void Register(){cin>>Mno>>Fees;} void Display{cout<

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

46 SAMPLE PAPER 2010 SET I (c) #include class MEMBER { int Mno;float Fees; public: void Register(){cin>>Mno>>Fees;} void Display(){cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_46.jpg", "name": "SAMPLE PAPER 2010 SET I (c) #include class MEMBER { int Mno;float Fees; public: void Register(){cin>>Mno>>Fees;} void Display(){cout<>Mno>>Fees;} void Display(){cout<

47 SAMPLE PAPER 2010 SET I main() { MEMBER M; M.Register(); M.Display(); } ( ½ Mark each correction)

48 SAMPLE PAPER 2010 SET II (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. SP 2010 2 #include struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_48.jpg", "name": "SAMPLE PAPER 2010 SET II (c) Rewrite the following program after removing the syntactical errors (if any).", "description": "Underline each correction. SP 2010 2 #include struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout<

49 SAMPLE PAPER 2010 SET II void main() { Pixels Point1=(5,3); ShowPoint(Point1); Pixels Point2=Point1; Color.Point1+=2; ShowPoint(Point2); }

50 SAMPLE PAPER 2010 SET II (c) #include 2 struct Pixels { int Color,Style; }; void ShowPoint(Pixels P) { cout< { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3232188/slides/slide_50.jpg", "name": "SAMPLE PAPER 2010 SET II (c) #include 2 struct Pixels { int Color,Style; }; void ShowPoint(Pixels P) { cout<

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

52 SAMPLE PAPER 2012 SET I

53

54 SAMPLE PAPER 2012 SET II

55

56 Outside Delhi 2012

57 THANK YOU


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

Similar presentations


Ads by Google