Computer Applications ICSE Sample Paper 2 PDF
Computer Applications ICSE Sample Paper 2 PDF
(Theory)
(Two hours)
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for writing the answers.
This Paper is divided into two Sections.
Attempt all questions from Section A and any four questions from Section B.
The intended marks for questions or parts of questions are given in brackets [ ].
(e)
What is JVM?
What are Unary and Binary Operators? Give examples of each.
What is an Infinite loop? Write an example of it using for-loop.
What will be the result of the following if n = 3.5
(i)
Math.ceil(n)
(ii)
Math.round(n)
(iii)
Math.floor(n)
If x = 6, y = 4 and z = 2.3, evaluate u and v after executing successively (i) and (ii):
(i)
u = x + y / z;
(ii)
v = (x++)*z + x;
[2]
[2]
[2]
[2]
[2]
Question 2.
(a)
[3]
(b)
(c)
What is exception handling? Name any one way in which Java handles exceptions.
Which part of a function declaration differentiates between overloaded functions?
[2]
[2]
www.javaforschool.com
Turn over
(d)
(e)
[2]
[1]
Question 3.
(a)
(b)
(c)
Write a for loop statement that initializes a loop variable k as 100, decrements it by 1 in
every pass and executes the loop body infinite no. of times.?
Give the output in the following function and also write what mathematical operation it
carries out if value of n = 10:
void test1(int n)
{
for(int i=1; i< = n; i++)
{
System.out.println (++i);
}
}
(d)
[1]
[2]
Question 4.
(a)
Fill in the blank numbers from ?1? to ?5? in the following program that attempts to sort an
array A[ ] of 15 integers in descending order using the Bubble sort technique:
[5]
void BubbleSort ( int a[ ] )
{
int t = __?1?__ ;
for(int i = 0 ; i < __?2?__ ; i++)
{
for(int j = 0 ; j < __?3?__ ; j++)
{
if(____?4?____)
{
t = a[j];
___?5?___
a[j+1] = t;
}
}
}
}
2
TSP 002
www.javaforschool.com
(b)
(c)
[2]
[3]
class Academic
{
int x,y;
void access( )
{
int a,b;
Academic student = new Academic( );
System.out.println(Object created);
}
}
(i) What is the object name of class Academic?
(ii) Name the class variable used in this program.
(iii) Write the local variable used in this program.
Question 5.
Create a class SalaryCalculation that is described as below:
Class Name
: SalaryCalculation
Data members
Member methods
(i) SalaryCalculation( )
TSP 002
www.javaforschool.com
Turn over
Write a program in Java to calculate all the details mentioned above and print them all.
[15]
Question 6.
Write a program to accept a string. Convert the string to uppercase. Count and output the
number of Consecutive letter pairs that exist in the string.
Sample Input:
[15]
Question 7.
Using the switch statement, write a menu driven program to:
(i)
(ii)
[15]
Question 8.
Design a class to overload a function print ( ) as follows:
[15]
(a) void print (int x, int y) to print the odd numbers between the x and y.
(b) void print (char ch1, char ch2) to print all the consonants between the 2 characters ch1 & ch2.
(c) void print (char ch, int n) to print the character ch, n number of times in the given format:
Example: If ch = $ and n = 4
Output:
$$$$
$$$
$$
$
4
TSP 002
www.javaforschool.com
Question 9.
Write a program in Java to input a number from the user and print the frequency of each digits present
in it.
Example:
Input
43457973
Output
Digit
4
3
5
7
9
Frequency
2
2
1
2
1
[Note: Only those digits should be printed which are present in the number]
[15]
Question 10.
Write a program in Java to accept the name and weight of 20 of your friends. Store the weight
in a double type array weight [ ] and the name in a String type array name [ ]. Then sort the
name of your friends in ascending order of their weights and finally print the result.
[15]
TSP 002
www.javaforschool.com
Turn over