In this ICSE sample paper there are two sections (Section A , 40 marks theory and Section B- 60 marks programs are asked). You are supposed to answer all the questions from section A, and any four from section B.

Watch java videos



ICSE sample paper

Section A (40 marks)


  1. Give one example each of a primitive data type and a composite data type.         [2]
  2. Complete the code below to create an object of Scanner class.                             [2]

Scanner sc= ________ Scanner( ________________)

  1. Create a class with one integer instance variable. Initialize the variable using :  [2]
  2. i) Default constructor ii) Parameterized constructor
  3. Write an expression in java for a3-y5                                                             [2]
  4. What is the use of default in a switch?                                     [2]


  1. Write a main difference between while loop & do while loop             [2]
  2. Write the output of the following code.                                                                     [1]

String str=”Application”;


  1. Write the output of the following.                                                                                                     [4]

String s1 = “MINORITY”;

String s2 = “REPORT”;

  1. out.println(s1.substring(0,3).concat(s2.substring(3,5))
  2. out.println(s2.substring(2));
  • out.println(s1.charAt(s1.indexOf(‘R’) + s2.indexOf(‘R’)));
  1. out.println(s2.replace(‘p’ , ‘s’));
  1. Give an example of Relational operator and a Bitwise Operator.                               [1]
  2. Differentiate between equals() and compareTo() functions. [2]
  1. Name any two jump statements and their use.                                                  [2]
  1. What is a constructor? What is its use? [2]
  1. State the purpose and return data type of the following String functions :-      [2]
  1. i) trim()
  2. ii) charAt( )
  1. What is the value stored in variable val given below:                                                                         [2]

double val= Math.pow(“345”.indexOf(‘5’),3);

  1. What are the values of a and b after the following function is executed, if the values passed are 39 and 20:                                                                                                                                      [2]

void paws(int a, int b)








  1. Analyse the following program segment and determine how many times the loop will be executed and what will be the output of the program segment.                    [2]

int k=1,i=2;


k*=i; System.out.println(k);

  1. If int y=10 then find int z=(++y * (y++ + 5)); [2]
  2. Differentiate between isUpperCase(char) and toLowerCase(char)                                              [2]
  3. State the output of the following program segment: String str1=”great”;

String str2=”minds”; System.out.println(str1.substring(0,2).concat(str2.substring(1)));

System.out.println(“WH”+(str1.substring(2).toUpperCase())));                                          [2]

  1. Write a statement to create an object of a class Student that invokes a parameterized constructor that accepts one String and one int type values.                 [2]


Section B (60 marks)

Attempt any 4 questions out of 6

 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                                                                                                                                         [15]

  1. Write a program to generate the following pattern                                                                            [15]
  1. a)


B l

B l u

B l u e

B l u e j



1 2

1 2 3

1 2 3 4

1 2 3 4 5

  7. Write a program in java to accept a string and find [15]

  • number of blank spaces in the string
  • number of words in the string
  • number of consonants present in the string
  • number of vowels present in the string
  1. Write a class in java to enter any number and print if it is a perfect number.[Hint: a number is said to be perfect if it is equal to sum of all its factors ex, 6=1+2+3, hence 6 is perfect number] [15] 
  2. a. Using switch case create class which take day number 1-7 & prints the corresponding day in words [3- Wednesday, 5- Friday]                                     [7]                                                                                           b. Write a class to input a number and print if it is a prime number or not. [8]
  3. Define a class named movieMagic with the following description: Instance variables/data members:
int year to store the year of release of a movie
String title to store the title of the movie.
float rating to store the popularity rating of the movie.

(minimum rating = 0.0 and maximum rating = 5.0)

Member Methods:

(i)  movieMagic()              Default constructor to initialize numeric data members   to 0 and String data member to “”.

(ii) void accept()                  To input and store year, title and rating.

(iii) void display()            To display the title of a movie and a message based on the rating as per the table below.

Rating Message to be displayed
0.0 to 2.0 Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
4.6 to 5.0 Super Hit

Write a main method to create an object of the class and call the above member methods.                           [15]


Download free Sample papers


Please enter your comment!
Please enter your name here