ICSE Computer Science Java Programs | IT Developer
IT Developer

Java Programs - Solved 2013 ICSE Computer Science Paper



Share with a Friend

Solved 2013 ICSE Computer Science Paper

Class 10 - ICSE Computer Science Solved Papers

Short Questions/Answers - ICSE 2013 Computer Science

Question 1
(a) What is meant by precedence of operators?
Operator precedence determines the order in which expressions are evaluated, to determine the overall value of the expression.

(b) What is a literal?
Literals are data items that are fixed data values.

(c) State the Java concept that is implemented through:
(i) a super class and a subclass.
Inheritance.
(ii) the act of representing essential features without including background details.
Abstraction.

(d) Give a difference between a constructor and a method.
A constructor has no return type, whereas a method always has a return type.

(e) What are the types of casting shown by the following examples?
(i) double x = 15.2;
int y = (int)x;

Explicit typecasting.
(ii) int x = 12;
long y = x;

Implicit typecasting.

Question 2
(a) Name any two wrapper classes.
Integer, Character

(b) What is the difference between a break statement and a continue statement when they occur in a loop?
The break statement is used to exit from a loop. And the continue statement is used to skip a particular iteration in the loop.

(c) Write statements to show how finding the length of a character array char ch[] differs from finding the length of a String object str.
int len = ch.length;
len = str.length();


(d) Name the Java keyword that:
(i) indicates that a method has no return type.
void.
(ii) stores the address of the currently calling object.
this.

(e) What is an exception?
An exception is an abnormal condition that arises in a code sequence at run time.

Question 3
(a) Write a Java statement to create an object mp4 of class Digital.
Digital mp4 = new Digital();

(b) State the values stored in the variables str1 and str2:
String s1 = "good";
String s2 = "world matters";
String str1 = s2.substring(5).replace(\'t\', \'n\');
String str2 = s1.concat(str1);

manners
good manners

(c) What does a class encapsulate?
A class encapsulates data and behavior.


(d) Rewrite the following program segment using the if..else statement:
comm = (sale > 15000)? sale * 5 / 100 : 0;
if(sale > 15000)
    comm = sale * 5 / 100;
else
    comm = 0;


(e) How many times will the following loop execute? What value will be returned?
int x = 2, y = 50;
do{
    ++x;
    y -= x++;
}while(x <= 10);
return y;

The loop will run 5 times.
The returned value will be 15.

(f) What is the data type that the following library functions return?

(i) isWhitespace(char ch)
boolean
(ii) Math.random()
double
(g) Write a Java expression for ut + 1/2 ft2
u * t + 1.0 / 2 * f * t * t

(h) If int n[] = {1, 2, 3, 5, 7, 9, 13, 16};
What are the values of x and y?
x = Math.pow(n[4], n[2]);
y = Math.sqrt(n[5] + n[7]);

x = 343.0
y = 5.0

(i) What is the final value of ctr when the iteration process given below, executes?
int ctr = 0;
for(int i = 1; i <= 5; i++)
    for(int j = 1; j <= 5; j += 2)
        ++ctr;

ctr = 15.

(j) Name the methods of Scanner class that:
(i) is used to input an integer data from the standard input stream.
nextInt()
(ii) is used to input a String data from the standard input stream.
nextLine()