ICSE 2007 Computer Application


Answer to this ICSE 2007 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) Name two types of Java programs.
Ans: The two types of Java Applications are ‘Internet Applets’ and ‘Stand alone application’.
(b) Define Instance Variable. Give an example of the same.
Ans: A data member that is created for every objects of the class.
(c) Differentiate between Binary Search and Linear Search.
Ans: In linear search each elements of the array is compared with the given item to be searched for one by one while binary search searches for the given item in a sorted array. The search segment reduces to half at every successive stage.
(d) Assign the value of pie (i.e. 3.142) to a variable with requisite data type.
Ans: double PI=3.142;
(e) Explain with an example the if-else-if construct.
Ans: A nested ‘if’ is an statement that has another ‘if’ in its body or in it’s appearance. It takes the following general form.if(ch>=’A’){  if(ch<=’Z’)    ++upcase;  else    ++other;}

Question 2.                               [10]
(a) Differentiate between Formal Parameter and Actual Parameter.
Ans: The parameter that appears in function call statement are called actual argument and The parameter that appears in function definition are called formal parameter.
(b) Why do we need a constructor as a class member?
Ans: Constructor is used create an instance of of a class, This can be also called creating an object.
(c) Explain the term type casting.
Ans: The explicit conversion of an operand to a specific type is called type casting. The operator that converts its operand to a specified type is called the typecast operator. The typecast operator is ( )
(d) Name the following:
(i) A package that is invoked by default.
(ii) A key word, to use the classes defined in a package.
Ans: (i) java.lang(ii) import
(e) Name the class that is used for different mathematical functions. Give an example of a mathematical function.
Ans: The class used for different mathematical functions in Java is java.lang.Math

Question 3.
(a) State the difference between = and ==     [2]
Ans: = is an assignment operator, where as == is a relational operator. = assigned the value to a variable, where as == is comparing the variables or va;ues.
(b) Write an equivalent Java syntax for the following expression: [2]
0.05 – 2y3
a= ————
Ans: double a = (0.05 – 2*Math.pow(y,3))/X-Y ;
(c) Rewrite the following using Ternary operator
if (income<=10000)
tax = 0;
tax = 12;                            [2]
Ans: int tax = (income <= 10000) ? 0 : 12 ;
(d) Write a statement for each of the following:        [3]
(i) Store a number 275 as a String.
(ii) Convert the string to a numeric value.
(iii) Add it to the existing total of 1000 to update the total.
Ans: (i) String n = “275”;(ii) int x = Integer.parseInt(n);(iii) total += x;
(e) (i) What is the role of the keyword void in declaring functions?
(ii) If a function contains several return statements, how many of them will be executed?
(iii) Which OOP principle implements function overloading?    [3]
Ans: (i) void data type specifies an empty set of values and it is used as the return type for functions that do not return a value. Thus a function that does not return is declared as void.(ii) If all the statements are non-conditional. The first return statement execute, because the function end and return from that point.(iii) Polymorphism.
(f) What is the output of the following:
(i) System.out.println (“four:” + 4 + 2);
System.out.println (” four: “+(2+2)); [2]
(ii) String S1 = “Hi” ;
String S2 = “Hi” ;
String S3 = “there”;
String S4 = “HI”;
System.out.println(S1 + ” equals ” + S2 + ” -> ” + S1.equals(S2));
System.out.println(S1 + ” equals ” + S3 + ” -> ” + S1.equals(S3)),
System.out.printin(S1 + ” equals ” + S4 + ” -> ” + S1.equals(S4));
System.out.println(S1 + ” EquallgnoreCase ” + S4 + ” -> ” + S1.equalsIgnoreCase(S4)); [4]
Ans: (i) four:42    four: 4(ii) Hi equals Hi -> true     Hi equals there -> false     Hi equals HI -> false     Hi EqualsIgnoreCase HI -> true
(g) Evaluate the following expressions, if the values of the variables are a=2, b=3 and c=9.
(i) a – (b++) * (–c)
(ii) a * (++b) % c                       [2]
Ans: (i)  -22    (ii) 8

Leave a Comment