First Prep QP-X-CTA

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

CLARENCE PUBLIC SCHOOL

J. P. NAGAR, BANGALORE – 78.


FIRST PREPARATORY EXAMINATION DECEMBER- 2023
CLASS: X ICSE SUBJECT: COMPUTER APPLICATIONS
TIME: 2 hrs DATE: 21-12-2023 MARKS : 100
Total no. of questions: 08 No. of pages: 06

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 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
(Attempt all questions from this Section)
Question 1 [20]
Choose the correct answers to the questions from the given options:
(Do not copy the question, write the correct answers only.)
(i)

Name the feature of Java depicted in the above picture.


(a) Encapsulation (b) Inheritance (c) Abstraction (d) Polymorphism
(ii) _________ operator compares two operands and returns a boolean value.
(a) <= (b) = (c) + (d) . (dot)
(iii) _______ is a multi-way branch selection statement.
(a) if else (b) if else if (c) switch (d) if
(iv) Method of wrapper class that converts a numerical string to int value is _________.
(a) toInteger ( ) (b) parseInt ( ) (c) parseInteger ( ) (d) ParseINTEGER ( )
(v) The number of bytes occupied by an integer array of 10 elements is ______.
(a) 10 bytes (b) 20 bytes (c) 40 bytes (d) 60 bytes
(vi) The method of Scanner class used to accept a character is ________.
(a) next ( ) (b) next ( ).charAt (0) (c) nextLine ( ) (d) nextChar ( )
(vii) Java keyword that makes the variable as constant is _______.
(a) const (b) Final (c) final (d) int
1
(viii) The output of Math.pow (9, 0.5) + Math.abs (-3.8) is _______.
(a) 4.8 (b) 0.8 (c) 7.0 (d) 6.8
(ix) Name the type of error if any in the following statement.
int x=4.4;
System.out.println (x);
(a) logical (b) syntax (c) runtime (d) no error
nd
(x) Java statement to access the 2 element of an array is _________.
(a) a[2] (b) a[3] (c) a[1] (d) a[0]
(xi) The output of "ICSE". compareTo ("CBSE") is ________.
(a) false (b) -6 (c) 6.0 (d) 6
(xii) Which of the following is valid array declaration ?
(a) int a[]=new int[5]; (b) a[] int=new a[5]; (c) int a[5]; (d) none
(xiii) Name the package that contains Double class.
(a) java.lang (b) java.util (c) java.io (d) java.awt
(xiv) Method overloading follows which principle of Object Oriented Programming?
(a) Inheritance (b) Polymorphism (c) Abstraction (d) Encapsulation
(xv) Which of the following Scanner class method can read a single word from the standard
input stream?
1. next ( )
2. nextWord ( )
3. nextLine ( )
4. readLine ( )
(a) Only 1 (b) 1 and 4 (c) 1 and 3 (d) 1 and 2
(xvi) The method indexOf (char) returns ______ when a character is unavailable in a string.
(a) false (b) 0 (c) 1 (d) -1
(xvii) Assertion (A): return statement transfers the control back to the calling place of a
method.
Reason (R): It is a jump statement.
(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
(xviii) Read the following text, and choose the correct answer.
A method/function prototype comprises of access specifier, modifier, return type,
method name and with/without parameters. Function signature is part of function
prototype which includes only the method name along with the parameters.
Identify the function signature from the given function prototype.
public static void calc (int x)
2
(a) public static void calc (int x) (b) int x (c) static void calc (int x) (d) calc (int x)
(xix) Assertion (A): An Array can store only single value.
Reason (R): It is a composite/reference datatype.
(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
(xx) What will be the output for:
System.out.println ('A'+2+" is the output");
(a) A2 is the output (b) 99 is the output (c) 67 is the output (d) C is the output
Question 2
(i) Write the java expression for 𝑝2 + √𝑞 [2]
(ii) Evaluate the expression when the value of m=10; [2]
m*=--m + m-- + ++m;
(iii) The following code segment should print the factors of n, if the value of n is greater than
zero. However, the code has errors. Fix the code so that it compiles and runs correctly.
[2]
if (n>0)
{
for (int i=1;i>=n;i++)
{
if(i%n ==0)
System.out.println (i);
}
}
(iv) Sharvil executes the following program segment to get the output as a last character from
the string x, but he is getting an error. Name the error (syntax/logical/runtime)
How the program can be modified to get the correct answer? [2]
public void find (String x)
{
int len=x.length ( );
char c=x.charAt (len);
System.out.println ("Last character is "+c);
}

3
(v) How many times will the following loop execute? What will be the output? [2]
for (int i=10;i<=100;i+=10)
{
if(i%3!=0)
continue;
System.out.println (i);
}
(vi) Write the output of the following String methods: [2]
(a) "CHROME".substring (2);
(b) "Classic".lastIndexOf ('C');
(vii) What are the two ways of invoking a method? [2]
(viii) Predict the output of the following code snippet. [2]
String a="14", b="12.5";
System.out.println (Double.parseDouble (a));
System.out.println (a.charAt (0) == b.charAt (0));
(ix) Name the following: [2]
(a) Name the variables that are common to all the objects of a class.
(b) At each stage, compares the sought key value with the key value of the middle
element of the array.
(x) int b[][]={{1,3},{5,7}}; [2]
(a) What will be the size of array b[][]?
(b) What is the value present at b[1][1]?

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.
Question 3 [15]
Define a class Grade_Revision having the following description:-
Instance Variables/Data Members:
String name - to store name of an employee
int bas - to store the basic salary
int expn - to store the years of service as experience
double inc - to store the increment
4
double nbas - to store the new basic salary (basic+increment)
Member Functions:
Grade_Revision ( ) - to intilalize name, bas, expn to their default values.
void input ( ) - to accept input for name, bas and expn.
[Using Scanner class only]
void compute ( ) - to calculate the increment with the following
specifications.
Experience Increment
Up to 3 years `1,000 + 10% of basic
More than 3 years and up to 5 years `3000 + 12% of basic
More than 5 years and up to 10 years `5,000 + 15% of basic
More than 10 years `8,000 + 20% of basic
Finally calculate the new basic salary as basic + Increment.
void display ( ) – print all the details of an employee.
Write a main ( ) method to create an object and call the functions.
Question 4
Define a class to search for a value input by the user from the list of values given below. If it
is found display the message "Search successful", otherwise display the message "Search
element not found” using Binary search technique.
5.6, 11.5, 20.8, 35.4, 43.1, 52.4, 66.6, 78.9, 80.0, 95.5.
Question 5 [15]
Define a class to accept a string and a character and convert both the string and the character
to lowercase and display the frequency of the character present in the string.
Example:
Input String: determination
Input Character: e
Output: The frequency of e is 2
Question 6 [15]
Define a class to input a number and check and print whether it is a Munchausen number or
not. A number is called Munchausen, if the sum of its digits raised to the power of itself is
equal to the input number.
Example:
Input number: 3435
Output: Munchausen number [33 + 44 + 33 + 55 = 3435]

5
Question 7 [15]
Define a class to accept integer values into 3x3 array and
(i) Print the reverse of an array in matrix format.
(ii) Find the average of ODD elements present in an array
Example:
Input: A[][]={{1,2,3},{4,5,6},{7,8,9}}
Output:
Reverse of an array
987
654
321
Average of ODD elements is 5.0 → (1+3+5+7+9)/5.0
Question 8 [15]
Define a class to overload the method print () as follows:
void print ( ) – To print the following pattern using nested for loop.
13579
1357
135
13
1
void print (int n) – print the square of all the even digits of the number ‘n’
Example:
If n is 172564
Output:
Squares of Even digits are:
16 →42
36 →62
4 →22
_________________

You might also like