1 / 32

XII CBSE Previous Year Question Paper

XII CBSE Previous Year Question Paper. QUESTION NO 1 (a) 1 OR 2 Marks. 1 1. (a) Name the header file to which the following belong 1 abs( ) isupper( ) 2006 Delhi 1. (a) (i) math.h (ii) ctype.h ( ½ Marks for each correct Header File). 2

Download Presentation

XII CBSE Previous Year Question Paper

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 1 1. (a) Name the header file to which the following belong 1 • abs( ) • isupper( ) 2006 Delhi 1. (a) (i) math.h (ii) ctype.h ( ½ Marks for each correct Header File)

  3. 2 1. (a) Name the header file to which the following belong : 1 (i) pow() (ii) random() 2006 OD 1. (a) (i) math.h / complex.h (ii) stdlib.h (1/2 Marks for each correct Header File)

  4. 3 1. (a) Differentiate between a Logical Error and Syntax Error. Also give suitable examples of each in C++. 2 2007 Delhi 1. (a) Logical Error: Error occurred due to incorrect logic applied by the programmer. Syntax Error: Error occurred due to not following the proper grammar/syntax of the language OR Error occurred due to violating rules of the programming language

  5. Example: //Program to find area and perimeter of rectangle void main() { int A,B,AR,P; A=10; B=20; AR=2*(A*B); //Logical Error – Wrong Formula P=2*(A+B); cout<<A<<P>>endl; //Syntax Error – Use of >> with cout } (½ Mark for each correct explanation of Logical Error and Syntax Error) (½ Mark for each correct example of Logical Error and Syntax Error) OR (Full 2 Marks for correct examples demonstrating the difference between Logical Error and Syntax Error) Note: Only 1 Mark to be awarded if Explanation is given without supporting example.

  6. 4 1. (a) Differentiate between a Run Time Error and Syntax Error. Also give suitable examples of each in C++. 2 2007 OD 1. (a) Run Time Error : Error occurring in a program during its execution. Program execution halts when such an error is encountered. Example: int A,B,C; cin>>A>>B; C=A/B;//Runtime error if value of B is zero. Syntax Error: Error occurred due to wrong syntax of language detected by the compiler during compilation. Example: cout>>”A C++ Program”; (½ Mark for each correct explanation of Runtime Error and Syntax Error)

  7. (½ Mark for each correct example of Runtime Error and Syntax Error) OR (Full 2 Marks for correct examples demonstrating the difference between Runtime Error and Syntax Error) OR (Only 1 Mark to be awarded if Explanation with out supporting examples)

  8. 5 1. (a) What is the difference between #define and const? Explain with suitable example. 2 2008 D #define: It is a pre-processor directive in C++ for creating a Macro. Example: #define sqr(i) i*i const: It is an Access Modifier in C++ that assigns a constant (non modifiable) value to a variable. Any attempt in modifying the value assigned to such a variable is reported as an error by the compiler. Example: const float Pi = 3.14; (½ Mark for each correct explanation of #define and const) (½ Mark for each correct example of #define and const) OR (Full 2 Marks for correct examples demonstrating the difference between #define and const) OR (Only 1 Mark to be awarded if Explanation without supporting examples)

  9. 6 (a) What is the purpose of using a typedef command in C++. Explain with suitable example. 2 2008 OD Ans: Typedef: This keyword allows creating synonyms or aliases for previously defined data types The general form of typedef is typedef old_name new_name; OR typedef is used for renaming a data type. Example: typedef char STR [80]; OR typedef signed char SMALLNUM; OR typedef float REAL; OR typedef long int BIGNUM; OR typedef int MAT[2][3] ; (1 Mark for definition of typedef) (1 Mark for example of typedef) OR (Full 2 Marks for an example with an appropriate explanation)

  10. 7 1. (a) What is the difference between call by value and call by reference? Give an example in C++ to illustrate both. 2 2009 D Call by valueis used to create a temporary copy of the data coming from the actual parameter into the formal parameter. The changes done in the function in formal parameter are not reflected back in the calling environment. It does not use ‘&’ sign. Call by referenceis used to share the same memory location for actual and formal parameters and so changes done in the function are reflected back in the calling environment. It uses ‘&’ sign.

  11. void Compute(int A, int &B) { A++; B++; cout<<”In the function”<<endl; cout<<”A=”<<A<<“&”<<“B=”<<B<<endl; } void main () { int I=50,J=25; cout<<”Before function call “<<endl; cout<<”I=”<<I<<”&”<<”J=”<<J <<endl; Compute (I,J) ; cout<<”After function call “<<endl; cout<<I=”<<I<<”&”<<”J=”<<J <<endl; }

  12. OUTPUT Before function call I=50&J=25 In the function A=51&B=26 After function call I=50&J=26 (½ Mark for each correct explanation of Call by Value and Call by Reference) (½ Mark for each correct example of Call by Value and Call by Reference) OR (Full 2 Marks for correct examples demonstrating the difference between Call by Value and Call by Reference) OR (Only 1 Mark to be awarded if Explanation without supporting examples) Note: Output is optional

  13. 8 1. (a) What is the difference between Actual Parameter and Formal Parameter? Give an example in C++ to illustrate both types of parameters. 2 2009 OD A parameter used in the function call is known as Actual Parameter. It is used to send the data to function. A parameter used in the function definition is known as Formal Parameter, It is used to accept the data from actual parameter. void Seventimes(int A)//A is formal parameter { cout<<7*A; }

  14. void main () { int P=6; Seventimes(P);//p is actual parameter } (½ Mark for each correct explanation of Actual Parameter and Formal Parameter) (½ Mark for each correct example of Actual Parameter and Formal Parameter) OR (Full 2 Marks for correct examples demonstrating the difference between Actual Parameter and Formal Parameter) OR (Only 1 Mark to be awarded for Explanation given without supporting examples)

  15. 9 1. (a) What is the difference between automatic type conversion and type casting? Also, give a suitable C++ code to illustrate both. 2 2010 D Automatic Type Conversion: it is an implicit process of conversion of a data from one type to another. For example int N = 65; char C = N; // Automatic type conversion cout<<C; OUTPUT: A Type Casting: It is an explicit process of conversion of a data from one type to another. For example

  16. int A=1, B=2; float C = (float)A/B; //Type Casting cout<<C; OUTPUT: 0.5 (½ Mark for each correct explanation of Automatic Type Conversion and Type Casting) (½ Mark for each correct example of Automatic Type Conversion and Type Casting) OR (Full 2 Marks for correct example(s) demonstrating the meaning of / difference between Automatic Type Conversion and Type Casting) OR (Only 1 Mack to be awarded if Explanation without supporting examples) Note: Output is optional

  17. 10 1. (a) What is the difference between call by value and call by reference? Give an example in C++ to illustrate both. 2 2010 OD Call by valueis used to create a temporary copy of the data coming from the actual parameter into the formal parameter. The changes done in the function in formal parameter are not reflected back in the calling environment. It does not use ‘&’ sign. Call by referenceis used to share the same memory location for actual and formal parameters and so changes done in the function are reflected back in the calling environment. It uses ‘&’ sign.

  18. void Compute(int A, int &B) { A++; B++; cout<<”In the function”<<endl; cout<<”A=”<<A<<“&”<<“B=”<<B<<endl; } void main () { int I=50,J=25; cout<<”Before function call “<<endl; cout<<”I=”<<I<<”&”<<”J=”<<J <<endl; Compute (I,J) ; cout<<”After function call “<<endl; cout<<I=”<<I<<”&”<<”J=”<<J <<endl; }

  19. OUTPUT Before function call I=50&J=25 In the function A=51&B=26 After function call I=50&J=26 (½ Mark for each correct explanation of Call by Value and Call by Reference) (½ Mark for each correct example of Call by Value and Call by Reference) OR (Full 2 Marks for correct examples demonstrating the difference between Call by Value and Call by Reference) OR (Only 1 Mark to be awarded if Explanation without supporting examples) Note: Output is optional

  20. 11 1. (a) What is the difference between Local Variable and Global Variable? Also, give a suitable C++ code to illustrate both. 2 2011 D Local Variables: Local variables are those variables which are declared within a function or a compound statement and these variables can only be used within that function/scope. Global Variables: Global variables are those variables which are not declared within any function or scope. So, these variables can be accessed by any function of the program

  21. Example #include<iostream.h> #include<conio.h.> int G; // Global variable declared void Fun ( ) { int L = 25; // Local variable of function Fun ( ) assigned value 25 G=5; // Global Variable is accessed and assigned value 5 Cout<<G<<endl; // Value of global variable is displayed as 5 Cout<<L<<endl; // Value of local variable is displayed as 25 } void main ( ) { Fun ( ) ; // Function call G = G + 5; // Global variable is incremented by 5 cout<<G<<endl; // Global variable is displayed as 10 } (½ Mark for each correct explanation of Local Variable and Global Variable) (½ Mark for each correct example of Local variable and Global Variable) OR (Full 2 Maries for correct example(s) demonstrating the meaning of / difference between Local Variable and Global Variable) OR (Only 1 Mark to be awarded if Explanation without supporting examples)

  22. 12 1. (a) What is the difference between automatic type conversion and type casting? Also, give a suitable C++ code to illustrate both. 2 2011 OD Automatic Type Conversion: it is an implicit process of conversion of a data from one type to another. For example int N = 65; char C = N; // Automatic type conversion cout<<C; OUTPUT: A Type Casting: It is an explicit process of conversion of a data from one type to another. For example

  23. int A=1, B=2; float C = (float)A/B; //Type Casting cout<<C; OUTPUT: 0.5 (½ Mark for each correct explanation of Automatic Type Conversion and Type Casting) (½ Mark for each correct example of Automatic Type Conversion and Type Casting) OR (Full 2 Marks for correct example(s) demonstrating the meaning of / difference between Automatic Type Conversion and Type Casting) OR (Only 1 Mack to be awarded if Explanation without supporting examples) Note: Output is optional

  24. 13 1. (a) What is the difference between Global Variable and Local Variable? Sample Paper Set I 2009

  25. 14 1. (a) What is the difference between Object Oriented Programming and Procedural Programming? 2 Sample Paper Set II 2009

  26. 15 1. (a) What is the difference between Global Variable and Local Variable? (Sample Paper 2010 (Repeated it was asked in Sample Paper Set 1 2009) )

  27. 16 1 ( a ) What is the difference between Actual Parameter and Formal Parameters ? Also, give a suitable C++ code to illustrate both. 2 Sample Paper Set II - 2010 (asked in 2009 OD)

  28. 17 1 (a) Differentiate between the post-increment and pre-increment operators. Also, give suitable C++ code to illustrate both. Sample Paper Set I - 2012

  29. 18 1 ( a ) What is the difference between Actual Parameter and Formal Parameters ? Also, give a suitable C++ code to illustrate both. 2 Sample Paper Set II - 2010 (asked in 2009 OD and Sample Paper 2010 Set II)

  30. 19 1. (a) What is the difference between automatic type conversion and type casting? Also, give a suitable C++ code to illustrate both. 2 2012 OD ( Repeated, asked in the year 2010 Delhi Paper) Automatic Type Conversion: it is an implicit process of conversion of a data from one type to another. For example int N = 65; char C = N; // Automatic type conversion cout<<C; OUTPUT: A Type Casting: It is an explicit process of conversion of a data from one type to another. For example

  31. int A=1, B=2; float C = (float)A/B; //Type Casting cout<<C; OUTPUT: 0.5 (½ Mark for each correct explanation of Automatic Type Conversion and Type Casting) (½ Mark for each correct example of Automatic Type Conversion and Type Casting) OR (Full 2 Marks for correct example(s) demonstrating the meaning of / difference between Automatic Type Conversion and Type Casting) OR (Only 1 Mack to be awarded if Explanation without supporting examples) Note: Output is optional

  32. THANK YOU

More Related