ICSE 2008 Computer Application

ICSE 2008 COMPUTER APPLICATION

Answer to this ICSE 2008 Computer Application ICSE Board Paper must be written on the paper provided separately. You will not be allowed to write during the first 15 minutes. This time is to be spent in reading the question paper. The time given at the head is the time allowed for writing the answer.
——– ——– ——– ——– ——- ——- ——– ——- ——-
This paper is divided into two Sections. Answer all Questions from Section A and any four questions from Section B. The intended marks for questions or parts of questions are given in [].
——– ——– ——– ——– ——- ——- ——– ——- ——-

SECTION A(40 Marks)
Attempt all questions.

Question 1.                                  [10]
(a) Mention any two attributes required for class declaration.
Ans: The two attributes for class declaration are: 1. Access Specifier 2. Modifier 3. Class Name
(b) State the difference between Token and Identifier.
Ans: The smallest individual unit of a program is known as Token. The following Tokens are available in Java: Keywords, Identifiers, Literals, Punctuations, Operators.Identifiers are names given to different parts of a program e.g. variables, functions, classes etc. The identifiers in Java.
(c) Explain instance variable. Give an Example.
Ans: A data member that is created for every objects of the class.public class abc {  int a,b;  // instance variable or data member}
(d) What is inheritance and how it is useful in Java.
Ans: It is process by which objects of one class acquire the properties of objects of another class. Inheritance supports the concepts of hierarchical representation. In Java the concepts of inheritance provides the idea of reusability.
(e) Explain any two types of access specifier.
Ans: Access specifier can be of following types:(a) PUBLIC: Public members of a class are globally accessible.(b) PRIVATE: Private members of a class be accessed by the member functions of the class only.(c) PROTECTED: Protected members of a class are accessible in the package where the class is defined and in all the sub-classes of the class.(d) Default (friendly) access: members with default (friendly) access can be used within the package where the class is defined.

Question 2.                             [10]
(a) What do you meant by an infinite loop? Give an example.
ANS : Infinite loop is an endless loop whose number of iterations are not fixed. eg: for(;;)     System.out.println(“java”);
(b) State the difference between == operator and equals() method.
ANS: ==: 1. It is a relational operator. 2. it tests the value on the right side with value on the left side.   equals(): 1. It is a string function. 2. It compares two strings and gives the value as true or false.
(c) Differentiate between actual parameter and formal parameter.
ANS: Actual parameter: The parameters that appear in the function call statement are called actual parameters. Formal parameters: The parameters that appear in the function definations are called formal parameters.
(d) What is the use of exception handling in Java?
ANS 1.Exception handling separates error handling code from the normal code. 2. It clarifies code and enhances readability.
(e) Differentiate between base and derived class.
Ans. BASE CLASS – A class from which another class inherits (Also called SUPER CLASS) DERIVED CLASS – A class inheriting properties from another class. (Also called SUB CLASS)

Question 3.
(a) Explain the function of each of the following with an example:
i)   break;     ii) continue;             [4]
Ans: Both statements are used as a jumped statement. But there is a difference between Break and Continue statement. The break statement terminate the loop, but the continue statement skip the rest of the loop statement and continued the next iteration of the loop. e.g. of Break Statement           int i=0;           while(i<=10)          {               i++;               if(i==5)                   break;               System.out.println(i);          } e.g. of Continue Statement           int i=0;           while(i<=10)          {              i++;              if(i==5)                  continue;              System.out.println(i);         }
(b) Convert the following segment into equivalent for loop        [2]
{
int i,l=0;
while(i<=20)
System.out.print(i+” “);
l++;
}
Ans:{  int i=0,l=0;  for(;i<=20;)    System.out.print(i+” “);  l++;}
(c) If a=5, b=9 calculate the value of a += a++ – ++b + a         [2]
Ans: 6Explanation: As you know this expression is equivalent to a = a + a++ – ++b + a = 5 + 5 – 10 + 6 = 6
(d) Give the output of the following expressions.[2]
(i) If x = – 9.99.  calculate Math.abs(x);
(ii) If x = 9.0     calculate Math.sqrt(x);
Ans: (i) 9.99   (ii) 3.0
(e) If, String x = “Computer”;               [4]
String y = “Applications”;
What do the following functions return for;
(i)   System.out.println(x.substring(1,5));
(ii)  System.out.println(x.indexOf(x.charAt(4)));
(iii) System.out.println(y+x.substring(5));
(iv)  System.out.println(x.equals(y));
Ans: (i) ompu  (ii) 4  (iii) Applicationster  (iv) false
(f) If array[]={1,9,8,5,2};
(i)   What is array.length()?
(ii)  What is array[2];                 [2]
Ans. i)5   ii)8
(g) What does the following mean?
Employee staff = new Employee();         [2]
Ans. An object of the class Employee is created.
(h) Write a Java statement to input/read the following from the user using the keyboard.
(i)  Character
(ii) String                          [2]
Ans. i) char c=Character.parseCharacter(x.readLine());   ii) String n=x.readLine();

Leave a Comment