You are on page 1of 5

No of pages: 05 No.

Of Questions-09
CLARENCE PUBLIC SCHOOL
J. P. NAGAR, BENGALURU – 78.
FIRST PREPARATORY EXAMINATION FEBRUARY -2021
COMPUTER APPLICATIONS – X-ICSE
Maximum Marks: 100
Reading Time: 09:45am – 10:00am
Writing Time: 10:00am – 12:00noon
Uploading Time: 12:00noon –12:30pm
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 the term Object with a real world example. [2]
(b) Mention the size of the following in terms of bytes. [2]
(1) String ext=".org";
(2) long mobno [ ] = new long [5];
(c) Write one point difference between if and if else statements. [2]
(d) Re-write the following using for-loop. [2]
while (true)
System.out.println ("Non-stop");
(e) Name the following: - [2]
(1) Java keyword that makes the variable as constant.
(2) Java method (function) that reads 64-bits integer from the Scanner object.

1
Question 2
(a) What is the difference between function overloading and constructor overloading? [2]
(b) Mention the return data type of the following library methods:- [2]
(1) Character.isWhitespace (char)
(2) Math. max (char, char)
(c) What is an array? Mention the two types of arrays. [2]
(d) What is Unboxing? Give an example. [2]
(e) Complete the following:- [2]
(1) 'A' + 5 = ____________.
(2) "I" + 'C' = __________.
Question 3
(a) Write a Java expression for the following:- [2]
√|𝒂𝟐 − 𝒃𝟐 |
(b) What are the final values of m and n after evaluating the following expression if m=3 and
n=5 initially? [2]
m*=++m + --n +m--;
(c) Write a function prototype for the function tickets_booking which accepts one String
argument and two integer arguments. [2]
(d) Write the output for the following:- [2]
String s1="Indian Space Research Organisation";
System.out.println (s1. substring (0, 6). toUpperCase ( ));
System.out.println ("KOTAK". compareTo ("KODAK"));
(e) Give the output of the following program segment and mention how many times the loop
will execute: [2]
int x=20202019;
while (x>0)
{
System.out.println (x%10000);
x=x/10000;
}

2
(f) Convert the following ternary expression into if else: [2]
int revised= experience <=5 ? salary + 5000 : salary + 7500;
System.out.println (revised);
(g) Give the output of the following:- [2]
System.out.println (Integer. parseInt ("100") % (12/4));
System.out.println (Math. ceil (4.55) + Math. pow (1, 0));
(h) Write Java statements for the following:- [2]
(1) To create an object red of class Rainbow.
(2) To convert the integer x to String form.
(i) Give the output of the following:- [2]
String tech [ ] = {"Bluetooth", "Broadband", "Phishing", "Resolution", "Protocol"};
System.out.println (tech. length + tech [2]. length ( ));
System.out.println (tech [0]. substring (4));
(j) Give an example for each of the following: [2]
(1) java library package
(2) Wrapper class
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 so that the
logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.
Question 4 [15]
Define a class Courier having the following description:-
Data Members/Instance Variables:
int weight - stores the weight of parcel
String type - stores the type of mail (Ordinary/Express)
double charges - stores the amount to be paid
Member methods:-
(i) Courier ( ) - default constructor to initialize default values to data members.
3
(ii) void accept ( ) - Accept data for weight and type using Scanner class.
(iii) void compute ( ) – calculate the charges as per the given criteria.

Weight of parcel Charges on Ordinary mail Charges on Express mail


(in gms)
Up to 100 gms `50 [fixed] `80 [fixed]

101 to 500 gms `40 per 100 gms `70 per 100 gms

501 and above `35 per 100 gms `65 per 100 gms

(iv) void display ( ) – display the weight, type and charges in different lines.
Write a main ( ) method to create an object and call the above member methods.
Question 5 [15]
Write a program to input 45 students’ Mathematics marks in an integer array and arrange the
marks from highest to least using Bubble Sort technique. Display the sorted array.
Question 6 [15]
Design a class to overload the function calculate ( ) as follows:-
(a) public void calculate (int x, int y, int z) – which accepts three integer arguments (x, y and
z). Check whether the product of x, y and z is EVEN or ODD.
(b) public void calculate (int x, char ch) – which accepts one integer argument x and one
character argument ch. Find and display the square root value of x if ch is 's' otherwise find
and display the cube root value of x.
(c) public int calculate (int x) – which accepts one integer argument x. It returns the first two
digits of x, if x is a 4-digit number, otherwise it returns only the last digit of x.
Write a main ( ) method to create an object and call the above member functions.
Question 7 [15]
Write a program to input a number and display each digit in WORDS.
Examples:
(1) Input: 126
Output: SIX TWO ONE
(2) Input: 340
Output: ZERO FOUR THREE
4
Question 8 [15]
Using switch statement, write a menu driven program to
1. SumSeries
2. Pattern
1 1 1 1
For (1) find and display the sum of the series: 𝑆𝑢𝑚 = − + − … … … … . . n terms.
1 3 5 7
Where n is to be input by the user.

For (2) display the following pattern


$ ? $ ? $
$ ? $ ?
$ ? $
$ ?
$
Display appropriate error message for an incorrect choice.

Question 9 [15]
Write a program to input 50 movie titles, their year of release and the rating in 3 different
single dimensional arrays. Display the movie titles along with the rating whose year of release
is in the range 2014 to 2018. Display the output in the following manner.
Sl.No Movie Title Rating
--- --- ---
________________

You might also like