ICSE Class 10 Computer Applications ( Java ) 2015 Solved Question Paper

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

ICSE Question Paper – 2015 (Solved) Computer Applications Class X

SECTION A (40 Marks)

Answer all questions from this Section

 

Question 1.

(a) What are the default values of the primitive datatypes int and float? [2]
Ans. The default value of int is 0 and the default value of float is 0.0f.

(b) Name any two OOP’s principles. [2]
Ans. The OOPs principles are

Encapsulation
Abstraction
Polymorphism
Inheritance

(c) What are identifiers? [2]
Ans. Identifiers are names of variables, classes, packages, methods and packages in a java program.

(d) Identify the literals listed below: [2]
(i) 0.5 (ii)’A’ (iii) false (iv) “a”
Ans. (i) Floating point literal
(ii) Character literal
(iii) Boolean literal
(iv) String literal

(e) Name the wrapper class of char type and boolean type. [2]
Ans. The wrapper class of char type is Character and the wrapper type of boolean type is Boolean.

Question 2
(a) Evaluate the value of n if the value of p=5, q=19 [2]

Ans.

 

(b) Arrange the following primitive data types in an ascending order of their size: [2]
(i) char (ii) byte (iii) double (iv) int
Ans. The sizes of the given data types are as follows
char = 2 bytes
byte = 1 byte
double = 8 bytes
int = 4 bytes
Arranging them in ascending order gives byte < char < int < double

(c) What is the value stored in variable res given below: [2]

double res = Math.pow(“345”.indexOf(‘5’), 3);
Ans.

double res = Math.pow(“345”.indexOf(‘5’), 3);
= Math.pow(2, 3);
= 8.0
Answer is 8.0 instead of 8 as Math.pow returns a double and not an int.

(d) Name the two types of constructors. [2]
Ans. Default constructor and parameterized constructor.

(e) What are the values of a and b after the following function is executed, if the values passed are 30 and 50 : [2]

void paws(int a, int b) {
a = a + b;
b = a – b;
a = a – b;
System.out.println(a + ” , ” + b);
}
Ans.
q = 30, b = 50
a = a + b = 20 + 50 = 80
a = 80, b = 50
b = a – b = 80 – 50 = 30
a = 80, b = 30
a = a – b = 80 – 30 = 50
1 = 50, b = 30
System.out.println(a + ” , ” + b) will print
30 , 50

Question 3
(a) State the data type and the value of y after the following is executed : [2]

char x = ‘7’;
y = Character.isLetter(x);
Ans. Data type of y will be boolean and value will be false.

(b) What is the function of catch block in exception handling? Where does it appear in a program? [2]
Ans. catch batch catches the specified exception type and handles the same. It appears between try and finally block. Ex: In the following snippet, if code1 throws an Exception, code 2 will be executed.

 

c) State the output of the following program segment is executed: [2]

String a = “Smartphone”, b = “Graphic Art”;
String h = a.substring(2, 5);
String k = b.substring(8).toUpperCase();
System.out.println(h);
System.out.println(k.equalsIgnoreCase(h));
Ans.
String a = “Smartphone”, b = “Graphic Art”;

String h = a.substring(2, 5);
= “Smartphone”.substring(2, 5);
= art

String k = b.substring(8).toUpperCase();
= “Graphic Art”.substring(8).toUpperCase();
= Art.tpUpperCase()
= ART

System.out.println(h);
art

System.out.println(k.equalsIgnoreCase(h));
“ART”.equalsIgnoreCase(“art”)
true

The output will be
art
true

(d) The access specifier that gives most accessibility is __________ and the least accessibility is ___________ [2]
Ans. public, 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 [2]
Ans. (i) Math.sin()
(ii) trim()

(f)

(i)  What will the code print? [2]

(i) 0 (ii) value stored in arr[0] (iii) 0000 (iv) garbage value

Ans. Option (iv) garbage value – A random string will be printed. arr is an object. When an object is printed, the .toString() method is invoked which gives the hashcode of the object which will be a random value.

(ii) Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields
Ans. this keyword
Example

 

(g) State the package that contains the class : [2]
(i) BufferedReader
(ii) Scanner
Ans. (i) java.io
(ii) java.util

(h) Write the output of the following code segment: [2]

Ans. The do-while loop runs for values of x from 97 to 100 and prints the corresponding char values.
97 is the ASCII value for a, 98 is the ASCII value for 99…
So, the output will be
a b c d

(i) Write the Java expression for: a2+b2 /2ab [2]
Ans. (Math.pow(a, 2) + Math.pow(b, 2)) / (2 * a * b)

(j) If int y = 10 then find int z = (++y * (y++ + 5)); [2]
Ans. Increment operator has the highest precedence. So, ++y and y++ will be evaluated starting from left.
In ++y, the value of y will be incremented to 11 and then 11 will be used in the expression.
When y++ is evaluated, the current value of y i.e. 11 will be used and then y will be incremented from 11 to 12.

int z = (++y * (y++ + 5));
= 11 * (11 + 5 )
= 11 * 16
= 176

SECTION B (60 Marks)
Attempt any four questions from this Section.

The answers in this section should consist of the programs in either BlueJ environment or any program environment with Java as the base. Each program should be written using Variable descriptions/Mneumonic codes so that the logic of the program is clearly depicted. Flow-charts and algorithms are not required.

Question 4.

Define a class ParkingLot with the following description:
Instance variables/data members:
int vno – To store the vehicle number
int hours – To store the number of hours the vehicle is parked in the parking lot
double bill – To store the bill amount
Member methods:
void input() – To input and store vno and hours
void calculate() – To compute the parking charge at the rate of Rs.3 for the first hour or part thereof, and Rs.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 [15]

Ans.

 

Sample Output

Enter vehicle number: 34
Enter hours: 4
Vehicle number: 34
Hours: 4
Bill: Rs. 7.5

Question 5

Write two separate programs to generate the following patterns using iteration(loop) statements: [15]
(a)

*
* #
* # *
* # * #
* # * # *

(b)
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5

Ans.
(a)

Sample output:1
Enter n: 5

*
* #
* # *
* # * #
* # * # *

(b)

 

Sample output

Enter n: 5

5 4 3 2 1
5 4 3 2
5 4 3
5 4
5

Question 6

Write a program in to input and store all 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: [15]

Average marks = total marks/3

AVERAGE MARKS REMARK
85 – 100 EXCELLENT
75 – 84 DISTINCTION
60 – 74 FIRST CLASS
40 – 59 PASS
Less than 40 POOR
Ans.

Sample output

Enter number of students: 2
Student 1
Enter roll number: 1
Enter name: Kittu
Enter marks in subject 1: 90
Enter marks in subject 2: 100
Enter marks in subject 3: 95
Student 2
Enter roll number: 2
Enter name: Bittu
Enter marks in subject 1: 90
Enter marks in subject 2: 85
Enter marks in subject 3: 100
Roll number = 1, Name = Kittu
EXCELLENT
Roll number = 2, Name = Bittu
EXCELLENT

Question 7

Design a class to overload a function Joystring() as follows: [15]
(i) void Joystring(String s, char ch1, char ch2) with one string 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”

(ii) 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 = “Cloud computing means Internet based computing”
First Index : 5
Last Index : 36

(iii) 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”
s2 = “GAMES”
Output : “COMMON WEALTH GAMES”
(use library functions)

Ans.

 

Sample output

Enter string: TECHNALAGY
Enter ch1: A
Enter ch2: O
Output = TECHNOLOGY
Enter string: Cloud computing means Internet based computing
First index of space = 5
Last index of space = 36
Enter s1: COMMON WEALTH
Enter s2: GAMES
Output = COMMON WEALTH GAMES

Question 8

Write a program to input twenty names in an array. Arrange these names in descending order of alphabets , using the bubble sort technique. [15]

Ans.

Sample output

Enter 20 names
Ram
Arjun
Tarun
Karthik
Sweety
Shalini
Priya
Archana
Shweta
Shiva
Sita
Krishna
Savitri
Hema
Siddharth
Nani
Sachin
Kittu
Bittu
Akhil
Sorted names:
Akhil
Archana
Arjun
Bittu
Hema
Karthik
Kittu
Krishna
Nani
Priya
Ram
Sachin
Savitri
Shalini
Shiva
Shweta
Siddharth
Sita
Sweety
Tarun

Question 9

Use switch statement,write a menu driven program to: [15]

(i) To find and display all the factors of a number input by the user (including 1 and excluding number itself.)
Example :
Sample Input : n = 15.
Sample Output : 1, 3, 5

(ii) To find and display the factorial of a number input by the user. The factorial of a non-negative integer n ,denoted by n!,is the product of all integers less than or equal to n.
Example :
Sample Input : n = 5
Sample Output : 120.

For an incorrect choice, an appropriate error message should be displayed.

Ans.

 

Sample output 1

1. Factors
2. Factorial
Enter your choice: 1
Enter n: 15
1
3
5

Sample output 2

1. Factors
2. Factorial
Enter your choice: 2
Enter n: 5
Factorial: 120

Sample output 3

1. Factors
2. Factorial
Enter your choice: 3
Invalid choice

ICSE Class 10 Computer Applications 2015 Solved Question Paper

Editorial Staff

Editorial Staff at TCA is a team of Programmers led by Shubham Tripathi. Trusted by over 100K readers worldwide

    See all posts by shubham

    Leave a Reply

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