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

ICSE Class 10 Computer Applications Question Paper 2014 Solved

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

Question 1.
(a) Which of the following are valid comments?
(i) /* comment */
(ii) /* comment
(iii) II comment
(iv) */ comment */ [2]
Answer:
(i) /* comment */

ICSE 2014 Computer Applications Question Paper Solved for Class 10

(b) What is meant by a package? Name any two Java Application Programming Interface packages. [2]
Answer:
Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier, etc.

A Package can be defined as a grouping of related types(classes, interfaces, enumerations and annotations) providing access protection and name space management.

Java Application Programming Interface packages are – applet packages, graphics and GUI swing packages

(c) Name the primitive data type in Java that is:
(i) a 64 bit integer and is used when you need a range of values wider than those provided by int.
(ii) a single 16 bit Unicode character whose default value is ‘\u0000’. [2]
Answer:
(i) long
(ii) char

(d) State one difference between floating point literals float and double. [2]
Answer:

  • Float occupies 4 bytes in memory. Values are represented with approximately 7 decimal digits accuracy.
  • Double occupies 8 bytes in memory. Values are represented with approximately 17 decimal digits accuracy.

(e) Find the errors in the given program segment and re-write the statements correctly to assign values to an integer array.
int a = new int (5) ;
for(int i=0;i<–5; i++)
a[i]=i; [2]
Answer:
int a = new int (5) ;
//missing brackets and use of wrong brackets for(int i=0;i<=5; i++) ‘
//This will assign 6 elements instead of 5. a[i]=i;
Correct statements have been mentioned below-
int a [] = new int [5];
for(int i=0;i<=5;i++) a[i]=i;

Question 2.
(a) Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence. [2]
(i) &&
(ii) %
(iii) >=
(iv) ++
Answer:
Precedence from higher to lower is as follows
(i) ++
(ii) %
(iii) >=
(iv) &&

ICSE 2014 Computer Applications Question Paper Solved for Class 10

(b) Identify the statements listed below as assignment, increment, method invocation or object creation statements. [2]
(i) System, out.print In (‘Java “);
(ii) costPrice = 457.50;
(iii) Car hybrid = new CarQ;
(iv) petrolPrice++;
Answer:
(i) Method invocation
(ii) assignment
(iii) object creation
(iv) increment statement

(c) Give two differences between switch statement and if-else statement. [2]
Answer:
A switch statement is usually more compact than lots of nested if else and therefore, more readable.
In most languages, switch only accepts primitive types as key and constants as cases. In many languages, switch only accepts only some data types, if allows complex expressions in the condition while switch wants a constant. It accepts all data types.

(d) What is an infinite loop? Write an infinite loop statement. [2]
Answer:
An infinite loop is that loop which never ends. It happens when the loop condition is always evaluated as true.
public class InfiniteForLoop {
public static void main(String[] args) {
for(;;)
System.out.println(“Hello”);
}
}
Output would be
Hello
Hello
Hello
Hello
..
..

(e) What is a constructor? When is it invoked? [2]
Answer:
A java constructor has the same name as the name of the class to which it belongs. Constructor’s syntax does not include a return type, since constructors never return a value.
It is invoked using new operator.

ICSE 2014 Computer Applications Question Paper Solved for Class 10

Question 3.
(a) List the variables from those given below that are composite data types.
(i) static int x;
(ii) arr[i]=10;
(iii) obj.displayQ;
(iv) boolean b;
(v) private char chr;
(vi) String str; [2]
Answer:
(ii) and (iii) are composite data types.

(b) State the output of the following program segment.
Stringstr1 = “great”; Stringstr2=”minds”;
System.out.println(str 1 .substring(0, 2).concat(str2. substring(1)));
System, out.println((“WH” + (str1.substring(2). toUpperCaseO))); [2]
Answer:
grinds
WHEAT

(c) What are the final values stored in variables x and y below ? [2
double a = -6.35;
double b = 14.74;
double x = Math.abs(Math.ceil(a));
double y = Math.rint(Math.max(a,b));
Answer:
6.0
15.0

(d) Rewrite the following program segment using the if-else statements. String grade =(mark>=90)? “A” : (mark>=80)? “B” : “C”; [2]
Answer:
if (mark>=90){
grade = “A”;
}
else if (mark>=80) {
grade = “B”;
}
else
grade = “C”;

(e) Give output of the following method? [2]
public static void mainfString argsjj) {
int a = 5; .
a++;
System.out.println(a);
a -= (a-) – (-a);
System.out.println(a);}
Answer:
6
4

(f) What is the data type returned by the library functions? [2]
(i) compareTo()
(ii) equalsTo()
Answer:
(i) It can return 0, 1 and -1.
(ii) true or false

(g) State the value of characteristic and mantissa when the following code is executed. [2]
Strings = “4.3756”;
intn = s.indexOf(‘.’);
int characteristic = Integer.parselnt(s.substring(0, n));
int mantissa = Integer.valueOf(s.substring(n+1));
Answer:
3756

(h) Study the method and answer the given questions? public void sampleMethodQ {
for(int i = 0; i<3; i++)
{
for(intj=0; i<2;j++)
{
int number = (int)(Math.random()*10);
System.out.println(number);
}}}
Answer:
(i) The loop will execute infinitely.
(ii) Between 0 and 5.

ICSE 2014 Computer Applications Question Paper Solved for Class 10

(i) Consider the following class:
public class myClass {
public static int x=3, y=4;
public int a=2, b=3;}
(i) Name the variables for which each object of the class will have its own distinct copy.
(ii) Name the variables that are common to all objects of the class. [2]
Answer:
(i) x and y
(ii) a and b

(j) What will be the output when the following code segments are executed?
(i) Strings = “1001”;
int x = Integer.valueOf(s);
double y = Double.valueOffs);
System.out.println(“x= ” +x);
System.out.println(“y=” +y);
Answer:
0x = 1001
y = 1001.0

(ii) System.out.printlnf’The King said V’Begin at the beginning!\” to me.”); [2]
Answer:
The King said “Begin at the beginning!” to me.

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

Question 4.
Define a class 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:
1. movieMagic(): Default constructor to initialize numeric data members to 0 and String data member to ” “.
2. void accept(): To input and store year title and rating.
3. void displayf): To display the title of a movie and a message based on the rating as per the table.

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]
Answer:

import java.io.*;
class movieMagic {
private int year;
private String title;
private float rating;
movieMagic() {//constructor
year=0;
title= " ";
rating = 0.0f;
}
void accept() throws IOException{
BufFeredReader reader = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Enter the year::");
String y = reader.readLine();
System.out.println("Enter the title::");
title=reader.readLine();
System.out.println("Enter the rating::");
String i=reader.readLine();
rating = FloatparseFloat(r);
}
Void display() {
if (rating<0){
System.out.println("Wrong Input");
System.exit(0);
}
if(rating >=0 && rating <=2.0) {
System.out.println("Flop");
}
if(rating >= 2.1 && rating <= 3.4) {
System.outprintln("Semi-hit");
}
if(rating >= 3.5 && rating <= 4.5) {
System.out.println("Hit");
}
if(rating>=4.6 && rating <=5.0) {
System.outprintln("Super-Hit");
}
if (rating > 5.0){
System.outprintln("Wrong Input(range is 0 - 5)");
System.exit(0);
}
System.out.println("Title::" +title);
System.out.println("Rating::" +rating);
}
public static void main(String args[]) throws IOException {
movieMagic mgc = new movieMagic(); //creation of object mgc.display();
}
}

ICSE 2014 Computer Applications Question Paper Solved for Class 10

Question 5.
A special two-digit number is such that when the sum of the digits is added to the product of its digits, the result is equal to the original two-digit number
Example:
Consider the number 59.
Sum of digits = 5 + 9 = 14
Product of its digits = 5 × 9 = 45
Sum of the digits and product of digits = 14 + 45 = 59 .
Write a program to accept a two-digit, number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, output the message “special-two digit number” otherwise, output the message “Not a special two¬digit number”. [ 15]
Answer:

import java.io.*;
class DigitSum {
public static void main(String args[]) throws IOException {
int num,a=0, sum=0;
int prod=1;
int sumproduct=0;
InputStreamReader reader= new InputStream Reader(System.in);
BufferedReader input = new Buffered Reader(reader);
System.out.println("Enter the number::");
String x = inputreadLineO;
num = Integer.parselnt(x);
System.out.println("You Entered the Number = " +num);
if(num<10 || num>99) {
System.outprintln("Number should be two-digit number:");
}
else {
if( isSpecialTwoDigitNumber( num ) )
System.out.println( "Special two-digit number" );
else
System.outprintln( "Not a Special two-digit number" );
}
}
public static boolean isSpecialTwoDigitNumber (int num){
int first, second;
first = num /10;
second = num% 10;
return (first+second + first* second == num );
}
}

Question 6.
Write a program to assign a full path and file name as given below. Using library functions, extract and output the file path, file name and file extension separately as shown. [15]
Input:
C: \Users \adm in \Pictures \flowers.jpg
Output:
Path: C: \Users\admin \Pictures \
File name: flower
Extension: jpg
Answer:

import java.util.*;
class MyFile{
public static void main( String args[] ){
Scanner sc = new Scanner( System.in );
String fullPath, path, filename, extension;
System.outprintln("Enter full path: ");
fullPath = sc.nextLine();
int lastSlash, lastDot;
lastSlash = fullPath.lastIndexOf("\\");
lastDot = fullPath.lastIndexOf(".");
path = fullPath.substring(0, lastSlash + 1);
filename = fullPath.substring( IastSlash+1, lastDot);
extension = fullPath.substring( lastDot+ 1 );
System.out.println( "Path: " + path );
System.out.println( "File name: "+ filename);
System.out.println( "Extension: " + extension );
}
}

ICSE 2014 Computer Applications Question Paper Solved for Class 10

Question 7.
Design a class to overload a function area as follows:
1. double area (double a, double b, double c) with three double arguments, returns the area of a scalene triangle using the formula:
area = \(\sqrt{s(s-a)(s-b)(s-c)}\) where s
= \(\frac{a+b+c}{2}\)
2. double area( int a, int b, int height) with three integer arguments, returns the area of a trapezium using the
formula : area = \(\frac{1}{2}\) height (a+b)
3. double area( double diagonal 1, double diagonal ) with two double arguments, returns the area of a rhombus using the formula:
area = (diagonal1 × diagonal2) [15]
Answer:

import javado.*;
class FunctionOverloading {
void area(dou ble a, double b, double c){
System.out.println("Value of one side=" +a);
System.outprintln("Value of second side=" +b);
System.outprintln("Value of third side=" +c);
double s;
s=(a+b+c)/2;
double sarea = Math.sqrt(s*(s-a)* (s-b)*(s-c));
System.out.println("Area of the Scalene Triangle =" +sarea);
void area(int a, int b, int h) {
System.out.println("Second Parallel Side of the Trapezium-' +b);
System.out.println("Perpendicular (Distance) between two parallel sides-' +h);
int tarea = h*(a+b)/2;
System.outprintln("Area of Trapezium =" + tarea);
}
void area(double diagonal 1, double diagona12) {
System.outprintln("First Diagonal:" +diagonall);
System.outprintln("Second Diagonal:" +diagonal2);
double rarea = (diagonal 1 *diagonal2)/2;
System.out.println("Area of the Rhombus =" +rarea);
}
}

Question 8.
Using the switch statement, write a menu driven program to calculate the maturity amount of a Bank Deposit.
The user is given the following options:
1. Term Deposit ~
2. Recurring Deposit.
For option 1. accept principal(P), rate of interest(r) and time period in years(n). Calculate and output the maturity amount(A) receivable using the formula:
A = P\(\left[1+\frac{r}{100}\right]^n\)
For option 2. accept Monthly Installment(P), rate of interest(r) and time period in months(n). Calculate and output the maturity amount (A) receivable using the formula:
A = P × n + P × \(\frac{n(n+1)}{2} \times \frac{r}{100} \times \frac{1}{12}\)
For an incorrect option, an appropriate error message should be displayed.
Answer:

import java.io.*;
class BankDeposit {
public static void main(String aigs []) throws
IOException {
int ch;
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader (read);
System.ouLprintln(" 1. Term Deposit");
System.out.println("2. Recurring Deposit");
System.out.println("Enter your choice");
ch = Integer.parseInt(in.readLine( )); switch (ch){
case 1:
System.out.println("Principar);
double p = Integer.parselnt (in.read Line( ));
System.out.println("Rate of Interest");
double r = Integer.parselnt (in.read Line( ));
System.outiprintln("Time");
double t = Integer.parselnt (in.read Line( ));
double a= (p*Math.pow((1+r/100),t));
System.out.println(" Amount is= ₹" +a);
break;

case 2:
System.out.println("Principal");
double p1 = Integer.parselnt (in.read Line( ));
System.out.println("Rate of Interest");
double r1 = Integer.parselnt (in.read Line( ));
System.out.println("Time in months");
double n = Integer.parselnt (in.read Line( ));
double a1 = p1*n + p1*(n*(n + 1)/2)*r1/ 100*1/12;
System.out.println(" Amount is= ₹" +a1);
break;
default:
System.outprintln("Wrong choice");
}
}
}

ICSE 2014 Computer Applications Question Paper Solved for Class 10

Question 9.
Write a program to accept the year of graduation from school as an integer value from the user. Using the Binary Search technique on the sorted array of integers given below, output the message “Record exists” if the value of input is located in the array. If not, output the message “Record does not exist”.
{1982, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010} [15]
Answer:

import java.io.*;
class Graduation {
public static void main(String aig[]) throws IOException
{
BufferedReader br = new BufferedReader
(new InputStreamReader(System.in));
inta[] = {1982, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010};
System.out.println("Enter the element to search");
int find = Integer.parseInt(br.readLine());
int index = search(a, find);
if (index !=-l) {
System.out.println("Record exists:" +index);
}
else {
System.out.println("Record does not exist");
}
}
public static int search(int ar[], int find) {
int start = 0;
int end = ar. length - 1;
int mid;
while (start <= end) {
mid = (start + end) / 2;
if (ar[mid] = find) {
return mid;
}
else if (ar[mid] < find) { start = mid+1; } else if (ar[mid] > find) {
end = mid - 1;
}
}
return -1;
}
}