Solved 2015 Question Paper ICSE Class 10 Computer Applications
Solved 2015 Question Paper ICSE Class 10 Computer Applications
Section A
Question 1
(a) What are the default values of the primitive data type int and float?
Answer
Answer
1. Encapsulation
2. Inheritance
Answer
Identifiers are symbolic names given to different parts of a program such as variables,
methods, classes, objects, etc.
Answer
1. Real Literal
2. Character Literal
3. Boolean Literal
4. String Literal
(e) Name the wrapper classes of char type and boolean type.
Answer
Question 2
Answer
Final value of n is 14
(b) Arrange the following primitive data types in an ascending order of their size:
Answer
Answer
Answer
(e) What are the values of a and b after the following function is executed, if the values
passed are 30 and 50:
50,30
Question 3
(a) State the data type and value of y after the following is executed:
char x='7';
y=Character.isLetter(x);
Answer
Data type of y is boolean and value is false. Character.isLetter() method checks if its
argument is a letter or not and as 7 is a number not a letter hence it returns false.
(b) What is the function of catch block in exception handling ? Where does it appear in
a program ?
Answer
Catch block contains statements that we want to execute in case an exception is thrown in the
try block. Catch block appears immediately after the try block in a program.
(c) State the output when the following program segment is executed:
art
true
Explanation
a.substring(2, 5) extracts the characters of string a starting from index 2 till index 4. So h
contains the string "art". b.substring(8) extracts characters of b from index 8 till the end so it
returns "Art". toUpperCase() converts it into uppercase. Thus string "ART" gets assigned to
k. Values of h and k are "art" and "ART", respectively. As both h and k differ in case only
hence equalsIgnoreCase returns true.
(d) The access specifier that gives the most accessibility is ________ and the least
accessibility is ________.
Answer
The access specifier that gives the most accessibility is public and the least accessibility
is private.
(e) (i) Name the mathematical function which is used to find sine of an angle given in
radians.
(ii) Name a string function which removes the blank spaces provided in the prefix and
suffix of a string.
Answer
1. 0
2. value stored in arr[0]
3. 0000
4. garbage value
Answer
(ii) Name the keyword which is used- to resolve the conflict between method parameter
and instance variables/fields.
Answer
this keyword
1. BufferedReader
2. Scanner
Answer
1. java.io
2. java.util
char ch ;
int x=97;
do
{
ch=(char)x;
System.out.print(ch + " " );
if(x%10 == 0)
break;
++x;
} while(x<=100);
Answer
The output of the above code is:
a b c d
Explanation
Outpu
x ch Remarks
t
97 a a 1st Iteration
98 b ab 2nd Iteration
4th Iteration — As x%10 becomes true, break statement is executed and exists the
100 d abcd
loop.
a2+b22ab2aba2+b2
Answer
(a * a + b * b) / (2 * a * b)
Answer
⇒ z = (11 * 16)
⇒ z = 176
Section B
Question 4
Member Methods:
void input() — To input and store the vno and hours.
void calculate() — To compute the parking charge at the rate of ₹3 for the first hour or part
thereof, and ₹1.50 for each additional hour or part thereof.
void display() — To display the detail.
Write a main() method to create an object of the class and call the above methods.
Answer
import java.util.Scanner;
Output
Question 5
Write two separate programs to generate the following patterns using iteration (loop)
statements:
(a)
*
* #
* # *
* # * #
* # * # *
(b)
54321
5432
543
54
5
Answer
Output
Output
Question 6
Write a program to input and store roll numbers, names and marks in 3 subjects of n number
of students in five single dimensional arrays and display the remark based on average marks
as given below:
85 — 100 Excellent
75 — 84 Distinction
60 — 74 First Class
40 — 59 Pass
Average Marks Remark
Answer
import java.util.Scanner;
System.out.println("Roll No\tName\tRemark");
for (int i = 0; i < n; i++) {
String remark;
if (avg[i] < 40)
remark = "Poor";
else if (avg[i] < 60)
remark = "Pass";
else if (avg[i] < 75)
remark = "First Class";
else if (avg[i] < 85)
remark = "Distinction";
else
remark = "Excellent";
System.out.println(rollNo[i] + "\t"
+ name[i] + "\t"
+ remark);
}
}
}
Output
Question 7
1. void Joystring(String s, char ch1, char ch2) with one string argument and two
character arguments that replaces the character argument ch1 with the character
argument ch2 in the given String s and prints the new string.
Example:
Input value of s = "TECHNALAGY"
ch1 = 'A'
ch2 = 'O'
Output: "TECHNOLOGY"
2. void Joystring(String s) with one string argument that prints the position of the first
space and the last space of the given String s.
Example:
Input value of s = "Cloud computing means Internet based computing"
Output:
First index: 5
Last Index: 36
3. void Joystring(String s1, String s2) with two string arguments that combines the two
strings with a space between them and prints the resultant string.
Example:
Input value of s1 = "COMMON WEALTH"
Input value of s2 = "GAMES"
Output: COMMON WEALTH GAMES
Answer
Output
Question 8
Write a program to input twenty names in an array. Arrange these names in descending order
of letters, using the bubble sort technique.
Answer
import java.util.Scanner;
//Bubble Sort
for (int i = 0; i < names.length - 1; i++) {
for (int j = 0; j < names.length - 1 - i; j++) {
if (names[j].compareToIgnoreCase(names[j + 1])
< 0) {
String temp = names[j + 1];
names[j + 1] = names[j];
names[j] = temp;
}
}
}
System.out.println("\nSorted Names");
for (int i = 0; i < names.length; i++) {
System.out.println(names[i]);
}
}
}
Output
Question 9
Answer
import java.util.Scanner;
switch (choice) {
case 1:
System.out.print("Enter number: ");
num = in.nextInt();
for (int i = 1; i < num; i++) {
if (num % i == 0) {
System.out.print(i + " ");
}
}
System.out.println();
break;
case 2:
System.out.print("Enter number: ");
num = in.nextInt();
int f = 1;
for (int i = 1; i <= num; i++)
f *= i;
System.out.println("Factorial = " + f);
break;
default:
System.out.println("Incorrect Choice");
break;
}
}
}
Output