Computer Science-1998

Q. 1 (a) Define the following terms : (i) Inheritance (ii) Encapsulation
Ans.1 (a) Inheritance : Inheritance is the process by which one object can acquire the properties of another object. It is the inheritance mechanism that makes it possible for one object to be a specific instance of a more general case.

Encapsulation : Encapsulation is the mechanism that binds together code and data and keeps both safe from outside interference or misuse.

Q. 1 (b) Name the header files, to which the following built-in-functions belong to :
(i) COs() (ii) setw() (iii) toupper() (iv) strcpy()

Ans.1 (b) (i) math.h (ii) iomanip.h (iii) ctype.h (iv) string.h

Q. 1 (c) Find the syntax error(s), if any, in the following program :
void main( )
int R;W=90;
while W>60
20: cout< <"Lower Range"< 30: cout<<"Middle Range"< 40: cout<<"Higher Range"< }

Ans.1 (c)

Line 1: It should be #include
Line 4: Variables should be seperated using commas. It should be int R,W=90
Line 5: Test expression should be in braces. It should be while(W>60)
Line 10: It should be case 20:
Line 11: It should be case 30:
Line 12: It should be case 40:

  1. No comments yet.
  1. No trackbacks yet.