|
|||||||||
computer
1
Sample Paper ? 2008
Class ? XII Subject ? Computer Science Time allowed : 3 hrs. Maximum Marks : 70 Note: (i)All questions are compulsory. (ii) Programming Language: C++ (iii) Total Pages: 10 1. (a) Name the header file to which the following belong : 1 (i) gotoxy() (ii) flushall() (b) Illustrate the use of inline function in C++ with the help of an example. 2 (c) Rewrite the following program after removing the syntactical error(s) if any, underline each correction. 2 #include <stdio.h> void main() { int s1,s2,num; s1 = s2 = 0; for(x=0;x<11;x++) { cin<<num; if(num > 0) s1 += num; else s2 = / num; } cout<<s1<<S2; } (d) Find the output of the following program: 2 #include<iostream.h> #include<conio.h> void ChangeContent(int Arr[], int Count) { for(int C=1 ; C<Count ; C++) { Arr[C ? 1]+=Arr[C] ; Arr[Count ? C] = Arr[C ? 1]; } }//End of ChangeContent void main() { clrscr(); int A[]={3, 4 , 5}, B[]={10,20,30,40}, C[]={900, 1200}, L ; ChangeContent(A,3); ChangeContent(B,4); ChangeContent(C,2); for(L=0 ; L<3 ; L++) cout<<A[L]<<"#"; cout<<endl; for(L=0 ; L<4 ; L++) cout<<B[L]<<"#" ; cout<<endl; for(L=0 ; L<2 ; L++) cout<<C[L]<<"#" ; getch(); } (e) Find the output of the following program. 3 #include <iostream.h> int modify(int temp = 2) { if(temp % 3 == 0) temp = temp + 1; else temp = temp + 3; return temp; } void doupdation(int m, int &n) { static int i; i++; m = n + i; if(n > 10) n = modify(); else n = modify(n); cout<<m<<" ; "<<n<<endl; } void main() { int x = 8, y = 20; doupdation(x,y); cout<<x<<" ; "<<y<<endl; doupdation(y,x); cout<<x<<" ; "<<y<<endl; getch(); } (f) What do you mean by self referential structures? Give an example. 2 2. (a) What is the benefit of declaring a data member as protected? 2 (b) Consider the following code: 2 class ci { int L; public: ci (int j) { L = j; } //function 1 ci (ci & rv ) { L = rv.L; } //function 2 void initialize() { L = 0; } }; Referring to the sample code above answer the questions (i) and (ii) (i) How would function1 and function2 get executed? Give example. (ii) main() { ci original (1); ci X1(original); ci X2 = original; } Referring to above sample code, what initializes the object X1? (i) initialize() function (ii) The default constructor (iii) The copy constructor (iv) The default copy constructor Justify your answer. (c) Define a class Travel in C++ with the following descriptions: 4 Private Members TravelCode of type long Place of type character array(string) Season of type character array(string) Total_fare of type float Discount of type float Public Members: A constructor to assign initial val... Show full text: 10,596 characters
|
|
||||||||
|
© WP Technology Inc. 2009. User-posted content are subject to its own terms. |
|||||||||