You are on page 1of 8

GMBL/ REHEARSAL,

EXAMINATION / 2022-23
CLASS N
SUBJECT: COMPUTER FULL MARKS:100
APPLICATIONS TIME: 2 HOURS

Answers to this Paper must be written


on the
separately. paper provided
You will not be allowed to write during the first 15 minutes.
time is to be spent in This
reading the question
The time given at the head of this paper.
Writing the answers Paper is the time allowed for
This Paper is divided into two
Sections. Attempt all
from Section A and any four questions
questions from Section B.
SECTION A
(Attempt all questions jrom this section.)
Question 1
Choose the correct [20
answer and write the correct option.

Which of the following is not OOPS concept in Java


a. Encapsulation
b. Abstraction
C. Compilation
d. Inheritance

Corresponding wrapper class ofint data type is


a.integer
b.int
c.INTEGER
d. Integer
Which of the following keyword is used to create an instance of
a class?
a. new

b. class
C. public
Page 1
d. private
variable x ?
the final value stored in
What is
(iv double a -1.35;
Math.abs(Math.floor(a);

double x =
b. 2
c. 2.0
d. 1.0

in
package
available
are
() Wrapper classes
a. java.io
b. java.util
C. java.lang
d. java.awt
code:
of the following
Give the output
(vi) B="74.0";
String A "26.0",
double CDouble parseDouble(A);
.parseDouble(B);
Double
double D
=

System.out.println((C+D);

a. 26
b. 74
C. 100.0
d. 2674
is:
The access modifier that gives most accessibility
a. public
b. private
C. package
d. protected

vii) Method that accepts a string without any space is

a. next0

b. nextLine()
C. nextlnt()
d. Next)

Cix The wrapper class to which the method parselnt() belongs to


a. Integer
b. Character

Page | 2
C. Boolean
d. Int

int n-1000
while (n> 10)
n/10:
Syst
Howem.out.ptime
many rintlnthe(n):
a Loop is loop is executed and
b. exeeuted 2 times what is the
c.
Loop is executed 3 tinmes and output is 100output?
and the
Loop exccuted 2
is the
d.
Loop is executed I times and the output is 10
times and the output is 10.
Which of the output is 10.
data type? following is the default initial
a. null
value for a long
b. OL
C. Long 0
d. 0.0

(xii What will be the


String obj output of the following Java
=
"I LIKE
JAVA"; program?
System.out.println(obj.charAt(3);
I
b. L
C. K
d. E

(xii) What will be the output of the


following Java program ?
String s = new String("S");

System.out.printin(1 +10+s+1+10);
a. 1115
b. 1105110
C. 27
115110
xIV) Consider the following String array and give the output
String x[]={"SAMSUNG", "NOKIA", "SONY",
Page 3
"MICROMAN" "BLACKBERRY"}

System.oul.prindn(x/1)
SAMSUNG

b. NOKIA
c . B L A C K B E R R Y

MICROMAX
d
transfer back to the method call
Causes the control to
(AV)

a. NEW

b. return
C. new

d. break
function?

xvi) What are the two ways of invoking


static
a.
a. static and non-
call by reference
b. call by value and
C. public and private
d. void and int

a [4] of char data type


State the total size in bytes, ofthe
arrays
(xvii)
and p[4] of float data type.
a. 8 Bytes and 16 Byte
b. 2 Bytes and 4 Bytee
c. 8 Bytes and 8 Byte
d. 20 Bytes and 4 Byte

(xvii) What will be the output ofthe following Java program?


int p= 200;
while true)
ifp<100)
break;
Pp-20;

System.out.printin(p);
a. 80
b. 20
C. 200
d. runtime error

Page 4
(xix)
Statement
double datatotype
Convert mmmber
a
stored in
double a
string variahle
b
double ddString valued f (x). to
double d- string. (x)
d.
double d string Doible (x)
(xN) NextlDouble (x).
What will this
code print
int a|l-new int|5]. ?

System.onullut.print(arr|0]):
a.
b. 0
C. Any integer
d. 0.0

Question 2
() What is the value of m
after
m -

9%++n + ++n/2; whenevaluating


int
the following
expression: 21
m=10,n=6 (show the working)
(i) Write java expression for
[21
Vb2-4ac
2a
Evaluate the value of n. if value
int
ofp 5, q= 19 =

2
n =(q-p)> (p-9)?q-p): (P-9);
(show the working)

Rewrite the following program segment using while instead of for 2


statement,
int f+1,i;
for(i=1; i<=5; i++)
{f=i;
System.out.println(f);

What is the final value of ctr when the


iteration process given 2
(v)
below, executes? (show the working)
int ctr =0
for(int i = 1; i=5; it+)

for(intj= l;j<=5;j +=2)


++ctr,
Page 5
vi) Give the
)
Systoutputem.out.print(ctry,
of the
,
(vii)
Vii)
Write
i)
TRANSPARENT"
the
String sl="Land";
fol owing tol .ow erC ase
outputRANSPARENT" compareToro"TRANSITI
st
for the
ate ment(s. java
String s2-"island" folol wing:g
T RANSITION"
viil) Define
(ix) SSyysstteemm..oouut.tp.prirninthtlnn((ssl2..utobUstrpinger(0C)a.csoen(c)a,t($2.substring(2)
boxing with an
State the
type of errors if
any
example.
in the
switch (n>2) following statements:
Consider the
int x
Sysfollowingtem.out.println(100/0)
[]- {23, 45, array and answer the
67, 12, 45, 89, 24, questions given
(a) What is the 12,9,7} below
(6) What is the size of the array?
(b)
position of 89?

Section B
(Answer any four Questions
from this
section)
Attempt any four questions from this
this Section should Section. The answers in
consist of the Programs in either
environment or any program Blue J
base. Each environment with Java as the
program should be written using Variable
descriptions/Mnemonic Codes such that the logic of the
program is clearly depicted

Question 3
Define a class named BookFair with the following description: [15
Instance variables/Data members:
String Bname- stores the name ofthe book
Page | 6
.
uble

arice-stores the price of the book


price -

Membermethods

nkFair()-Detault constructor to initialize data members


void Input()-1 input and store the name and
book. the price of the
void calculate()-To calculate the
Discount is calculated bascd on the price after discour
following criteria.

| Price
Less than or equal to Rs. 1000 Discount
More than Rs. 1000 and less than or 2% of price
Rs. 3000 equal 10% of price
More than Rs. 3000
15% of price
iv) void display)- To display the name and price
after discount. Write a main method to create an of the
book
and call the above
object of the class
member methods.

Question 4
(15
Design a class to overload a function Sum() as follows:
) int Sum int A, int B)- with two integer arguments (A and
B) calculate and return sum of all the even numbers in the
range of A and B.
Sample input: A=4 and B=16
Sample output: sum =4+6+8+ 10+12+14+16.
i) double Sum( double N) -with one double
arguments(N) calculate and return the product of
the following series:
sum 1.0x 1.2 x 1.4x... XN
Gii) int Sum int N) with
-
one integer argument (N) calculate
and return sum of only odd digits of the numberN.
Sample input N=43961
13
Sample output sum =3 +9+1=
Question 5
Define class to accept n integers and arrange
a
them in [15
and
bubblesort. Print the original array
descending order using
the sorted array.
Page 7
Question 6 into an array of size 20

Write a program
to input integer
elemenits
[15
operations:
the following
and perform
numbers.
odd
Product of the
Display
numbers
sum of the even
() Display

Question 7 and check Iis


a word,
convert it into lowercase [15)
Define a class to accept or not. A palindrome
word is a
palindrome
whether the word is
a
forward. madam,
Example:
backward as
which reads the
same

racecar etc.

Question 8
Define a class to accept the names of n students
in an array and check [15
[IS
linear search, if
name in the array using
for the existence of the given
if not found print the appropriate
found print the position of the name,
with vowels.
message. Also print the names which begin

You might also like