Solving ICSE Class 10 Computer Applications Previous Year Question Papers ICSE Class 10 Computer Applications Question Paper 2013 is the best way to boost your preparation for the board exams.

ICSE Class 10 Computer Applications Question Paper 2013 Solved

Section – A (40 Marks)
(Attempt all Questions)

Question 1.
(a) What is meant by precedence of operators ? [2]
Answer:
Precedence is the order in which a program performs the operations in a formula. If one operator has precedence over another operator, it is evaluated first.

  • Expressions inside parentheses are evaluated first.
  • Nested parentheses are evaluated from the innermost parentheses to the outermost parenthesis.

ICSE 2013 Computer Applications Question Paper Solved for Class 10

(b) What is a literal ? [2]
Answer:
Literals are also constants. They are used to express particular values within the source code of a program. For example:
a = 6;
Here 6 in this piece of code is a literal constant.
Literal constants can be divided in Integer Numerals, Floating-Point Numerals, Characters, Strings and Boolean Values.

(c) State the Java concept that is implemented through :
(i) a superclass and a subclass
(ii) the act of representing essential features without including background details. [2]
Answer:
(i) Concept of inheritance
(ii) Encapsulation

(d) Give a difference between a constructor and a method. [2]
Answer:

Method Constructor
A method is used to perform some operations. Constructor is used to create an instance of object.
A method has a different name from that of a Class. Constructor is a member function with the same name as that of its Class.
Method may or may not contain return type. There is no return type given in a constructor signature (header). The value is this object itself so there is no need to indicate a return value.

(e) What are the types of casting showing by the following examples ?
(i) double x = 15.2; inty = (int) x;
(ii) int x = 12; long y = x; [2]
Answer:
(i) Explicit Conversion
(ii) Automatic Conversion
In Java type conversions are performed automatically when the type of the expression on the right hand side of an assignment operation can be safely promoted to the type of the variable on the left hand side of the assignment. Thus we can safely assign : byte → short → int → long → float → double.

Question 2.
(a) Name any two wrapper classes. [2]
Answer:
Each of Java’s eight primitive data types has a class dedicated to it. These are known as wrapper classes, because they “wrap” the primitive data type into an object of that class. So, there is an Integer class that holds an int variable, there is a Double class that holds a double variable, and so on.

(b) What is the difference between a break statement and a continue statement when they occur in loop ? [2]
Answer:
The break statement can also be used to jump out of a loop. The break statement breaks the loop and continues executing the code after the loop (if any).
The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.

ICSE 2013 Computer Applications Question Paper Solved for Class 10

(c) Write statement so show how finding the length of a character array char[] differs from finding the length of a String object str. [2]
Answer:
The char [] uses length keyword whereas String object str uses length() method,
char [] c = {‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’};
System.out.println(“Length of char array in Java is: “+c. length);
String str = “Example”;
int len = str.length(); //the length() method calculates total no of chars in string str.

(d) Name the Java keyword that:
(i) indicates that a method has no return type.
(ii) stores the address of the currently-calling object. [2]
Answer:
(i) void
(ii) this

(e) What is an exception ? [2]
Answer:
An exception is a problem that arises during the execution of a program. An exception can occur for many different reasons, including the following:

  • A user has entered invalid data.
  • A file that needs to be opened cannot be found. Some of these exceptions are caused by user error, others by programmer error, and others by physical resources that have failed in some manner.

Checked exceptions: A checked exception is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation.

Runtime exceptions: A runtime exception is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compilation.

Question 3.
(a) Write a Java statement to create an object mp4 of class digital. [2]
Answer:
public class digital {
public digital (String name) {
// This constructor has one parameter, name.
System.out.println (“Passed Name is :” + name);
}
public static void main(String args[]){
// Following statement would create an object mp4
digital mp4 = new digital (“Good Sound”);
}
}

(b) State the values stored in the variables strl and str2. [2]
String s1 = “good”; String s2 = “world matters”;
String st1 = s2. substring(5).replace(‘t’,’n);
String str2 = si. concat (str1);
Answer:
manners
good manners

(c) What does a class encapsulate ? [2]
Answer:
Encapsulation concerns the hiding of data in a class and making diem available only through its methods. If a variable is declared private, it cannot be accessed by anyone outside the class, thereby hiding the variable within the class. For this reason, encapsulation is also referred to as data hiding.

(d) Rewrite the following program segment using the if. else statement. [2]
comm = (sale>15000) ? sale x 5/100: 0;
Answer:
if(sale>15000)
comm = sale*5/100;
else
comm = 0;

(e) How many times will the following loop execute? What value will be returned ?
int x = 2, y = 50;
do {
++x;
y – = x ++ ; .
}
while(x < = 10);
return y; [2]
Answer:
Five times

ICSE 2013 Computer Applications Question Paper Solved for Class 10

(f) What is the data type that the following library Junctions return ?
(i) isWhitespace(char ch)
(ii) Math.random () [2]
Answer:
(i) isWhitespace(char ch) returns true if the character is a Java whitespace character, false otherwise.
(ii) Math.random() method returns a double value in the range 0.0 up to, but not including 1.0.

(g) Write a Java expression for ut + ½f t2 [2]
Answer:
u*t + ½*f*Math.pow(t,2);

(h) If int n[] = {1, 2, 3, 4, 5, 7, 9, 13, 16}, what are the values of x and y?
x = Math.pow(n[4], n[2]);
y = Math.sqrt(n[5] + n[7); [2]
Answer:
125.0
4.47213595499958
(By declaring x and y of the double type)

(i) What is the final value of ctr when the iteration process given below, executes ? [2]
int ctr = 0;.
for(int i = 1; i <= 5; i ++)
for (int j = !; j <= 5; j +=2)
++ctr;
Answer:
15

(j) Name the methods of Scanner class that :
(i) is used to input an integer data from the standard input stream.
(ii) is used to input a String data from the standard input stream. [2]
Answer:
(i) nextlnt()
(ii) next()

Section – B (60 Marks)
(Attempt any Four questions from this section)

Question 4.
Define a class named FruitJuice with the following description:
Instance variables/data members:
int product code – stores the product code number
String flavour – stores the flavour of the juice (E.g. orange, apple, etc.)
String package – stores the type of packaging (E.g. tera pack, PET bottle etc.)
int pack_size – stores package size (E.g. 200 ml, 400 ml etc.)
int product_price – stores the price of the product

Member methods:
(i) FruitJuice() – Default constructor to initialize integer data members to 0 and String data members to “”.
(ii) void input() – To input and store the product code, flavour, pack type, pack size and product price.
(iii) void discount() – To reduce the product price by 10.
(v) void display() – To display the product code, flavour, pack type, pack size and product price. [15]
Answer:

class FruitJuice {
private int product_code;
private String flavour;
private String pactype;
private int packsize;
private int product_price;
void FruitJuice() {
product_code=0;
flavour = " ";
pac_type = " ";
pack_size = 0;
product_price = 0;
}
void input(int pc, String f, String pt, int ps, int pp) {
product_code=pc;
flavour = f;
pac_type = pt;
pack_size = ps;
product_price = pp;
System.out.println("Product Code = " + product_code);
System.out.println("Flavour " + flavour);
System.out.println("Pack Type = " +pac_type);
System.out.println("Pack Size = " +pack_size);
System.out.println("Product Price = " +product_price);
}
void discount() {
product_price = product_price-10;
System.out.println("Discounted Price = "+product_price);
}
void display() {
System.out.println("Product Code = " + product_code);
System.out.println("Flavour " + flavour);
System.out.println("Pack Type = " + pac_type);
System.out.println("Pack Size = " + pack_size);
System.out.println("Product Price = " + product_price);
}
}

ICSE 2013 Computer Applications Question Paper Solved for Class 10

Question 5.
The International Standard Book Number (ISBN) is a unique numeric book identifier which is printed on every book. The ISBN is based upon a 10-digit code. The ISBN is legal if:
1 × digit1 + 2 × digit2 + 3 × digit3 + 4 × digit4 + 5 × digit5 + 6 ×digit6 + 7 × digit7 + 8 × digit8 + 9 × digit9 + 10 × digit10 is divisible by 11.
Example: For an ISBN 1401601499
Sum = 1 × 1 + 2 × 4 + 3 × 0 + 4 × 1 + 5 × 6 + 6 × 0 + 7 × 1 + 8 × 4 + 9 × 9 + 10 × 9 =. 253
which is divisible by 11.
Write a program to:
(i) Input the ISBN code as a 10-digit integer.
(ii) If the ISBN is not a 10-digit integer, output the message, “Illegal ISBN” and terminate the program.
(iii) If the number is 10-digit, extract the digit of the number and compute the sum as explained above.
If the sum is divisible by 11, output the message, “Legal ISBN”. If the sum is not divisible by 11, output the message, “Illegal ISBN”. [15]
Answer:

import java.util.Scanner;
import java.io.*;
class ISBN {
public static void main() throws IOException {
BufferedReader br=new BufferedReader(new
InputStreamReader (System.in));
System.out.print("Enter a 10 digit code: ");
String s=br.readLine();
try {
Integer.parselnt( s );
System.out.println();
}
catch( Exception e) {
System.out.println("Input Error!");
System.exit(0);
}
int len=s.length();
if(len!=10)
System.out.println("Output: Illegal ISBN");
else {
char ch;
int dig=0, sum=0, k=10;
for(int i=0; i<len; i++) {
ch=s.charAt(i);
if(ch=='X')
dig=10;
else
dig=ch-48;
sum=sum+dig*k;
k-;
}
System.out.println("Output: Sum = "+sum);
if(sum%11 == 0) .
System.out.println("Leaves No Remainder - Legal ISBN Code");
else
System.out.println("Leaves Remainder - Illegal ISBN ");
}
}
}

Question 6.
Write a program that encodes a word into Piglatin. To translate word into a Piglatin word, convert the word into uppercase and then place the first vowel of the original word as the start of the new word alongwith the remaining alphabets. The alphabets present before the vowel being shifted towards the endfollowed by “AY”. [15]
Sample input (1) : London,
Sample output(1) : ONDONLAY
Sample input (2) : Olympics,
Sample output(2) : OLYMPICSAY ‘
Answer:

import javario.*;
class PigLatin {
public static void main() throws IOException {
BufferedReader in=new BufferedReader(new
InputStreamReader(System.in));
System.out.print("Enter the String:");
String s=in.readLine(),n="";
String strUpper = s.toUpperCase();
System.out.println("Original String: " + s);
System.out.println("String changed to uppercase: "+ strUpper);
char ch;
boolean b=false;
for(short i = 0;i < s.length();i++) {
ch=strUpper.charAt(i);
if(ch == A'||ch=='E'||ch==I'||ch=="O"|| ch=U'||ch==a'|| ch=='e'|| ch == "i' ll ch == 'o'||ch='u')
b = true;
if(b == true)
n+=ch;
}
for(short i=0;i<strUpper.length();i++) {
ch=s.charAt(i);
if(ch == A'||ch=='E'||ch==I'||ch=="O"|| ch=U'||ch==a'|| ch=='e'|| ch == "i' ll ch == 'o'||ch='u')
break;
n+=ch;
}
n+="AY";
System.out.print("Word in PigLatin: "+n);
}
}

ICSE 2013 Computer Applications Question Paper Solved for Class 10

Question 7.
Write a program to input 10 integer elements in an array and sort them in descending order using the bubble sort technique. [15]
Answer:

class BubbleSort {
private int a[] = new int[10];
public void inputdata(int array[]) {
for(int i=0;i<a.length;i++)
a[i]=array[i];
}
public void sorting() {
int i=0 j=0;
int temp=0;
System.out.println("Array Elements are = ");
for(i=0;i<a.length;i++) {
System.out.println(a[i] + " ");
}
// Now Sorting Elements
//through Bubble Sort
for(int k = 0;k < a.length;k++) {
for(j = 1 ;j < a.length;j ++ ) {
if(a[j - 1] < a[j]) {
temp = a[j - 1];
a[j - 1] = a[j];
a[j]=temp;
}
}
}
System.out.println("The sorted array is ");
for(i = 0;i<a.length;i++) {
System.out.println(a[i]+ " ");
}
}
}

Question 8.
Design a class to overload a junction series() as follows:
(i) double series(double n) with one double argument and returns the sum of the series.
sum = \(\frac{1}{1}+\frac{1}{2}+\frac{1}{3} \ldots \ldots \ldots+\frac{1}{n}\)
(ii) double series(double a, double n) with two double arguments and returns the sum of the series.
sum = \(\frac{1}{a^2}+\frac{4}{a^5}+\frac{7}{a^8} \ldots \ldots \ldots \ldots \ldots+\frac{10}{a^{11}}\) to n terms
Answer:

import javaio.*;
class SeriesOverload {
double series(double n) throws IOException {
System.out.println("Value of n =");
double sum = 0;
for(int i= 1 ;i<=n; i++) {
sum += 1.0/i;
}
return sum;
}
double series(double a, double n) throws IOException {
System.out.println("Value of a =" +a);
System.out.println("Value of n =" +n);
double sum = 0; intij;
for(i = 1; i <= n; i = i + 3) {
for(j = 2;j < n + 1; j = j + 3) {
sum = sum+ i/Math.pow(a,j);
}
return sum;
}
}
}

ICSE 2013 Computer Applications Question Paper Solved for Class 10

Question 9.
Using the switch statement, write a menu driven program :
(i) To check and display whether a number input by the user is a composite number of not (A number is said to be a composite if it has one or more than one factor excluding 1 and the number itself).
Example: 4, 6, 8, 9…….
(ii) To find the smallest digit ofan integer that is input.
Sample input : 6524
Sample output: Smallest digit is 2
For an incorrect choice, an appropriate message should be displayed. [15]
Answer:

import java.io.*;
class SwitchCase {
public static void num(String aigs[]) throws IOException
{
int n=0,d,ctr,ch;
int t;
InputStreamReader reader = new InputStream
Reader(System.in);
BufferedReader input = new BufferedReader (reader);
System.out.println("Enter 1 for Checking Composite number:");
System.out.println("Enter 2 for Checking the Smallest
}
Digit:");
System.out.println("Enter your choice
try {
DatalnputStream z = new DataInputStream(System.in);
ch=Integer.parseInt(z.readLine());
}
catch (Exception e) {
System.out.println("Input Error!");
System.exit(0);
}
System.out.println("Enter a numbei=");
try {
DatalnputStream y = new DataInputStream(System.in);
n=Integer.parseInt(y.readLine());
}
catch (Exception e) {
System.out.println("Input Error!");
System.exit(0);
}
d=1;
ctr=0;
switch(ch){
case 1 :
while(d<=n) {
if(n==1) 
System.out.println(+n + ": is Not a composite number"); 
System.exit(0); 
if(n%d==0) 
ctr++; 
d=d+1; 
if(ctr==2) 
System.out.println(+n + ": is a prime number"); 
else 
System.out.println(+n + ": is a composite number"); } 
break; 

case 2: 
int min=n%10; 
while(n>0) {
int a=n%10;
if(a<min)
min=a;
n=n/10;
}
System.out.println("The smallest digit is :" +min);
break;
}
}
}