ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2015 ICSE Computer Science Paper



Share with a Friend

Solved 2015 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Short Questions/Answers - ICSE 2015 Computer Science

Question 1

(a) What are the default values of the primitive data type int and float?
Default value of int is 0.
Default value of float is 0.0F.

(b) Name any two OOP principles.
Encapsulation and Abstraction.

(c) What are identifiers?
Identifiers are the fundamental building blocks of a program and are used as the general terminology for the names given to different parts of the program such as variables, objects, classes, functions, arrays, etc.

(d) Identify the literals listed below:
(i) 0.5 – Real Literal
(ii) ‘A’ – Character Literal
(iii) false – Boolean Literal
(iv) “a” – String Literal

(e) Name the wrapper classes of char type and boolean type.
Character is for char.
Boolean is for boolean.

Question 2

(a) Evaluate the value of n if value of p = 5, q = 19.
int n = (q - p) > (p - q)? (q - p) : (p - q);
n = 19 – 5 = 14.

(b) Arrange the following primitive data types in ascending order of their size:
(i) char (ii) byte (iii) double (iv) int
Ascending order: byte, char, int, double

(c) What is the value stored in variable res given below:
double res = Math.pow("345".indexOf(\'5\'), 3);
res = 8.0

(d) Name the two types of constructors.
Parameterized constructors and non-parameterized constructors.

(e) What are the values of a and b after the following function is executed, if the values passed are 30 and 50:

void paws(int a, int b){
    a = a + b;
    b = a - b;
    a = a - b;
    System.out.println(a + ", " + b);
}

OUTPUT:
50, 30

Question 3

(a) State the data type and value of y after the following is executed:
char x = \'7\';
y = Character.isLetter(x);

Value of y is false.
Data type of y is boolean.

(b) What is the function of catch block in exception handling? Where does it appear in a program?
The catch block traps the exception and handles it. It appears once the try block is closed in the program.

(c) State the output when the following program segment is executed:
String a = "Smartphone", b = "Graphic Art";
String h = a.substring(2, 5);
String k = b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h));

OUTPUT:
art
true

(d) The access specifier that gives the most accessibility is ________ and the least accessibility is ________.
public, private

(e) (i) Name the mathematical function which is used to find sine of an angle given in radians.
Math.sin()
(ii) Name a string function which removes the blank spaces provided in the prefix and suffix of a string.
trim()

(f) (i) What will this code print?
int arr[] = new int[5];
System.out.println(arr);

(i) 0 (ii) value stored in arr[0] (iii) 0000 (iv) garbage value
(ii) Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields.
this keyword.

(g) State the package that contains the class:
(i) BufferedReader – java.io package
(ii) Scanner – java.util package

(h) Write the output of the following program code:

char ch;
int x = 97;
do{
    ch = (char)x;
    System.out.print(ch + " ");
    if(x % 10 == 0)
        break;
    ++x;
}while(x <= 100);

OUTPUT:
a b c d

(i) Write the Java expression for:
(a2 + b2) ÷ 2ab
(a * a + b * b) / (2 * a * b)

(j) If int y = 10 then find int z = (++y * (y++ + 5));
z = (11 * (11 + 5))
= 11 * 16
= 176.