Cps+X-Computer+Applications-I-Prep
Cps+X-Computer+Applications-I-Prep
J.P.Nagar, Bengaluru – 78
FIRST PREPARATORY EXAMINATION 2024 – 25
SUBJECT: COMPUTER APPLICATIONS MAXIMUM MARKS: 100
STD: X ICSE TIME: 2hrs
DATE: 13/12/2024
Total Number of Questions:8 Total Number of Pages: 8
1
(iii) Method prototype for the method calculate which accepts two integer arguments and
returns a double value.
(a) public void calculate (int a, int b) (b) public double calculate (int a; int b)
(c) public double calculate (int a, int b) (d) public double calc (int a, int b)
(iv) Assertion (A): Members of a class can be accessed ONLY within the class.
Reason (R): It is a package level access.
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct
explanation of Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct
explanation of Assertion (A)
(c) Assertion (A) is true and Reason (R) is false
(d) Assertion (A) is false and Reason (R) is true
(v) Constructor returns _________ value(s).
(a) 0 (b) 1 (c) 2 (d) More than 2
(vi) What is the output produced by the following statement?
System.out.println (Math.round (Math.max (12.5, 13.4)));
(a) 14.0 (b) 14 (c) 13.0 (d) 13
(vii) The number of bytes occupied by a character array of size 40 is:
(a) 40 bytes (b) 80 bytes (c) 160 bytes (d) 20 bytes
(viii) Output of "CONFIDENT”. equals ("confident") is:
(a) false (b) 0 (c) true (d) 1
(ix) Name the type of error in the given code:
if (selling_price>cost_price)
System.out.println ("Loss");
else if (selling_price<cost_price)
System.out.println ("Profit");
else
System.out.println ("Neither profit nor loss");
(a) runtime (b) syntax (c) logical (d) no error
(x) Operator used to access the members of a class:
(a) new (b) ?: (c) + (d) . (dot)
(xi) Variable which maintains independent copy in every object is:
(a) instance (b) class (c) local (d) argument
2
(xii) Java statement to create an object chair of class furniture is:
(a) chair furniture = new chair(); (b) furniture chair = new furniture();
(c) furniture chair = new chair (); (d) new chair = furniture ();
(xiii) Predict the output:
int x=15; double y=14.5;
System.out.println (Integer.toString (x) + String.valueOf(y));
(a) 1514 (b) 14.515 (c) 1514.5 (d) 29.5
(xiv) Variable that is declared in the method block is:
(a) local (b) instance (c) static (d) argument
(xv) Identify the length (size) of an array given below:
int a[][] ={{4,2,1},{5,2},{1}};
(a) 6 (b) 3 (c) 12 (d) 24
(xvi) Method that returns part of a string is:
(a) charAt(int) (b) replace (char, char) (c) trim () (d) substring (int)
(xvii) "Actions speak louder than words"
true
14.78
Name the tokens in order from top, given in the above picture
(a) double, boolean, String (b) double, String, boolean
(c) String, boolean, double (d) String, String, double
(xviii) Assertion (A): an array is used to group different types of values.
Reason (R): it is a primitive data type.
(a) Both Assertion (A) and Reason (R) are true
4
(vii) Name the following:- [2]
(a) The search key element is compared with every element of an array from 0th index
position.
(b) Method that stops the execution of a java program at any stage.
(viii) How many times the following loop execute? Write the output of the code: [2]
int a=10;
while (true)
{
System.out.println (a);
if (a==1000)
break;
a=a*10;
}
(ix) Predict the output of the following code snippet: [2]
double x=1.234; String y="11";
System.out.println (String.valueOf (x).length ());
System.out.println (y.charAt (0) + 5);
(x) A student is trying to execute the following code to print double digit integers from an
array x[]. However he is getting an error. Identify whether it is a syntax/logical/runtime error
and also correct the code to get the desired output. [2]
public void doubleDigits (int x[])
{
for (int i=0;i<=x.length;i++)
{
if(x[i]>=10 && x[i]<=99)
System.out.println (x[i]);
}
}
SECTION B
(Answer 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 description/mnemonic codes so that the logic
of the program is clearly depicted.
Flowcharts and algorithms are not required.
5
Question 3 [15]
Define a class with the following specifications:-
Class Name:- Sales
Instance variables:-
String n – customer’s name
int qty – number of computers purchased
int years – number of years with the dealer
double bill – amount to be paid
Member methods:-
void input () – accept details for n, qty and years
void calculate () – find the bill amount based on the following criteria:
Number of computers purchased Price per computer
Less than 20 `35,000/-
20 to 39 `31,000/-
40 or more `29,000/-
A customer gets a further 10% discount on the bill, if he deals with the dealer for more than 5
years.
void display () – print the customer’s name, qty, years and bill.
Write a main() method to create an object and call the above member methods.
Question 4 [15]
Define a class to accept n number of words in a single dimensional array. Arrange the words
in reverse alphabetical order using bubble sort technique. Display the sorted array.
Question 5 [15]
Define a class to accept a number and check whether it is a super number or not. A number is
called super when the sum of its digit raised to the power of their respective positions is
equal to the number itself.
Example: