Formatting page ...
Question 1. (a) Define Encapsulation. [2] answer : Binding up of data and associated functions together into a single unit called (class) is called Encapsulation. (b) What are keywords? Give an example. [2] answer : These are the special reserved words which have some specific meaning to the Java interpreter. Examples: break, import, int etc. (c) Name any two library packages. [2] answer : java.io, java.util (d) Name the type of error (syntax, runtime or logical error) in each case given below: [2] (i) Math.sqrt (36-45) (ii) int a;b;c; answer : (i) runtime error (ii) syntax error (e) If int x [ ] = { 4, 3, 7, 8, 9, 10 }; what are the values of p and q? [2] (i) p = x.length (ii) q = x[2] + x[5] * x[1] answer : (i) 6 (ii) 37 Question 2. (a) State the difference between = = operator and equals( ) method. [2] answer : = = operator equals( ) 1. It is a relational operator 1. It is a String function 2. It is used to check for equality of any primitive data types. 2. It is used to check for equality of two String objects.
|