Watch Java videos

In this ICSE sample paper all the topics of java for ICSE computer application has been covered.

ICSE sample paper

                                          Icse sample paper                                 
This paper is divided into two sections. You are to answer all the questions from section A, and any four from section B.
Section A (40 marks)
Q 1.
a. Name any four tokens of Java.
b. Give the difference between actual parameter and formal parameter.
c. What is a constructor?
d. State the difference between a Constructor & a Method.
e. State the difference between an ‘Instance Variable’ & ‘Class Variable’

Q 2.
a. Write an expression in java for the following expression.
double val=log((A2+B)/C4)
b. What is a Wrapper class? Give 2 examples.
c. Write the output of the following code.
int x = 10, y = 21;
System.out.println (x|y);
System.out.println(x>>(y – x – x));
d. State the output of the following program segment.
String s=”Today is Test”;
System.out.println(s.substring(0,7)+” “+”Holiday”);
e. Write a statement each to perform the following task on a string:
i) Find and display the position of the last space in a string s.
ii) Convert a number stored in a string variable x to double data type.

Q 3.
a. State the output of the following program segment.
String s= “Examination”;
int n= s.length();
System.out.println(s.startsWith(s.substring(5,n))); System.out.println(s.charAt(2)== s.charAt(6));
b. What will the following code output?
String s= “malayalam”; System.out.println(s.indexOf(‘m’)); System.out.println(s.lastIndexOf(‘m’));
c. Evaluate the value of n if value of p=5, q=19
int n= (q-p)>(p-q) ? (q-p) : ( p-q);
d. What do you mean by type conversion? How is implicit conversion different from explicit conversion?
e. State the purpose and return data type of the following String functions :-
a. equalsIgnoreCase()
b. valueOf( )

Q 4.
a. Write the output of the following code.
char ch=’F’·,
int m=ch;

b. Write the output of the following. [4]
String s1 = “MINORITY”;
String s2 = “REPORT”;
i. System.out.println(s1.substring(0,3).concat(s2.substring(3,5))
ii. System.out.println(s2.substring(2));
iii. System.out.println(s2.replace(‘p’ , ‘s’));
iv. System.out.println(s1.charAt(s1.indexOf(‘R’) + s2.indexOf(‘R’)));

c. What will be the output for the following program segment?
m=18; n=0; p=16;
p = m++ + ++m/++n+ ++p;
d. Define the integer data member age and String data member name in the class Student. Initialize them with the values in default constructor and parameterized constructor.
e. Write the output of the following.
String str1=”Practice”;
String str2=”Program”;
int num=str1.compareTo(str2);

Section B (60 marks)

Attempt any 4 programs out of 6

(Each program carries 15 marks)

Q 5. Write a program in Java to accept a line of text from the user and create a new word formed out of the first letter of each word.
E.g. Mangoes Are Delivered After Midnight
Output: MADAM
Q 6. Write a program in java to accept a number and check whether it is a weak arm No. or not.
[135 is a weak arm no. because 135 = 11+32+53=1+9+125=135].
                              icse sample paper

Q 7. Create a class to print the following output using menu driven program
a. B


Q 8. Design a class to overload a function check()as follows:

(i) void check(String sir, char ch)- to find and print the frequency of a character in a string.

str =”success”
number of ‘s’ present is=3

(ii) void check(String s1)-to display only vowels from string s1, after converting it to lowercase.

Example: Input:
s1 =computer
Output : o u e

Q 9. Define a class named BookFair with the following description:
Instance variables/Data members:
String Bname – stores the name of the book.
double price – stores the price of the book.
Member Methods:
(i) BookFair() – Default constructor to initialize data members.
(ii) void Input() – To input and store the name and the price of the book.
(iii) void calculate() – To calculate the price after discount. Discount is calculated based on the criteria given below.
(iv) void display() – To display the name and price of the book after discount.
Write a main method to create an object of the class and call the above member methods.

Less than or equal to Rs 1000 2% of price
More than Rs 1000 and less than or equal to Rs 3000 10% of price
More than Rs 3000 15% of price

Q 10. An electronics shop has announced the following seasonal discounts on the purchase of certain items.

Purchase Amount in Rs. Discount on Laptop Discount on Desktop PC
0 – 25000 0.0% 5.0%
25001 – 57000 5.0% 7.6%
57001 – 100000 7.5% 10.0%
More than 100000 10.0% 15.0%

Write a program based on the above criteria to input name, address, amount of purchase and type of purchase (L for Laptop and D for Desktop) by a customer.
Compute and print the net amount to be paid by a customer along with his name and address.
(Hint: discount = (discount rate/100)* amount of purchase
Net amount = amount of purchase – discount) icse sample paper

Sample papers


Please enter your comment!
Please enter your name here