VVHS Computer Prelimn Paper
VVHS Computer Prelimn Paper
SECTION A
Choose the correct answers to the questions from the given options.
(Do not copy the question, write the correct answers only.)
i. Corresponding wrapper class of float data type is ............... •
(a) FLOAT
(b) float
(c) Float
(d) Floating
ii. A single dimensional array contains N elements. What will be the last subscript?
(a) N
(b) N-1
(c) N+l
(d) O
(a) Robo
(b) obot
(c) Rob
(d) Robot
v1 Give output of the following String methods:
"SUCESS".indexOf( S') + "SUCCESS".lastlndexOf('S')
(a) 4
(b) 6
(c) -6
(d) 5
(a) 16 0
(b) 16
(c) 4.0
(d) 5.0
viii. The absence of which statement leads to foll through situation in switch case
statement?
(a) continue
(b) break
(c) return
(d) System.exit(O)
Ix String Is a:
(a) Character array
(bl Group of characters
(c) Data Type
(d) All of these
I
%
\ \ "' ' l
\ ,snot
nlv if ,1 r wrn tYP
\ ' \I
ll i, l v lllU it I u~t d f r
wrn11 1 ,ult h,
l r
lit I
t corr ct
1111 1niR ,1
R)
on( is
t ' l
4
11 ', th 1 )
~ nt l'\
m thods 1s med to convert a string to an integ er
X in the
p 1 urn o,cr
I If I 'I
I I II '" fl
t 111p11I I
I
\
\\I h ,\ ll
GJ Class
M ti
{a)"IOl"i
{b) 5 10
(c} 10 15
(d} S 10 15 20 25
Choose the con ect order of precedence
XVIII
(a)++,+, >, &&, (}
(b} (), ++, +, >, &&
(c) >, +, ++, &&, ()
(d) &&, >, (), ++, +
QUESTION 2
.u
Predict the output and show th e working .
[2]
mt a=S, b=l0, c=lS,
mtx a++* b++ + ++c.¾2 * 5
System out pnnt(x+" "+d+" "+b).
11J The following code snippet has an e rror in it . Nam e the type of the error and
Correct the code so that it compiles a nd run s correctly. [2]
String x "25",
mt y=double.parseDouble(x),
double r=Math.sqrt(y),
System.out print(r);
I { P es furn (her
2
A do bed 2
0 n be c;
f
• Ic
ltuw
I I 1 It I y 11 tn I
Wiil thr f 0 n'
Ill I
11, w1nr. loop , ~• r ,, / Wh it v lu will tt r tur
(2)
rf 11
I t
11111 ( , ,,,
I I tu111 y
<ii CTION U
QUfSIION.11
[15)
D(•f 11,, • , ( I 1 •• to ovt r lo.id th f u nc.t10n print ,1 follows
void p, 1111() to print tlu follow,np forrn,,t
1 J 1 I
) 7 ). )
{ 3 { ~
4 '1 ll 4
,, r, r> ,,
VOid pt tilt ( In l
1 0 check wlwthf'r the number 1!. a lead number t lt•ad number 1s
ll )
tlw onP who.,c Unl ,~
"'vrn Or
d1g1ts Me equ.il to sum of odd d1g1ts
C' G 1GG()
oddcl1p,1tc, um 3, 9 12
l Vf'll cl1r,1ts <urn 6 ♦ G ]2
-i669 ,,, ,i lcild nurrilwr
dit
a= p (l+r/100)
QUESTION 6 (15)
b th u fr m th h t f valu
oth
11 8 5'1 1
QUEsnoN 7
Der inl! a rldss l
011
... I O ,lC( C'J)t " ', t I 111 111(! !)fl (15)
l c.l1c;plily ti rt lh 1111 I
c ie Ill w Iring I r t
cha1c1ctC'r,3r,f >yr IIJ 111 h lly r 11
nd 111 ' c l'vcry Co11so11c111t liy 11, I i
QUESTION 8
(15)
Deline a class to accept values into 4x4 array and find and d11play th sum of
each row and each column.
Example