Computer Applications ICSE Sample Paper 6
Computer Applications ICSE Sample Paper 6
Computer Applications ICSE Sample Paper 6
SAMPLE PAPER 6
COMPUTER APPLICATIONS
(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 [ ].
[2]
(i)
(ii)
[2]
(c)
[2]
(d)
[2]
(e)
Write statements to show how finding the length of a character array ch[] differs
from finding the length of a String object str.
[2]
Question 2.
(a)
(ii)
[2]
(b)
[2]
(c)
[2]
(d)
(e)
[2]
(i)
trim()
(ii)
isWhitespace()
[2]
www.javaforschool.com
Turn over
SAMPLE PAPER 6
[2]
(b)
[2]
(c)
(d)
(e)
(i)
(ii)
[2]
(ii)
Math.ceil (32.17)
[2]
[2]
Question 4.
(a)
(b)
Based on the above given piece of code, answer the questions which follow:
(i)
(ii)
(iii)
(c)
[2]
[3]
Given a character array: char arr[] = {'J', 'A', 'V', 'A'}; and an integer: int b = 2;
What will be the output of the below statements if they are executed one after the other:
(i)
System.out.println(arr[b++]);
x=
(ii)
System.out.println(arr[b]++);
(d)
(e)
Write the prototype of a function which takes in 2 integer and 1 String arguments, and
returns a value which is either 'true' or 'false'
[2]
[2]
[1]
2
TSP006
www.javaforschool.com
SAMPLE PAPER 6
[15]
Write a menu driven program in Java to input a number and check whether it is a:
(a)
DISARIUM number or not
(b)
DUCK number or not
Note:
DISARIUM: A number will be called DISARIUM if sum of its digits powered with their respective
position is equal to the original number.
For example 135 is a DISARIUM
(Workings 11+32+52 = 135, some other DISARIUM are 89, 175, 518 etc)
DUCK:
A Duck number is a number which has zeroes present in it, but there should be no
zero present in the beginning of the number.
For example 3210, 7056, 8430709 are all Duck numbers whereas 08237 is not.
Question 6.
[15]
An airlines announces discount on tickets depending upon destination chosen by the passenger from
the following:
Destination
America
Singapore
Japan
Thailand
Write a Java program to input name of the passenger/group head (in case of more than 1 passengers),
number of passengers and destination code viz: A or a for America, S or s for Singapore, J or j for
Japan, and T or t for Thailand.
Calculate the total ticket amount and discount amount. Find the net balance to be paid excluding the
discount. Print name, number of passengers, destination code, discount and total ticket amount to be
paid.
3
TSP006
www.javaforschool.com
Turn over
SAMPLE PAPER 6
:
:
:
Member functions:
Capitalize()
:
void readsentence() :
void capfirstlast()
:
void display()
default constructor
to accept the sentence
extract each word and capitalize the first and the last alphabet of the word
and form a new sentence 'rev' using the changed words
display the original sentence along with the new changed sentence.
Specify the class Capitalize giving details of the constructor Capitalize (), void readsentence(), void
capfirstlast() and void display(). Define the main() function to create an object and call the function
accordingly to enable the task.
Question 8.
[15]
Write a Java program to input a sentence. Count the number of times a particular word occurs in it.
Display the frequency of the search word.
Sample Input
Sample Ouptut
Enter a sentence
Enter a word to be searched
Frequency of searched word
:
:
:
To be or not to be
be
2
Question 9.
[15]
double series(double n) with one double argument and returns the sum of the series,
S=1+
(ii)
1 1
1
+ + +
2! 3!
n!
double series(double x, double n) with two double arguments and returns the sum
of the series,
S=
x x
x
x
+ + + +
1 4
9
n
Question 10.
[15]
Write a program to input two integer arrays A[] and B[] of m and n sizes respectively. Create a
third array C[] by merging the array A[] followed by the array B[].
Sample Input
Sample Output
:
:
4
TSP006
www.javaforschool.com