Blog

ICSE 10th Computer Applications 2010 Solved Question Paper

ICSE Solved Papers

ICSE 10th Computer Applications 2010 Solved Question Paper

ICSE 10th Computer Applications 2010 Solved Question Paper

If you have any doubts, ask them in the comments section at the bottom of this page.

ICSE Class 10 Computer Applications Question Paper – 2011 (Solved)
Computer Applications
Class X

SECTION – A (40 Marks)

Answer all questions from this Section

Question 1.
(a) Define the term Byte Code. [2]
Ans. The Java compiler compiles the source programs into an intermediate code called the Java Byte Code which is interpreted by the Java Virtual Machine (JVM)
(b) What do you understand by type conversion? [2]
Ans. Type conversion or casting is the conversion of the data type of a literal from one type to another. There are tow types of types of casting – implicit casting and explicit casting.
(c) Name two jump statements and their use. [2]
Ans. break and continue are the two jump statements in Java. break is used to force early termination of a loop. continue is used to move to the next iteration of the loop while skipping the remaining code in the current iteration.
(d) What is Exception ? Name two Exception Handling Blocks. [2]
Ans. An Exception is an error which occurs during the execution of a program. The exception handling blocks are try, catch and finally.
(e) Write two advantages of using functions in a program. [2]
Ans. i) Function make code reusable.
ii) Functions improve modularity and facilitate easy debugging.

ICSE 10th Computer Applications 2010 Solved Question Paper

Question 2.
(a) State the purpose and return data type of the following String functions: [2]
(i) indexOf ( )
(ii) compareTo ( )
Ans. i) indexOf() returns the index of the character or String passed as the parameter in the string on which is invoked.
Return type is int.
ii) compareTo() lexicographically compares the String passed as an argument to the String on which it is invoked.
Return type is int.
(b) What is the result stored in x, after evaluating the following expression [2]

int x = 5;
x = x++ * 2 + 3 * –x;

Ans. x = 5 * 2 + 3 * -6
x = 10 – 18
x = -8
(c) Differentiate between static and non-static data members. [2]
Ans. i) static variables belong to the class and all object share a single instance of the static variables. Non static varaiables belong to the objects. Each object has a copy of these members.
ii) static functions can access only static data members. Non static function can access both static and non static data members.
(d) Write the difference between length and length() functions. [2]
Ans. length is a property of an array which gives the size of the array. length() is a function of the String class which returns the size of the String.
(e) Differentiate between private and protected visibility modifiers. [2]
Ans. private members are accessible only in the class in which they have been defined. protected members are accessible in the class in which they have been defined as well in the sub classes of that class.

ICSE 10th Computer Applications 2010 Solved Question Paper

Question 3
(a) What do you understand by data abstraction? Explain with an example.[2]
Ans. Abstraction refers to representing the essential features of a system without considering all the details. Example: When we drive a car, we concentrate on how to drive it without bothering ourselves on how the engine works and other things.
(b) What will be the output of the following code?
(i) [2]

int m=2;
int n=15;
for(int i = 1; i<5; i++);
m++; –-n;
System.out.println("m=" +m);
System.out.println("n="+n);

Ans.
m=3
n=14
Note that there is a semicolon at the end of the loop. So, it is an empty loop and does’t affect the values of m and n.
(ii) [2]

char x = 'A' ; int m;
m=(x=='a') ? 'A' : ‘a’;
System.out.println("m="+m);

Ans.
m=97
(c) 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;
while (++i<6)
k*=i;
System.out.println(k);

Ans. Following are the iterations of the loop
3 < 6 —- k = 1 * 3 = 3
4 < 6 —- k = 3 * 4 = 12
5 < 6 —- k = 12 * 5 = 60
6 < 6 —- false
The loop will run three times and output is 60
(d) Give the prototype of a function check which receives a character ch and an integer n and returns true or false. [2]
Ans. public boolean check(char ch, int n)
(e) State two features of a constructor. [2]
Ans. i) A constructor has the same name as that of a class.
ii) A constructor does not have any return type.
iii) A constructor is automatically called during object creation.
(f) Write a statement each to perform the following task on a string:
(i) Extract the second last character of a word stored in the variable wd. [2]
Ans.char ch = wd.charAt(wd.length()-2);
(ii) Check if the second character of a string str is in uppercase. [2]
Ans. boolean result = Character.isUpperCase(str.charAt(1));
(g) What will the following functions return when executed? [2]
(j) Math.max(-17, -19)
(ii) Math.ceil(7.8)
Ans. i) -17
ii) 8.0
(h) (i) Why is an object called an instance of a class?
(ii) What is the use of the keyword import? [2]
Ans. i) An object is called an instance of a class because the objects contains a copy of all the instance variables of the class.
ii) The import keyword is used to import classes from external packages.

ICSE 10th Computer Applications 2010 Solved Question Paper

SECTION – B (60 Marks)

Attempt any four questions from this Section

Question 4.
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”. [15]
5,7,9,11,15,20,30,45,89,97
Ans.

import java.util.Scanner;
class BinarySearch{
	public static void main(String[]args)
	{
		Scanner kb=new Scanner(System.in);
		int arr[]={5,7,9,11,15,20,30,45,89,97};
		int F=0,L=arr.length-1,M;
		boolean flag=false;
		System.out.println("Enter the elements to be searched");
		int s=kb.nextInt();
		while(F<=L)
		{
			M=(F+L)/2;
			if(s==arr[M])
			{
				System.out.println("Element is available at index "+M);
				flag=true;
				break;
			}
			else if(s>arr[M])
			{
				F=M+1;
			}
			else
			{
				L=M-1;
			}
		}
		if(flag==false)
			System.out.println("Search element not found");
	}
}

 
Sample Output 1:
Enter the elements to be searched: 7
Element is available at index 1
Sample Output 2:
Enter the elements to be searched: 34
Search element not found

ICSE 10th Computer Applications 2010 Solved Question Paper

Question 5
Define a class ‘Student described as below: [15]
Data members/instance variables : name,age,m1,m2,m3 (marks in 3 subjects), maximum, average
Member methods :
(i) A parameterized constructor to initialize the data members.
(ii) To accept the details of a student.
(iii) To compute the average and the maximum out of three marks.
(iv) 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.
Ans.

import java.util.Scanner;
public class Student
{
    String name;
    int age;
    int m1, m2, m3;
    int maximum;
    double average;
	public Student()
	{}
    public Student(String n, int a, int marks1, int marks2, int marks3, int max, double avg)
	{
        name = n;
        age = a;
        m1 = marks1;
        m2 = marks2;
        m3 = marks3;
        maximum = max;
        average = avg;
    }
    public void accept()
	{
        Scanner kb = new Scanner(System.in);
        System.out.print("Enter name: ");
        name = kb.next();
        System.out.print("Enter age: ");
        age = kb.nextInt();
        System.out.print("Enter marks1: ");
        m1 = kb.nextInt();
        System.out.print("Enter marks2: ");
        m2 = kb.nextInt();
        System.out.print("Enter marks3: ");
        m3 = kb.nextInt();
    }
    public void compute()
	{
        average = (m1 + m2 + m3) / 3.0;
        maximum = Math.max(m1, (Math.max(m2, m3)));
    }
    public void display()
	{
        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
        System.out.println("Marks1 " + m1);
        System.out.println("Marks2 " + m2);
        System.out.println("Marks3 " + m3);
        System.out.println("Maximum: " + maximum);
        System.out.println("Average: " + average);
    }
    public static void main(String[] args)
	{
        Student s = new Student();
        s.accept();
        s.compute();
        s.display();
    }
}

 
Sample Output:

Enter name: Akash
Enter age: 20
Enter marks1: 95
Enter marks2: 100
Enter marks3: 99
Name: Akash
Age: 20
Marks1 95
Marks2 100
Marks3 99
Maximum: 100
Average: 98.0

ICSE 10th Computer Applications 2010 Solved Question Paper

Question 6
Shasha Travels Pvt. Ltd. gives the following discount to its customers: [15]
Ticket amount Discount
Above Rs 70000 – 18%
Rs 55001 to Rs 70000 – 16%
Rs 35001 to Rs 55000 – 12%
Rs 25001 to Rs 35000 – 10%
less than Rs 25001 – 2%
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 (SlNo.) 1, next customer 2 … and so on.
Ans.

import java.util.Scanner;
public class Travels
{
    public static void main(String[] args)
    {
        int sno , tAmount , discountPercentage = 0;
        String name;
        double discount,netAmount;
        Scanner kb = new Scanner(System.in);
        System.out.print("Enter serial no.: ");
        sno = kb.nextInt();
        System.out.print("Enter name: ");
        name = kb.next();
        System.out.print("Enter ticket amount: ");
        tAmount = kb.nextInt();
        if(tAmount > 70000)
        {
            discountPercentage = 18;
        }
        else if(tAmount >= 55001 && tAmount <= 70000)
        {
            discountPercentage = 16;
        }
        else if(tAmount >= 35001 && tAmount <= 55000)
        {
             discountPercentage = 12;
        }
        else if (tAmount >= 25001 && tAmount <= 35000)
        {
            discountPercentage = 10;
        }
        else if (tAmount < 25001)
        {
            discountPercentage = 2;
        }
        discount = discountPercentage * tAmount / 100.0;
        netAmount = tAmount - discount;
        System.out.println("Sl. No.\t Name \t Charges \t Discount \t Net Amount");
        System.out.println(sno + "\t" + name +"\t" + tAmount + "\t" + discount + "\t" + netAmount);
    }
}

Sample Output:

Enter sno: 3
Enter name: Shashank
Enter ticket charges: 27000
Sl.No.   Name       Amount   Discount   Net Amount
  3    Shashank      27000    2700.0     24300.0

ICSE 10th Computer Applications 2010 Solved Question Paper

Question 7
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). [15]
(a) 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.
(b) 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 is 625 and 25 is present as the last two digits.
Ans.

import java.util.Scanner;
class MenuDriven
{
    public static void main(String[]args)
    {
	int choice,n;
	Scanner kb = new Scanner(System.in);
        System.out.println("Press 1 for Prime number");
        System.out.println("Press 2 for Automorphic number");
        System.out.print("Enter your choice: ");
        choice = kb.nextInt();
	System.out.print("Enter a no. ");
	n = kb.nextInt();
	switch(choice)
	{
	    case 1:
		    int count=0;
		    for(int i=1;i<=n;i++)
		    {
			if(n%i==0)
				count++;
		    }
		    if(count == 2)
			System.out.println("Entered no. is a Prime no.");
		    else
			System.out.println("Entered no. is not a Prime no.");
		    break;
	    case 2:
		    int copy,rem,c=0;
		    copy = n;
		    while(copy!=0)    //counting no. of digits
		    {
	        	copy/=10;
	        	c++;
	    	    }
	    	    rem = (n*n) % (int)Math.pow(10,c);
	    	    if(rem==n)
	    		System.out.println("Automorphic no. ");
	    	    else
	        	System.out.println("Not a Automorphic no. ");
		    break;
	    default:
		    System.out.println("Invalid Choice");
	}
    }
}

 
Sample Output 1:

Enter 1 for Prime number
Enter 2 for Automorphic number
Enter your choice: 1
Enter a number: 5
Entered no. is a Prime no.

Sample Output 2:

Enter 1 for Prime number
Enter 2 for Automorphic number
Enter your choice: 2
Enter a number: 25
25 is an automorphic number

ICSE 10th Computer Applications 2010 Solved Question Paper

Question 8.
Write a program to store 6 element in an array P, and 4 elements in an array Q and produce a third array R, containing all elements of array P and Q. Display the resultant array [15]
Example:

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

Ans.

import java.util.Scanner;
public class ArrayStore
{
    public static void main(String[] args)
    {
        Scanner kb = new Scanner(System.in);
        int[] p = new int[6];
        int[] q = new int[4];
        int[] r = new int[10];
        System.out.print("Enter 6 elements in array P: ");
        for (int i = 0; i < 6; i++)
	{
            p[i] = kb.nextInt();
        }
        System.out.print("Enter 4 elements in array Q: ");
        for (int i = 0; i < 4; i++)
	{
            q[i] = kb.nextInt();
        }
        for (int i = 0; i < 6; i++)
	{
            r[i] = p[i];
        }
        for (int i = 0; i < 4; i++)
	{
            r[i + 6] = q[i];
        }
        System.out.print("Elements of array R: ");
        for (int i = 0; i < 10; i++)
	{
            System.out.println(r[i]);
        }
    }
}

 
Sample Output:

Enter elements of array P: 1 2 3 4 5 6
Enter elements of array Q: 7 8 9 10
Elements of array R: 1 2 3 4 5 6 7 8 9 10

Question 9
Write a program to input a string in uppercase and print the frequency of each character. [15]
INPUT : COMPUTER HARDWARE
OUTPUT :

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

Ans:

import java.util.Scanner;
class Frequency
{
	public static void main(String[]args)
	{
		Scanner kb=new Scanner(System.in);
		System.out.print("Enter a string ");
		String s=kb.nextLine();
		s=s.toUpperCase();
		int count=0;
		System.out.println("Character:Frequency\n");
		for(char j='A';j<='Z';j++)
		{
			for(int i=0;i<s.length();i++)
			{
				if(s.charAt(i)==j)
					count++;
			}
			if(count>0)
			{
				System.out.println(j+"	 :	"+count);
				count=0;
			}
		}
	}
}

Output:

Enter a string computer hardware
Entered String is COMPUTER HARDWARE
Character:Frequency
A        :      2
C        :      1
D        :      1
E        :      2
H        :      1
M        :      1
O        :      1
P        :      1
R        :      3
T        :      1
U        :      1
W        :      1

 

ICSE 10th Computer Applications 2010 Solved Question Paper

Comments (4)

  1. Litisha

    Its very helpful i lobed it❤️❤️

  2. Lea

    Thank you very much.
    It’s really helpful.

  3. Leah

    Thank you very much.
    It’s really helpful.

  4. User Avatar
    Shubham Tripathi

    welcome 🙂

Leave your thought here

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

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare