You are on page 1of 6

FIRST UNIT TEST PAPER 2009 - 10 NO.

04 CLASS - XII COMPUTER SCIENCE Time: 11/2 hours Note: (i) All the questions are compulsory (ii) Answers should be in proper manner. Q1. (a) What is meant by Unsized array initialization? Write down its benefits? [2] (b) Write the header files to which the following functions belong:[2] (i) getc ( ) (ii) isalnum ( ) (iii) scanf ( ) (iv) getxy ( ) (c) Write a function named sumseries ( ) which accepts the value of X and the value of N in the following series:- [4] Q2. (a) find the ouput of the following code: - [3] # include < iostream. h> Void change (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}; int c [ ] = {900, 1200}; change (A, 3); change (B, 4): change (C, 2); for (int I = 0; i < 3 ; i ++) count << A [i] << #; count << endl; for (i = 0; i < 4; i ++)
Material downloaded from http://myCBSEguide.com and http://onlineteachers.co.in Portal for CBSE Notes, Test Papers, Sample Papers, Tips and Tricks

Maximum Marks: 40

count << B [i] << #; count << endl; for (i = 0; i < 2; i ++) count << C [i] << X; } (b) Consider the following code fragment and find the output:- [2] Class X { int x; float y; public; void init (void) { x = 0; y = 0; } void getral (int i, float j) { x = i; y = j; } void prn ( ) { cout << x = << x << In; cout << y = << y << n; } }; Void main ( ) { X 01, 02;
Material downloaded from http://myCBSEguide.com and http://onlineteachers.co.in Portal for CBSE Notes, Test Papers, Sample Papers, Tips and Tricks

01. init ( ); 02, init ( ) ; 01, getral (25, 171, 71); 1. prn ( ) ; 2 prn ( ) ; } [Note: - Header files are already included] (c) Find errors in the following program and state reasons: - [2] # include < iostram. h> Class A { Private:

Static int a1; } int a2; protected; int a3; public: float x; void getral. (int a, int b, int c) { a1 = a; 2 = b; } }; void main ( ) { A obj; Obj. a2 = 5; x = 10; A. getral (5, 10, 20); }
Material downloaded from http://myCBSEguide.com and http://onlineteachers.co.in Portal for CBSE Notes, Test Papers, Sample Papers, Tips and Tricks

a3 = c;

(d) # include < iostream. h> Strutct pixels {int color, style = 5; } Void show (Pixels P) { { Cout << p. color, p. style; } void main ( ) { Pixels Point 1 = (5, 3); Show (Point) Pixels Point 2 = Point 1 Show. (Point 2); } Q3. (a) Declare a class named Flats with following specifications: - [4] Private Members: Name of Society HNO No. of Mem Flat type Income 25 characters Integer Integer 8 characters float

cal ( ) a function which accepts the value of income and to allocate flate according to income Income > = 10000 flat type = HIG Income > = 5000 flat type < 10000 Type of flat = MIG Income < 5000 type of flat = LIG Public members:Readdate ( ) A function to input the required values and invoke. Cal function.
Material downloaded from http://myCBSEguide.com and http://onlineteachers.co.in Portal for CBSE Notes, Test Papers, Sample Papers, Tips and Tricks

Display ( ) A function to display the data. (b) Consider the following class declaration and answer the questions below: - [4] Class subject { Private: ] Int some, more: void fun ( ) {cout << subject:} public; void Adata (int d) { some = d:

More = d++; } Void Bdata ( ) {cout << some << @ << more; } };

(i) Write the name that specifies the above class. (ii) Write the data of the class with their access scope. (iii) Write all member functions of the class along with their access scope. (iv) Indicate the member function of the subject that sets data. [4] Q4. (a) Write definitions for two versions of an overloaded function. This functions 1st version sum ( ) takes an argument, int array, and returns the sum of all the elements of the passed array. The 2nd version of sum ( ) takes two arguments an int array and a character. If the passed character is E, it returns the sum of even elements of the passed array and if the passed character is 0 if returns the sum of odd elements. In case of any other character it returns 0 (zero). [4] (b) From a 2 D array A [4] [4], write a program to prepare a 1 D array B [16] that will have all the elements of A if they are stored in row major form. [4] For example:-

Material downloaded from http://myCBSEguide.com and http://onlineteachers.co.in Portal for CBSE Notes, Test Papers, Sample Papers, Tips and Tricks

2 3 4 1 5 6 7 8 9 10 11 12 13 14 15 16 B [16] = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (c) What is the relation between abstract classes and concrete classes? [2] (d) What do you mean by the transitive nature of inheritance? Explain with example. (c) What is the role of a functions signature in disambiguation process? [2]

Material downloaded from http://myCBSEguide.com and http://onlineteachers.co.in Portal for CBSE Notes, Test Papers, Sample Papers, Tips and Tricks

You might also like