You are on page 1of 3

(a) Explain the relation between encapsulation and abstraction. Also give suitable examples of each in C++.

[2] (b) Name the header file(s) that shall be needed for successful compilation of the following C++ code [2] void main ( ) { clrscr(); int x=20; cout<<x; getch(); } (c) Rewrite the following program segment after removing the syntactical error(s) if any. Underline each correction. [2] int a,int b; cin<<a; cin>>b; a=a+5; b=b+1; cout<<values of a and b<<a,b; (d) Find the output of the following program : [2] # include < iostream.h> void main () { int a,b,c,d,e,f,g,h; cin>>a>>b>>c>>d; e=5*(c+d); f=d+2; g=c+d-1; h=20*(a-3); cout<<e<<f<<g<<h;

} Class XI (Computer Science) (Sample Paper) Page 2 of 3 Final Semester Examination 201314 (e) Explain briefly: [4] (i) Token (ii) Keyword (iii) Variable (iv) Constant 2. (a) Define literal in C++. What is the difference between a and ain C++? [3] (b) Identify the following as valid or invalid identifiers: [4] (i) _Marks (ii) 1_name (iii) break (iv) M1N2B3_ (c) Explain the three fundamental datatypes with their size and range. [6] (d) Define the following: [4] (i) Array (ii) Function (iii) Pointer (iv) Class (e) Why is char treated as int? [1] 3. (a) Write a program to input three numbers and print them in three different lines. [2] (b) Differentiate between unary and binary operators. [2] (c) Explain conditional operator with example. [2] (d) Write a program to convert given number of days into corresponding number of years, months and days. [4] (e) Write a program to input marks in five subjects and calculate and print the total and percentage. [4]

4. (a) Define array. What is the need for arrays? [2] (b) Find errors(if any) and rewrite with corrections: [4] # include<iostream.h> void main( )

{ const size = 50; float marks[size]; for(i=0;i<size;i++) { cin>>marks; } for(i=0;i<size;i++) { cout>>marks[i]; } } (c) Give the memory representation of the following array: [2] char name[10]; (d) What is a subscript? Write a for loop to read an integer array of 10 elements. [3] Class XI (Computer Science) (Sample Paper) Page 3 of 3 Final Semester Examination 2013-14 (e) Write a program to input a line of text and count the number of words in it. [3]

5. (a) Define a function and give syntax of function definition. [2] (b) What is the need for a function prototype? Give its syntax. [4] (c) What does void signify in the following function declaration: [2] void func(void); (d) Define structure. Write a program to input name. class and marks of 5 students stored in a structure.

You might also like