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

Slides:



Advertisements
Similar presentations
A: acceleration E: equilibrium Determine whether the following diagrams illustrate acceleration or equilibrium. Number your paper from 1 to 5 and answer.
Advertisements

Mental Mind Gym coming …. 30 Second Challenge - Early Additive.
COSC 2007 Data Structures II Chapter 12 Advanced Implementation of Tables II.
Multiplication and division as arrays 1) 2)3) 4)5) 7) 6) 8) 9) Use each array to write 2 multiplication and 2 division sentences ©
Chapter 7 Completing a Program
Ozone Level ppb (parts per billion)
Copyright © 2002 Pearson Education, Inc. Slide 1.
Chapter 6 Structures and Classes. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Learning Objectives Structures Structure types Structures.
Chapter 8 Operator Overloading, Friends, and References.
Chapter 17 Linked Data Structures. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives Nodes and Linked Lists Creating,
Etter/Ingber Arrays and Matrices. Etter/Ingber One-Dimensional Arrays 4 An array is an indexed data structure 4 All variables stored in an array are of.
WHAT DO THEY ALL MEAN?. Median Is the number that is in the middle of a set of numbers. (If two numbers make up the middle of a set of numbers then the.
1 Chapter 10 - Structures, Unions, Bit Manipulations, and Enumerations Outline 10.1Introduction 10.2Structure Definitions 10.3Initializing Structures 10.4Accessing.
StructuresStructures Systems Programming. Systems Programming: Structures 2 Systems Programming: 2 StructuresStructures Structures Structures Typedef.
StructuresStructures Systems Programming. StructuresStructures Structures Structures Typedef Typedef Declarations Declarations Using Structures with Functions.
Fixed and Variable Costs. Median income per household member in the U.S. in 2006 was in the range from: 1)$15,000-20,000 2)$20,000-25,000 3)$25,000-30,000.
2007 Pearson Education, Inc. All rights reserved C Structures, Unions, Bit Manipulations and Enumerations.
2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 10 - Structures, Unions, Bit Manipulations, and Enumerations Outline 10.1Introduction 10.2Structure.
Chapter 10 C Structures, Unions, Bit Manipulations, and Enumerations.
1 Structures. 2 Structure Basics A structure is a collection of data values, called data members, that form a single unit. Unlike arrays, the data members.
2000 Deitel & Associates, Inc. All rights reserved. Chapter 16 – Bits, Characters, Strings, and Structures Outline 16.1Introduction 16.2Structure Definitions.
Chapter 8: Arrays.
CS 240 Computer Programming 1
EC-111 Algorithms & Computing Lecture #11 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Number bonds to 10,
Jeopardy Start Final Jeopardy Question Category 1Category 2Category 3Category 4Category
Powerpoint Jeopardy Category 1Category 2Category 3Category 4Category
User Defined Functions Lesson 1 CS1313 Fall User Defined Functions 1 Outline 1.User Defined Functions 1 Outline 2.Standard Library Not Enough #1.
CS31 You Lu CS31-1K TA. Hello World! Variable Out of the Range You input , but it outputs another different number.
1 Lecture 16:User-Definded function I Introduction to Computer Science Spring 2006.
LECTURE 17 C++ Strings 18. 2Strings Creating String Objects 18 C-string C++ - string \0 Array of chars that is null terminated (‘\0’). Object.
Structure.
© 2006, François Brouard Case Real Group François Brouard, DBA, CA January 6, 2006.
Student Data Score First Name Last Name ID GPA DOB Phone... How to store student data in our programs? 1.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
EXERCISE IN CLASS CHAPTER 3. PART 1 IDENTIFIER SCENARIO 1 o record1 o 1record o file_3 o return o $tax o Name o name and address o name-and-address o.
User-defined Structure Types Structures: collection of data of different types. We can define a structure type student_t : typedef struct { string name;
XII CBSE Previous Year Question Paper QUESTION NO 2 (a) 2 Marks.
More Storage Structures A Data Type Defined by You Characteristics of a variable of a specific ‘data type’ has specific values or range of values that.
XII CBSE Previous Year Question Paper QUESTION NO 2 (b) 2 Marks.
XII CBSE Previous Year Question Paper QUESTION NO 1 (a) 1 OR 2 Marks.
XII CBSE Previous Year Question Paper QUESTION NO 1 (E) 2 or 3 Marks.
Chapter: 01 C++ Revision Tour
XII CBSE Previous Year Question Paper QUESTION NO 3 (a) 3 Marks.
C++ Lecture 4 Tuesday, 15 July Struct & Classes l Structure in C++ l Classes and data abstraction l Class scope l Constructors and destructors l.
1 Lecture 19 Structs HW 5 has been posted. 2 C++ structs l Syntax:Example: l Think of a struct as a way to combine heterogeneous data values together.
Dynamic memory allocation and Pointers Lecture 4.
1 Pointers to structs. 2 A pointer to a struct is used in the same way as a pointer to a simple type, such as an int. Pointers to structs were introduced.
11 Introduction to Object Oriented Programming (Continued) Cats.
XII CBSE Previous Year Question Paper QUESTION NO 1 (b) 1 OR 2 Marks.
Structured Data Chapter 11. Combining Data Into Structures Structure: C++ construct that allows multiple variables to be grouped together Format: struct.
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
1 C Language Structures. 2 Topics Concept of a structure Concept of a structure Structures in c Structures in c Structure declaration Structure declaration.
1 More Operator Overloading Chapter Objectives You will be able to: Define and use an overloaded operator to output objects of your own classes.
Ch6 & 12 Note Dr. Wang. Strings for C, C++, Java C++ string – string str = “VWC”; C- string – char cstr[21] = {‘V’, ‘W’, ‘C’, ‘\0’}; char cstr2[21] =
Computer Engineering 2 nd Semester Dr. Rabie A. Ramadan 3.
XII CBSE Previous Year Question Paper QUESTION NO 1 (F) 2 or 3 Marks.
11 Introduction to Object Oriented Programming (Continued) Cats.
Struct s (7.4) Used as data aggregates for an entity can be different types of data e.g. for student id, name, GPA, address,... Similar to classes, but.
Extra Recitations Wednesday 19:40-22:30 FENS L055 (tomorrow!) Friday 13:40-16:30 FENS L063 Friday 17: :30 FENS L045 Friday 19:40-22:30 FENS G032.
 constant represented by a name, just like a variable, but whose value cannot be changed  The const keyword precedes the type, name, and initialization.
Properties: -The value in each node is greater than all values in the node’s subtrees -Complete tree! (fills up from left to right) Max Heap.
CS162 - Topic #6 Lecture: Pointers and Dynamic Memory –Review –Dynamically allocating structures –Combining the notion of classes and pointers –Destructors.
Array and Pointers An Introduction Unit Unit Introduction This unit covers the usage of pointers and arrays in C++
Advanced Programming Constants, Declarations, and Definitions Derived Data Types.
Lecture 9 – Array (Part 2) FTMK, UTeM – Sem /2014.
Current Assignments Project 3 has been posted, due next Tuesday. Write a contact manager. Homework 6 will be posted this afternoon and will be due Friday.
XII CBSE Previous Year Question Paper QUESTION NO 1 (D) 2 or 3 Marks.
Heterogeneous aggregate datatypes
Function Overloading.
Presentation transcript:

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 #include void main( ) { struct STUDENT { char stu_name[20]; char stu_sex; int stu_age=17; } student; gets(stu_name); gets(stu_sex);}

( 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.

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

(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. }

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

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

(c) #include Delhi 2007 const 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 suggesting correction)

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

(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<<Numbers[Loc]; } (½ Marks for each correction) OR (1 Mark for identifying at least three errors, without suggesting correction)

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

#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<<N1<<N2; // Error 4 }

OR #include 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 3 Jumpto(First, Second); // Error 4 Jumpto (Second) ; } (½ Mark for each correction) OR (1 Mark for identifying at least three errors, without suggesting correction)

(c) Rewrite the following program after removing the syntax error(s), if any. Underline each correction. OD #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; }

#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<<Argl<<Arg2; //Error 4 } (½ Mark for each correction) OR (1 Mark for only identifying at least three errors, without suggesting correction)

(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. Delhi #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<<EmpId<<“ : ”<<EName<<endl;} } ; contd…

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

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<<”: “<<EName<<endl;} };

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

(c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. Outside Delhi include class MyStudent { int StudentId = 1001; char Name [20] ; public MyStudent( ){ } void Register ( ) {cin>>StudentId; gets (Name) ;} void Display ( ) {cout<<StudentId<< “:” <<Name<<end1;} } ; contd...

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

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<<”:“<<Name<<endl;} };

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

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

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

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

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

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

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

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

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

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

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

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

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

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…

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

SAMPLE PAPER 2009 SET I Answer: #include class PAYITNOW { int Charge; public: void Raise(){cin>>Charge;} void Show(){cout<<Charge;} }; CONTD…

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)

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<<P.Color,P.Style<<endl;} CONTD…

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

SAMPLE PAPER 2009 SET II #include 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…

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)

(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. SP #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

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

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

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

SAMPLE PAPER 2010 SET II (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. SP #include struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout<<P.Color,P.Style<<endl;} CONTD….

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

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

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)

SAMPLE PAPER 2012 SET I

SAMPLE PAPER 2012 SET II

Outside Delhi 2012

THANK YOU