Back to Tutorials
Sample PapersICSEClass 10Computer Applications

ICSE computer applications sample paper

Java ICSE computer applications

Trushna Tejwani6 January 2023
Sample Papers

Java ICSE computer applications

Section A (40 Marks)

Attempt all the questions from this section

Question 1 Choose the correct answer [20]

(a) Which of the followings are valid comments?

(i) /* comment */ (ii) /* comment (iii) // comment (iv) */ comment */

1. (i) & (iii) 2. (i) & (ii) 3. All of the above 4. None of the above

(b) n=1000; while (n>10) { n=n/10; } System.out.println(n);

How many time the loop is executed and what is the output?

1. Loop is executed 2 times and the output is 100

2. Loop is executed 3 times and the output is 10

3. Loop is executed 2 times and the output is 10.

4. Loop is executed 2 times and the output is 10.

(c) Give the output of the following

x + = x++ + ++ x + --x + x; [ when x is 5 initially ]

1. 29 2. 28 3. 26 4. 25

(d) What is the final value stored in variable x ?

double a =-8.35; double x = Math.abs(Math.floor(a));

1. 9.0 2. 7.0 3. 6 4. 7

(e) Name the type of error in the statement given herein: int r =100/0;

1. Syntax 2. Runtime 3. Logical 4. None of the above

(f) The _____________ allows a class to use the properties and methods of another class.

1. Inheritance 2. Polymorphism 3. Encapsulation 4. None of the above

(g) The number of bytes occupied by char data type is __________byte/s

  1. 4        2.      8        3.     2            4. None

(g) The _________ is called an instance of a class

1. State 2. Attributes 3. Object 4. None

(i) The ____________ are the words which have special meaning

1. Keywords 2. Identifier 3. Methods 4. Package

(j) Method that accepts a string without any space is _______

1. next() 2. nextLine() 3. nextInt() 4. None of the above

(k) The wrapper class to which, the method parseInt() belongs to :

1. integer 2. Int 3. Integer 4. int

(l) Intermediate code is obtained after compilation of

1. Source code 2. Byte Code 3. Object code 4. all the above

(m) The method with the same name as of the class and which does not have a return data type is called as

1. Constructor 2. Function 3. Method 4. none

(n) The statement to stop the execution of a construct.

1. System.exit(0) 2. break 3. STOP 4. none

(o) Invoking a function by passing the objects of a class is termed as

1. Call by value 2. call by reference 3. call by method

Choose the odd one

(p) 1. Encapsulation 2. Data abstraction 3. Portable 4. Polymorphism

(q) 1. > 2. == 3. && 4. <

(r) 1. return 2. break 3. continue 4. System.exit(0)

(s) 1. int 2. double 3. char 4. String

(t) 1. + 2. % 3. / 4. ||

Question 2 [20]

(a) Identify and name the following tokens:

(i) public (ii) ‘a’ (iii) == (iv) {}

(b) Give the output of the following code:

String m = "20", n = "19";

int a = Integer.parseInt(m); int b = Integer.valueOf(n);

System.out.println(a + "" + b); System.out.println(a+b);

(c) State the data type and value of res after the following is executed:

char ch = '9'; res = Character.isDigit(ch);

(d) Write a Java expression for the following: 3x+x2a+b

(e) Give the output of the following:

(i) Math.floor (-4.7) (ii) Math.ceil(3.4) + Math.pow(2, 3)

(f) Name the keyword which:

(i) indicates that a method has no return type.

(ii) makes the variable as a class variable.

(g) What types of parameters appear in function definition?

(h) Write two characteristics of a constructor.

(i) Give the output of the following program segment and also mention how many times the loop is executed:

int i; for ( i = 5 ; i > 10; i ++ )

System.out.println( i ); System.out.println( i * 4 );

(j) Name any two basic principles of Object-oriented programming.

Section B (60 Marks)

(Attempt any four questions from this Section.)

The answers in this Section should consist of the Programs in either Blue J environment or any program environment with Java as the base. Each program should be written using Variable descriptions/Mnemonic Codes so that the logic of the program is clearly depicted. Flow-Charts and Algorithms are not required. Each main question carries 15 marks.)

Question 3

Define a class called Mobike with the following description:

Instance variables/data members:

String bno -to store the bike’s number

String name -to store the name of the customer

int phno -to store the phone number of the customer

int days -to store the number of days the bike is taken on rent

int charge - to calculate and store the rental charge

Member methods:

public Mobike () - The parameterized constructor to input and store customer’s name and details

void compute() -to compute the rental charge.

The rent for a mobike is charged on the following basis.

First five days Rs. 500 per day.

Next five days Rs. 400 per day.

Rest of the days Rs. 200 per day.

void display() to display the details in the following format:

Bike No. Phone No. No. of days Charge

--------- ------------ ------------- --------

Question 4

Design a class to overload a function volume() as follows:

(i) double volume (double R) – with radius (R) as an argument, returns the volume of sphere using the formula.

V = 4/3 x 22/7 x R3

(ii) double volume (double H, double R) – with height(H) and radius(R) as the arguments, returns the volume of a cylinder using the formula.

V = 22/7 x R2 x H

(iii) double volume (double L, double B, double H) – with length(L), breadth(B) and Height(H) as the arguments, returns the volume of a cuboid using the formula.

V = L x B x H

Question 5

Write a menu driven program to display the pattern as per user’s choice.

Pattern 1 Pattern 2

ABCDE                                                 B

ABCD                                                  LL

ABC                                                   UUU

AB                                                     EEEE

A

For an incorrect option, an appropriate error message should be displayed.

Question 6

A computer student randomly enters a number in his computer. Write a program to check whether the number entered by the student is a single digit number, a two digits number or a three digits number. And then perform these tasks:

If it is a single digit number then display its square.

If it is a two digits number then display its square root.

If it is a three digits number then display its cube root.

Otherwise, display a message “The number entered is more than three digits”. (Note- Math.sqrt & Math.cbrt functions can be used to find square & cubic roots respectively).

Question 7

Write a program to accept a character using scanner and thereafter using the Library methods of Character class display the report on the input character whether the character is: Digit, Letter, Letter or Digit, is Lower case, is upper case and change the case of the character (Upper to lower, lower to upper) in case of letter.

Question8

Write a program that creates a class Account that stores a variable balance. The class has methods to start account; to deposit money; to withdraw money and to tell the current balance amount. Money is withdrawn only through cash. The program should include another class to test the class Account.