Prefinal 2025
Prefinal 2025
Attempt all questlons from Section Aand any four questions from Soction B.
The Intended marks for questlons or parts of questions are glven in brackets [1
SECTIONA(40Marks)
Attempt all questions
Question 1: Multiple Choice Questions [20]
19 (1]
1. Name the method of SEARCH depicted in the given plcture Search element:
6 19 2
2 13
C) Selection sort
A) Binary search D) Linear search
B) Bubble sort
acquires |[1]
2. Name the element of object oriented programming language whereone class
the properties of another class.
B) Inheritance
A) Polymorphism D) Class
C)Abstraction
[1]
5. In the following code
int n=3,k=5;
System.out.println (( double )(n +k)/2); statement ?
print
What type of typecasting shown in the
B) explicit
A) implicit D) error in printing
C) possible loss of precision
Page 1 of 6
program Is
during the execution of the
7. The error which appears
B)syntax error
D) Runtime error.
A) logical error
C)class error
Math.max (-6.35, -15.75 ) ) )
is [1]
statement (Math.floor (
8 The output of the java
B)-6.0
A)-7.0 D) 7.0
C) 15.0
is (1]
.compareTo(" SOLUTE")
9 The output of the java statement "sOLDIER"
B)-17
A) -4 D)0
C) 17
[1]
of different data types.
Assertion (A):An array can store elements the same data
data type with multiple values of
10
Reason (R):An array is user defined
type but different memory allocation.
Reason R are true
A)Assertion Ais true Reason R is false B)Both Assertion Aand
Reason R are false
C) Assertion A is false Reason R is true D) Both Assertion A and
[1]
The output of the java statement:
11 ("BINDING". substring(0,4) );
System.out.printin ("DYNAMIC". substring (0). concat
B) DYNAMICBIND
A) DYNAMIC IND D) DYNAMICBIN
C) DYNAMICING
[1]
12. The method to check for a blank space is
A) break B) continue
C) System.exit( ) D) System.exit(0)
16. int f=10, m=9 ; String c =(m %f==9)? "yes":"no"; What is the result of c? (1]
A)YES B) yes
C) No D) no output
Page 2 of 6
bytes. 1]
and 4 columns occupies
17. An array whichstores integers in 5rows
B)20 bytes
A) 80 bytes D) 40 bytes
C)160 bytes
characters, which of the following is the correct [1]
18. single dimensional array has 45 to H'
A index
statement to initialize the last
B) x[44J=H
A) x[45]=H D) x(46j='H
C) x[43]='H'
[1]
to String is
19. The method to convert adouble value
(double )
B) String.valueOf
A) Double.String( ) D) double.toString ( String )
C)Double.valueOf( )
obiect is created and initialises the
instance variables [1)
an
20. Method which is invoked whenever
with their default values is
B) Default constructor
method
A) Method D) Wrapper class
C) Parameterized constructor
[20]
Question 2: [2
i. a t V3c
Write java expression for :
[21
answer the questions given below:
ji. Consider the following array and
15,17){16,17,13,22 ))}:
int x(][ ]={{4,5,6,7) (9,3,
index of 13?
a) What is the
1][2] +x[0][3]?
b) What is the result of x[
(2
value of x =5,y =2
Evaluate the given expression when the
*y+-X;
X-=++x + --y+x
loop using do while
iv. Rewrite the following for
-=3)
for( k= 15;k>=5; k
System.out.println(k);
System.out.println(k*2);
21
using if...else
Rewrite the following ternary operator statement
V.
code==G'? "Pass": "workhard";
String z =code=='g' ll
Page 3 of6
v A
student executes the following program segment and gets an error.
The program segment checks for the equality of two values, ldentify the 24\
statement/s which has erroris, Correct the same to get the output as 100.
if( x=y)
z ==100;
else
z=200;
vii. How many times willthe following loop execute? Write the
output of the code. [2
int x=5,y=4;
while (x <7)
{t+x;
System.out.println( x*y):
yB=2;
Page 4 of6
SECTIONB
Answer any four of the following
2 For each program write the list of variables /comment statements
Question 3: [15]
Magic Decorative Light stores is offering discounts on various types of products
purchased by its customers. The following table shows the types of articles and their
respective codes along with the discount offered.
Purchase amount Discount onchandeliers Discount on Luxury LED lights
Code -C Code-L
10000 -20000 6% 3%
>20000 6.5% 4%
the methods
void main( ): to create an object of the class and invoke
Question 4:
(15]
search for the given
Define a class to initialize the following characters in an array and
character using BINARY SEARCH TECHNIGQUE.
'K' 'M'c 's' n
"G'
[15]
Question 5: word of the given
Define a class to accept aString and print the Cipher word [a secret
word]. An Cipher word is created asa new String as follows :
Page 5 of 6
(13]
QUESTION 6:
the method display as follows:
Define aclass to overload
following pattern USING NESTED LOOPSONLY
void displayl ) :to print the
15 14 13 12
11 10 9 8
76 5 4
series
):to print the sum of the following
double display (int x,int n, int m
11
[15]
Question 7:
[ representing
5 floors (representing the rows ] with 5shops in each floor sale made
Value zone mall has same, accept the
an array to representthe column] and the floor [
thecolumns ]. Define a class to declare the shop [
by each shop in each floor in the array. Print the details of
the maximum sale.
row]which has made
Question 8:
not. [15]
check if it is an Armstrong number or
Define a class to accept a number and
cubes of each digit is the number
itself.
number is Armstrong if the sum of the
A
Example: 153 -> 13+53+33 =1 + 125+ 27 =153
Page 6 of 6