ICSE Class 10 Computer Application Solved Question Paper Year 2010

(Two Hours)

Answer to this paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given on the head of this paper is the time allowed for writing the answer.
This Paper is divided into Sections.
Attempt all questions from Section A and any four from Section B.
The intended marks for questions or parts of questions are given in brackets [ ]


Attempt all questions

Question 1

  1. Marks [2]

    Define the term Byte code.
    Ans. Byte code: Byte code is a machine instruction for Java processor chip called Java virtual machine (J.V.M). The byte code is independent of computer system it has to run upon. The byte codes are always exactly the same irrespective of the computer system they are to execute upon.

  2. Marks [2]

    What do you mean by type conversion?
    How is implicit conversion different from explicit conversion?
    Ans. Type conversion: The process of converting one predefined type into another is called Type conversion. It is of two types:

    1. Implicit
    2. Explicit

    Implicit conversion is performed by compiler without programmers’ intervention but explicit is performed by user that forces an expression to the specify type.
    Eg. (type) conversion
    Where type: is a valid data type in which conversion is to be done.

  3. Marks [2]

    Name two jump statements and their use.
    Ans. Two jump are statements are

    1. Break: It skips the rest of loop and jumps over the statement following the loop,
    2. Continue: It skips the rest of the loop statement and causes the next iterations of the loop.
  4. Marks [2]

    What is an Exception? Name two Exception handling blocks.
    Ans. Exception: Contradicting or unexpected situation or unexpected errors during program execution is called Exception
    Two exceptions handle blocks are:

    1. try block and
    2. catch block
  5. Marks [2]

    Write two advantages of using functions in a program.
    Ans. Two advantages of using functions.

    1. To allow us to cope with complex problems,
    2. To hide low level details that otherwise obscure and confuse,
    3. To use portion of code.

Question 2

  1. Marks [2]

    State the purpose and return data type of the following String functions:

    1. indexOf( )
    2. compareTo( )


    1. IndexOf(): It searches for the first occurrence of a character or sub-string return data type will be integral.
    2. CompareTo(): It sort the given string. Return data type will be integer.
  2. Marks [2]

    What is the result stored in x, after evaluating the following expression
    int x = 5; x = x++ *2 + 3* –x;
    Ans. x = 5,
    Then x,
    = x++ *2+3*–x,
    = 5*2+3*(5)
    = 10+15
    = 25

  3. Marks [2]

    Differentiate between static and non – static data members
    Ans. Static: static data members can be accessed before any objects of its class are created and without reference to any object. While non-static data members do not provide such facility.

  4. Marks [2]

    Write the difference between length and length( ) functions.
    Ans. length(): it is used to obtain number of character contained in string.
    length: length is used to depict size of an array that is number of elements an array can hold.

  5. Marks [2]

    Private: It means that the methods in same class are permitted to use this method.
    Protected: It means that methods in this class and methods in any subclasses may use this method.

Question 3

  1. Marks [2]

    What do you understand by the term data abstraction? Explain with an example.
    Ans. Data Abstraction: It refers to the act of representing essential features without including back ground details or explanation.
    Example: While driving a car, you know only essential features e.g. gear handling, steering handling etc. but without knowing the internal details. This is abstraction.

  2. Marks [2]

    What will be the output of the following code?

    1. int m = 2;
      int n = 15;
      for(int i = 1 ; i<5; i++);
      System.out.println(“m = ” +m);
      System.out.println(“n = ” +n);
    2. char x = ‘A’;
      int m;
      m = (x == ‘a’)? ‘A’:’a’;
      System.out.println(“m = ” +m);


    1. m = 3
      n = 14
    2. m = 97
  3. Marks [2]

    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.
    int k = l, i = 2;
    while( ++i<6 )
    k *= i;
    Ans. 60

  4. Marks [2]

    Give the prototype of a function check which receives a character ch and an integer n and returns true or false.
    Ans. boolean check(char ch, int n)

  5. Marks [2]

    State two features of a constructor.
    Ans. Constructor:

    1. Constructor name has the same name as the class it belongs to. While initializing Object its get automatically initialized.
    2. Constructor prototype does not have any return type or even void, since constructors never return a value.
  6. Marks [2]

    Write a statement each to perform the following task on a string:

    1. Extract the second last character of a word stored in the variable wd.
    2. Check if the second character of a string str is in uppercase.


    1. String wd = “abcdef”;
      int len = wd.length();
      char c = wd.charAt(len-2);
    2. String str = “aBcdef”;
      int len = str.length();
      char c = str.charAt(1); //Extracting 2nd character
      boolean chk = Character.isUpperCase(c);//Checking the character is in Upper case
  7. Marks [2]

    What will the following functions return when executed?

    1. Math.max(-17, -19)
    2. Math.ceil(7.8)


    1. -17,
    2. 8
  8. Marks [2]
    1. Why an object is called an instance of a class?
    2. What is the use of the keyword import?


    1. Object is called an instance of class as it is used to represent different methods and data members of the class
    2. import is used to include the package in our program.

      import java.io.*;

      It means java.io. Package will be included in the program.


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 description/Mnemonic Codes
so that the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.

Question 4

Marks [15]

Write a program to perform binary search on a list of integers given below, to search for an element input by the user, if it is found display the element along with its position, otherwise display the message “Search element not found” 5,7,9,11,15,20,30,45,89,97

import java.io.*;

		class Binary
			public static void main( ) throws IOException
				//array elements are in ascending order
				BufferedReaderbuf = new BufferedReader( new InputStreamReader(System.in));
				int x[ ] = {5,7,11,15,20,30,45,89,97};
				System.out.print( &quot;Enter element to search in the list &quot;);

				int elem = Integer.parseInt( buf.readLine( ) );
				//Intitialise lower bound and upper bound
				int LB = 0, UB = 9 ; // 10 elements, so UB = 9
				int mid = 0;
				boolean flag = false;
					mid = ( LB + UB )/2;
					if ( elem ==x [mid])

						System.out.println (&quot; Element is: &quot;+ elem);
						System.out.println (&quot; Found at index: &quot;+ mid);
						System.out.println (&quot; Position in list: &quot;+ ( mid+1 ) );
						flag = true;
					else if( elem &lt;x [mid] )
						UB = mid - 1;
						LB = mid +1;
				while( LB &lt;= UB );
					if(flag == false)
						System.out.print ( &quot;Search element not found&quot; );

Question 5

Marks [15]

Define a class student described as below:
Data members/instance variables:
Name, age, ml, m2, m3 (marks in 3 subjects), maximum, average
Member Methods:

  1. A parameterized constructor to initialize the data members
  2. To accept the details of a student
  3. To compute the average and the maximum out of three marks
  4. To display the name, age, marks in three subjects, maximum and average.

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

import java.io.*;

		class student
			String name;
			int age, ml , m2, m3;
			int maximum;
			int average;
			public student(String Name,int Age,int M1,int M2,int M3)
				name = Name;
				age = Age;
				ml = M1;
				m2 = M2;
				m3 = M3;
				maximum = 0;
				average = 0;
			public void accept( )
				name = &quot;Avishek Mitra&quot;;
				age = 14;
				ml = 95;
				m2 = 80;
				m3= 78;
			public void compute( )
				average = ( ml + m2 + m3)/3;

				if (ml&gt;m2 &amp;&amp; ml&gt;m3)
					maximum = ml;
				else if (m2&gt;ml &amp;&amp; m2 &gt;m3)
					maximum = m2;
					maximum = m3;
			public void display()
				System.out.println(&quot;Name of student is: &quot; + name);
				System.out.println(&quot;Age is: &quot; + age);
				System.out.println(&quot;Marks in 1st subject: &quot; + ml);
				System.out.println(&quot;Marks in 2nd subject: &quot; + m2);
				System.out.println(&quot;Marks 3rd subject: &quot; + m3);
				System.out.println(&quot;Maximum marks: &quot; + maximum);
				System.out.println(&quot;Average is: &quot; + average);
			public static void main(String args[ ])
				student s = new student(&quot;Koneenika&quot;,7,82,66,91);
				System.out.println(&quot;Using Parameterised Constructor:-&quot;);
				s.compute( );
				s.display( );
				System.out.println(&quot;Using a method to accept:-&quot;);
				s.accept( );
				s.compute( );
				s.display( );

Question 6

Marks [15]

Shasha Travels Pvt. Ltd. gives the following discount to its customers:

Write a program to input the name and ticket amount for the customer and calculate the discount amount and net amount to be paid. Display the output in the following format for each customer:
SL. No. Name Ticket charges Discount Net amount
1. – – – –
(Assume that there are 15 customers, first customer is given the serial no (SI. No.) 1, next customer2 …… and so on)

import java.io.*;

		class ShashaTravels
			public static void Bill(String Name[], int TicketCharges[])
				double discount;
				double NetAmount;
				for(int i = 0; i&lt;15; i++)
					if(TicketCharges[i] &lt; 25001)
						discount = 0.02 * TicketCharges[i];
					else if (TicketCharges[i] &gt; 25001 &amp;&amp; TicketCharges[i] &lt; 3500)
						discount = 0.1 * TicketCharges[i];
					else if (TicketCharges[i] &gt;35001 &amp;&amp; TicketCharges[i] &lt;5500)
						discount = 0.12 * TicketCharges[i];
					else if (TicketCharges[i] &gt;55001 &amp;&amp; TicketCharges[i] &lt; 7000)
						discount = 0.16 * TicketCharges[i];
						discount = 0.18 * TicketCharges[i];
					NetAmount = TicketCharges[i] - discount;
		System.out.println((i+1)+&quot;\t&quot; +Name[i]+&quot;\t\t&quot; +TicketCharges[i]+&quot;\t\t&quot; +discount+&quot;\t\t&quot; +NetAmount);

			public static void main(String args[])throws IOException
				InputStreamReader br = new InputStreamReader(System.in);
				BufferedReader read = new BufferedReader(br);
				String n[] = new String[15];
				int TC[] = new int[15];

				for(int i = 0; i&lt;15; i++)
					System.out.print(&quot;Enter Name for customer &quot; +(i+1) +&quot; &quot;);
					n[i] = read.readLine();

					System.out.print(&quot;Enter Ticket Charges: &quot;) ;
					TC[i] = Integer.parseInt(read.readLine());
				System.out.println(&quot;SL. No.&quot; +&quot;\tName&quot; +&quot;\tTicket charges&quot; +&quot;\tDiscount&quot; +&quot;\tNet Amount&quot;);

Question 7

Marks [15]

Write a menu driven program to accept a number and check and display whether it is a Prime number or not OR an Automorphic number or not. (Use switch – case statement)

  1. Prime number: A number is said to be a prime number if it is divisible only by 1 and itself and not by any other number.
    Example: 3, 5, 7, 11, 13 etc.
  2. Automorphic number: An Automorphic number is the number which is contained in the last digit(s) of its square.
    Example 25 is an Automorphic number as its square id 625 and 25 is present as the last twodigits.


import java.io.*;

		class PrimeAutomorphic
			public static void main(String args[])throws IOException
				InputStreamReader reads = new InputStreamReader(System.in);
				BufferedReader br = new BufferedReader(reads);
				int choice, n;
				System.out.print(&quot;Enter a number: &quot;);
				n = Integer.parseInt(br.readLine());
				System.out.println(&quot;Your Choices:-&quot;);
				System.out.println(&quot;1 - Prime&quot;);
				System.out.println(&quot;2 - Automorphic&quot;);
				System.out.print(&quot;Enter your choice: &quot;);
				choice = Integer.parseInt(br.readLine());

				switch (choice)
					case 1:
					//to check given no is Prime or not.
					int c = 0, i;
					for (i = 2; i&lt;n; i++)
						if(n % i == 0)
					if(c == 0)
						System.out.println(&quot;No. is Prime&quot;);
						System.out.println(&quot;No. is not prime&quot;);

					case 2:
					//to check given no is Automorphic or not.
					int no = 0, sq = 0, a = 0, rs = 0, rn = 0;
					sq = n * n;
					no = n;
						rs = sq%10;
						sq = sq/10;
						rn = n%10;
						n = n/10;
					if (rs == rn)
						System.out.println(&quot;No. is Automorphic&quot;);
						System.out.println(&quot;No. is not Automorphic&quot;);
					System.out.println(&quot;Nothing to do with the Number - Invalid option Choosen&quot;);

Question 8

Marks [15]

Write a program to store 6 elements in an array P, and 4 elements in an array Q and produce a third array R, containing all the elements of array P and Q. Display the resultant array.

P[6] Q[4] OUTPUT R[10]
4 19 4
6 23 6
1 7 1
2 8 2
3 3
10 10


import java.io.*;

		class arrayMerge
			public static void main(String args[])throws IOException
				int i, j = 0, k = 0;
				int[ ] P = {4,6, 1,2, 3, 10};
				int[ ] Q = {19,23,7,8};
				int[ ] R = new int [10];
				for (i = 0; i &lt; R.length; i++)
						R[i] = P[j];
						R[i] = Q[k];
				for (i = 0; i &lt; R.length; i++)

Question 9

Marks [15]

Write a program to input a string in uppercase and print the frequency of each character.

A 2
C 1
D 1
E 2
H 1
M 1
O 1
P 1
R 3
T 1
U 1
W 1


import java.io.*;	

		public class Frequency
			public static void main(String[] args)throws IOException
				BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
				System.out.print(&quot;Enter a string: &quot;);
				String str = buf.readLine( );
				int c;
				str = str.toUpperCase();
				for(int i = 65; i&lt;=92; i++)
					c = 0;
					for(int j = 0; j&lt;str.length(); j++)
						if((char)(i) == str.charAt(j))
							c += 1;
					if(c &gt; 0)
						System.out.println((char)(i) +&quot;\t\t\t&quot; +c);

Add a Comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.