ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2019 ICSE Computer Science Paper



Share with a Friend

Solved 2019 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Short Questions/Answers - ICSE 2019 Computer Science

Question 1
(a) Name any two basic principles of object-oriented programming.
Inheritance, Polymorphism

(b) Write a difference between unary and binary operator.
Unary operators act on one operand, whereas binary operators act on two operands.

(c) Name the keyword which:
(i) indicates that a method has no return type.
void keyword
(ii) makes the variable as a class variable.
static keyword

(d) Write the memory capacity (storage size) of short and float data type in bytes.
short = 2 bytes
float = 4 bytes

(e) Identify and name the following tokens:
(i) public

Keyword

(ii) ‘a’
Literal

(iii) ==
Operator

(iv) { }
Separator

Question 2

(a) Differentiate between if else if and switch-case statements.
if else is is capable of performing all kinds of comparisons, but switch case can only perform comparisons for equality.

(b) Give the output of the following code:
String p = “20”, q = “19”;
int a = Integer.parseInt(p);
int b = Integer.parseInt(q);
System.out.println(a + “” + b);

OUTPUT:
2019

(c) What are the various types of errors in Java?
Syntax error (Compile-time error)
Runtime error (Exception)
Logical error

(d) State the data type and value of res after the following is executed:
char ch = ‘9’;
res = Character.isDigit(ch);
res = true
Data type = boolean

(e) What is the difference between the linear search and the binary search technique?
Linear search can be applied on both sorted as well as unsorted lists, whereas binary search can only be applied on sorted lists.

Question 3

(a) Write a Java expression for the following:
|x2 + 2xy|

Math.abs(x * x + 2 * x * y)

(b) Write the return data type of the following functions:

(i) startsWith()
boolean data type

(ii) random()
double data type

(c) If the value of basic = 1500, what will be the value of tax after the following statement is executed?

tax = basic > 1200? 200 : 100;
tax = 200

(d) Give the output of the following code and mention how many times the loop will execute:

int i;
for(i = 5; i >= 1; i–){
if(i % 2 == 1)
continue;
System.out.print(i + ” “);
}
Output:
4 2
The loop will execute 5 times.

(e) State a difference between call by value and call by reference.
In call by value, the changes made to the formal parameters do not reflect on the actual arguments. But in call by reference, changes made in formal parameters are reflected on the actual arguments.

(f) Give the output of the following:
Math.sqrt(Math.max(9, 16))

4.0

(g) Write the output for the following:
String s1 = “phoenix”;
String s2 = “island”;
System.out.println(s1.substring(0).concat(s2.substring(2)));
System.out.println(s2.toUpperCase());

phoenixland
ISLAND

(h) Evaluate the following expression if the value of x = 2, y = 3 and z = 1.
v = x + –z + y++ + y;

v = 2 + 0 + 3 + 4
v = 9

(i) String x[] = {“Artificial intelligence”, “IOT”, “Machine learning”, “Big data”};
Give the output of the following statements:
(i) System.out.println(x[3]);

Big data

(ii) System.out.println(x.length);

4

(j) What is meant by a package? Give one example.
A package is a collection of related classes and interfaces. Example: java.util package.