0% found this document useful (0 votes)
13 views

SMS Computer Prelim 2025

The document appears to be an examination paper divided into two sections, with Section A consisting of multiple-choice questions related to programming concepts and Section B requiring programming tasks. It includes questions on Java methods, data types, and algorithms, as well as practical coding exercises. The paper aims to assess the understanding and application of Java programming principles.
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)
13 views

SMS Computer Prelim 2025

The document appears to be an examination paper divided into two sections, with Section A consisting of multiple-choice questions related to programming concepts and Section B requiring programming tasks. It includes questions on Java methods, data types, and algorithms, as well as practical coding exercises. The paper aims to assess the understanding and application of Java programming principles.
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/ 9

PHEUINAHV EHAMMADN 04 9

0ATE 160/2035
OMPUTEn APPEAons
CLANS N
MAHVS if

Ihe time glven at the head eti s aper is the ime allowd or
iing bhe nnene6
this aper is divile into tw teton

Attempt all questione from Sectlon Aad any tou uestons fom Setinn 6
Ihe intended marks for questions o parts of questions a1e given in
babets
SECTION A
(Atempt all questions fron this Sectlon)
Questlon 1
(20)
Choose the corect answers to the questlons from the glven optlons
1) Assetion (A) Metlhod should be called expliitly either with object reference
0f Cas tefeteICe
Reason () Method can be any user defined name
a) lotlh Assertion (A) and Reason () are true and
Reason (0) is a otret
Oxplanatlon of Assertion (A),
b) Both Assertion (A) and Reason (R) are tue and
Keason () is not a
corect explanation of Assertion (A)
) Assetion (^) is true and Reason (R) is false
d) Assetion (A) is false and Reason (R) is true

1
Ternary operator is a
a) logical operator
b) arithmetic operator
c) relational operator
d) conditionaloperator

3) Which of the following statements is true? [1)


a) Binary search is less efficient than the sequential search

b) Binary search is less efficient than the linear search.


c) Binary search is more efficient than the sequential search.
d) Binary search is as efficient as the sequential search.

4) Output of the following statement is (11


System.out.printin("WONDERFUL".substring(3,4):
a) DERF
b) NDER
c) D
d) N

5) The trim() method of the String class removes (1]


a) leading spaces only
b) trailing spaces only
c) spaces in between words
d) leading and trailing spaces

6) A constructor is used when an object is (1]


a) created

b) destroyed
c) assigned a value
d) abstracted
7) What will be the output of
a) 0.0
Math.pow3, 0)
b) 1.0
c) 3.0
d) 1.0

8) A method can
return [11
a) any number of values
b) 2 values

c) onty 1 value

d) 3 values

9 What value will Math. sqrt(Math.ceil(15.3)) return?


a) 16.0
b) 16
c) 4.0

d) 5.0

10) Among the following which is a keyword:


(1]
a) every
b) all
c) case
d) each

12) The absence of which statement leads to fall


through situation in switch case
Statement?

a) continue

b) break
c) return

d) System.exit(0)
memory as (1]
(A) JVM 0s a ava interDreter loaded in the computer
ASsertion
soon as Java is loade.
platforms.
Reason (R) JVM is different for different
(R) is a correct
Assertion (A) and Reason (R) are true and Reason
a) Both
explanation of Assertion (A).
not a
Both Assertion (A) and Reason (R) are true and Reason (R) is
b)
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.

13 The return type of the isLowerCase() method is [1]

a) int
b) boolean

c) char
d) String

14) Alinear search


[1]
a) can be used with sorted arrays only
b) can be used with unsorted arrays only
c) can be used with both sorted and
unsorted arrays
d) cannot be used with arrays

15) The indexOf() method returns the


position of the
a) first occurrence of the specified [1)
character
b) last occurrence of the
specified character
c) null character
d) \n'character
11

16) Output of the folowing statement is


System.out.println("SUNDAY" substring(3)):

a) NDA
b) DAY

c) SUN
d) N
[1]
segment:
loop in the given program
17) State the type of
2)
for (int i 5; i l= 0;
(System.out.println(i):)
a) finite

b) infinite
c) null

d) fixed

method
given to a package, class, interface, [1)
name
Assertion (A) ldentifier is a
18)
or variable. from other
programmer to refer to the item
allows a
Reason (R) ldentifier
places in the program. (R) is a correct
Assertion (A) and Reason (R)are true and Reason
a) Both
explanation of Assertion (A).
is not a
Assertion (A) and Reason (R) are true and Reason (R)
b) Both
Assertion (A).
correct explanation of
Reason (R) is false.
c) Assertion (A) is true and
Reason (R) is true.
d) Assertion (A) is false and

element of an arrav is:


19) Java statement to access the 5th

a) X[4]
b) X[5)
X[3)
d) X(0)
class, [1
corresponding object of its
type is converted to a
When primitive data
it is called:
a) Autoboxing
b) Unboxing

c) explicit type conversion


implicit type conversion

[20)
Question 2
are a = 2, b= (2)
the following expressions, if the values of the variables
1) Evaluate
3and c = 3
i. a -(b++) (-c)
ii. a (++b) %c

(xy)/3 [2]
) Write the Java expressions for the following: z = x3 + y3+

Write the java logic to input 10 umbers into an integer array using for loop [2

Give the output of the following program fragment: [2]


String s=new String("He went to the market"):
String r;
r=s.replace("went", "is going");
System.out.printin(r):

What do the following functions return for: [21


String x ="hello";
String y ="world"
System.out.printin(x+ y);
System.out.printin(x.length();
System.out.printIn(x.charAt(3)):
System.out.printin(x.equals(y)):
(21
What wll be the output of the following program
class First

Ipublic static void main(String argsi))


int al](5, 1,15,20,25).
int i.

int m,

in++a|1]:
j=a<2]++,
m=ali++].
System.out.print(i+ "+j+ "+m).

(21
program segment:
the following
7 Give the output of
int n 4279: int d

while(n > 0)
{d=n% 10:
System.out.printin(d);
n =n/ 100:

following program fragment: (21


8) Give the output of the
String s="String";
int a=12,b=45;
System.out.printin(sta+b);
System.out.printin(a+s+b);
System.out.printin(a+b+s);

Name the following: [2)


9)

(a) What is an instance of the class called?


name.
(b) The method which has same name as that of the class

Write the Java expression for (a + b)" (2]


10)
SECTION B

Section.)
(Answer any four questions from this
environment or
consist of the programs in either Blue
The answers in this section should
environment with java as the base.
any prOgram
variable description so that the logic of
the
Each program should be written using
program is clearly depicted
Flowcharts and algorithms are not required.

Question 3
(15]
description:
Design a class name ShoWRoom with the following
Instance variables /Data members:

String name - To store the name of the customer


long mobno To store the mobile number of the customer

double cost - To store the cost of the itens purchased

double dis - To store the discount amount


double amount To store the amount to be paid after discount
Member methods:

ShowRoom() -default constructor to initialize data members


void input() To input customer name, mobile number, cost
void calculate() - To calculate discount on the cost of purchased items, based on following
criteria

Cost Discount (in percentage)


Less than or equal to 10000 5%

More than 10000 and less than or equal to 20000 10%


More than 20000 and less than or equal to 35000 15%
More than 35000 20%
void display()-To display customer name, mobile number, amount to be paid after
discount.
Write a main method to create an object of the class and cal the above
member methods.

Question 4
(15)
Write a program to input a sentence and count the
number of vowels in it.
Question 5
(15)
Desgn a class to overload a function series( ) as follows:
al void series(int x, int n)-To) display the sum of the series given below:

xn terms

.od series (int p) - To display the following series:


0.7. 26, 63 ..... pterms

Question 6
(15]
fne a class to accept values in integer array of size 10. Sort them in an ascending order
cing selection sort technique. Display the sorted array

Question 7 (15)
knn a class to accept a String and print the number of digits, alphabets and special
characters in the string.

Example:
S= "KAPILDEV@83"

Output:
Number of digits -2
Number of Alphabets-&
Number of Special characters -1

Question8 [15)
Write a program to input two integers and find their Highest Common Factorl(H.C.F).

For Example,
INPUT:

Enter 2 integers:
12

OUTPUT: H.CF. = 4

You might also like