Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views5 pages

Icse Pretest 3

This document is a pretest paper for ICSE Computer Applications from 2015, consisting of two sections: Section A with theoretical questions and Section B requiring programming tasks. Section A includes questions on Java concepts, constructors, wrapper classes, and methods, while Section B contains practical programming problems such as checking for DISARIUM and DUCK numbers, calculating ticket discounts, capitalizing words in a sentence, and counting word frequency. Students are instructed to attempt all questions in Section A and any four from Section B.

Uploaded by

ishmitsinghania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Icse Pretest 3

This document is a pretest paper for ICSE Computer Applications from 2015, consisting of two sections: Section A with theoretical questions and Section B requiring programming tasks. Section A includes questions on Java concepts, constructors, wrapper classes, and methods, while Section B contains practical programming problems such as checking for DISARIUM and DUCK numbers, calculating ticket discounts, capitalizing words in a sentence, and counting word frequency. Students are instructed to attempt all questions in Section A and any four from Section B.

Uploaded by

ishmitsinghania
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

COMPUTER APPLICATION

ICSE-PRETEST 3
2015

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 [ ].

SECTION A (40 Marks)

Attempt all questions

Question 1.

(a) Define this keyword. What is its significance? [2]


(b) State the Java concept that is implemented through:

(i) dividing a long set of instructions into smaller groups/modules

(ii) the wrapping up of data and its associated function into a class. [2]
(c) Differentiate between parameterized and non-parameterized constructor. [2]
(d) What are wrapper classes? Give an example. [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) Name the Java keyword that:


(i) indicates that a method has no return type.
(ii) converts a variable into a constant. [2]
(b) What is polymorphism? How does function overloading implement polymorphism? [2]
(c) Explain: " Objects encapsulate characteristics and behaviour" [2]
(d) What is the difference between a pure and mixed expression. [2]
(e) Explain the use of the below given functions:
(i) trim()
(ii) isWhitespace() [2]
COMPUTER APPLICATION
ICSE-PRETEST 3
2015

Question 3.

(a) Write correctly the following statement:

String S = ["A", "E", "I", "O", "U"]; [2]

(b) What is the need of type-casting? [2]

(c) Write a Java statement to:


(i) create an object mp3 of class Music
(ii) import all the classes of the package named simple [2]
(d) What will the following functions return when executed:
(i) Math.max (-7, Math.min(-2, -9))
(ii) Math.ceil (32.17) [2]
(e) State the output of System.out.println("Java".length() + "For School".length()). [2]

Question 4.

(a) State the output of the following program segment: [2]


class Today {
static int a;
char b;
void input() {
a = 20;
b = 'Z';
}
void convert() {
char c = (char)(a+b);
System.out.println(c);
}
public static void main() {
Today t = new Today();
t.input();
t.convert();
}
}

(b) Based on the above given piece of code, answer the questions which follow: (i)
Name the instance, class and local variables.
(ii) What is the name of the constructor of the above class?
(iii) Explain the line: Today t = new Today(); [3]
(c) 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++]); (ii) System.out.println(arr[b]++); [2]
COMPUTER APPLICATION
ICSE-PRETEST 3
2015

(d) Write a Java expression: [2]

(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' [1]

SECTION B (60 Marks)


Attempt any four questions from this Section.
The answers in this Section should consist of the Programs in either Blue J
environment or any program environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonic Codes
such that the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.

Question 5. [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 Rate of ticket (per person)
America Rs. 50000.0
Singapore Rs. 20000.0 Japan Rs. 40000.0 Thailand
Rs. 30000.0
The discount will be given as per the given criteria:
Ticket Amount Discount on Total amount
Above Rs. 200000 25%
Rs. 150001 to Rs. 200000 20% Rs. 100001 to
Rs. 150000 15% Less than Rs. 100000 10%
COMPUTER APPLICATION
ICSE-PRETEST 3
2015
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.

Question 7. [15]

Write a Java program to input a sentence from the user in lowercase and capitalize the first and the last
characters of every word in it.
Sample Input : i love java for school.
Sample Ouptut : I LovE JavA FoR SchooL
Some of the data members and member functions are given below:
Class name : Capitalize
Data members/instance variables:
sent : stores the sentence
cap : to store the new sentence
size : stores the length of the sentence
Member functions:
Capitalize() : default constructor
void readsentence() : to accept the sentence
void capfirstlast() : extract each word and capitalize the first and the last alphabet of the word
and form a new sentence 'rev' using the changed words
void display() : 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 : Enter a sentence : To be or not to be
Enter a word to be searched : be
Sample Ouptut : Frequency of searched word : 2
COMPUTER APPLICATION
ICSE-PRETEST 3
2015

You might also like