oopsbydevilsduke.com
TRANSCRIPT
-
8/7/2019 OOPSbyDevilsDuke.com
1/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
Set1
1 . W h a t i s t h e ar g u m e nt ty p e o f p r og r am s m a i n ( ) m e t h o d ?
( a) C h a r ac t e r a r r ay ( b ) S t r i n g a r r ay ( c ) S t r i n g ( d ) C h a r ac t e r
2 . H ow m a ny no o f p ri m i t i ve d a t a ty p e s a re t h e r e i n j ava?
( a) 8 ( b ) 3 ( c ) 5 ( d ) 7
3 . W h i ch o p e r a to r i s t o c r e at e an d c on c at e n a t e s t r i n g?
( a) + + ( b ) & & ( c ) & ( d ) +
4 . T h e ot h e r n a m e f or c on d i t i o n al op e ra t or i s
( a) e q u a l t o ( b ) i d e nt i c al l y e q u al to ( c ) t e r n ar y ( d ) t e r t i ar y
5 . W h a t i s t h e m i n i mu m va l u e o f ch a r ty p e . S e l e c t t h e o n e c or r e c t a n s we r .
( a) 0 ( b ) 2 1 5 ( c ) 2 1 5 1 ( d ) 2 8
6 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a re c o r re c t . S e l e c t t h e on e c o rr e c t an s
we r .
( a) A J ava fi l e h as a t l e as t on e c l a s s d e fi n e d . ( b ) E a ch J ava fi l e mu s t h ave e x a c t l y
on e p a cka ge s t at e m e nt t o s p e c i f y h e re t h e c l as s i s s t or e d . ( c ) I f a J ava fi l e h as b o th i
m p or t an d p a cka ge s t at e m e nt , t h e i m p o r t s ta t e m e nt mu s t c om e b e f o r e p ackag e s ta t e m e nt .( d ) I f a J ava fi l e h a s a p a cka ge s t a te m e nt , i t mu s t b e t h e fi r s t
s ta t e m e nt ( e x c e p t c o m m e nt s ) .
7 . W h i ch i s u s e d t o ge t t h e va l u e o f th e i n s t an c e var i a b le s ?
( a) . ( D ot ) ( b ) > > ( c ) < < ( d ) >
8 . W h i ch o f th e f o l l ow i n g ty p e s of c l as s m e mb e rs c a n b e p ar t o f th e i nt e r na l p a
r t o f a c l a s s ?
( a) P r i va t e m e t h o d s ( b ) P u b l i c i n s t an c e va r i ab l e s ( c ) P r i va t e c on s t r u c t or
s ( d ) P u b l i c m e t h o d s
9 . I d e nt i f y t h e t ru e s t at e m e nt s ab ou t fi n a l i z a ti o n . i ) A c l as s m ay h ave o n l y o n
e fi n a l i z e m e th o d i i ) F i n a l i z e r s ar e m o s t l y u s e d w i t h s i m pl e c l a s s e s i i i ) F i n a l i z e r ove r l o
ad i n g i s n o t al l owe d
( a) i & i i & i i i ( b ) i & i i ( c ) i & i i i ( d ) i i & i i i
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
2/36
-
8/7/2019 OOPSbyDevilsDuke.com
3/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 8. W h i ch i s t h e a d va nta g e o f e n c ap s u l a t i on ?
( a) O n l y p u b l i c m e t h o d s ar e n e e d e d . ( b ) M a k i n g th e c l a s s fi na l c au s e s n o c o
n s e q u e nt i al ch an g e s t o ot h e r c o d e . ( c ) o e x c e p t i o n s n e e d t o b e th r ow n f r o
m a ny m e th o d . ( d ) I t ch a n ge s t h e i m p l e m e nt a ti o n w i t h o u t ch an g i n g t h e i nte
rf ac e an d c au s e s n o c o n s e q u e nt i al ch an g e s t o o th e r c o d e .
1 9. W h i ch o f t h e f o l l ow i n g a re l e g al i d e nt i fi e rs
( a) 3 ( b ) # my va r ( c ) 1 23 4 ( d ) 2 va ri a b l e
2 0. G i ve n t h e f o l low i n g c o d e w h at w i l l b e ou t p u t ? p u b l i c c l as s Pa s s { s t a ti c i
nt j = 20 ; p u b l i c s ta t i c vo i d m a i n (S t r i n g ar g v [ ] ) { i nt i =1 0 ; Pa s s p = n e w Pa s s () ;
p . a me th o d ( i ) ; S y s t e m . ou t . p r i nt l n (i ) ; S y s t e m . ou t . p r i nt l n (j ); } p u b l i c vo i
d a m e t h o d ( i nt x ) { x =x * 2; j = j * 2; } }
( a) 1 0, an d 20 ( b ) 2 0 an d 40 ( c ) 1 0 an d 40 ( d ) E r r or : a m e t h o d p a ra m e t e r d o e s n
ot m at ch var i a b l e
Set2
1 . What out put is displayed as the result of e x e c u t i n g t h e f o l l ow i n g s t a t e m e nt? S y s t
e m . ou t . p r i nt l n ( // L o ok s l i ke a c o m m e nt. ) ;
( a) L o ok s l i ke a c om m e nt ( b ) / / Lo o k s l i ke a c o m m e nt ( c ) T h e s t at e m e nt r e s u l
ts i n a c om p i l a ti o n e rr o r ( d ) o o u tp u t i s d i s p l aye d
2 . W h a t ar e va ri a b l e s ? ( a) Va r i ab l e s a r e l o c a ti o n s i n m e m o ry th a t c a n h o l d t
h e ad d r e s s e s ( b ) Va r i ab l e s a r e p o i nte rs t o m e m o ry t h a t c a n h o l d va l u e s . ( c )
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
4/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
Va r i ab l e s a r e l o c a ti o n s i n m e m o ry th a t c a n h o l d val u e s . ( d ) Va r i ab l e s a r e p o
i nte rs t o m e m o ry t h a t c a n h o l d t h e a d d r e s s e s
3 . W h a t i s t h e d e f a u l t va l u e o f i nt p r i m i t i ve ty p e ?
( a) 1 ( b ) 1 ( c ) 0 ( d ) nu l l
4 . W h a t i s t h e d e f a u l t va l u e o f by t e p r i m i t i ve ty p e ?
( a) 1 ( b ) nu l l ( c ) 1 ( d ) 0
5 . W h a t ge ts p r i nte d w h e n th e f o l l ow i n g p r o gr a m i s c om p i l e d an d r un . S e l e c t
t h e on e c o rr e c t an s we r . c l a s s te s t { p u b l i c s t at i c vo i d m a i n (S t r i n g ar g s [ ] ) { i
nt i , j , k , l =0 ; k = l + +; j = ++ k ; i = j ++ ; S y s t e m . o u t. p r i nt l n (i ) ; } }
( a) 0 ( b ) 3 ( c ) 1 ( d ) 2
6 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a re c o r re c t . S e l e c t t h e on e c o rr e c t an s
we r . ( a) E a ch Java file must have exactly on e p a cka ge s t at e m e nt t o s p e c i f y w h e re t h e
c l as s i s s t or e d . ( b ) I f a J ava fi l e h a s a p a cka ge s t a te m e nt , i t mu s t b e t h e fi r s t s ta
t e m e nt ( e x c e p t c o m m e nt s ) . ( c ) I f a J ava fi l e h as b o th i m p or t an d p a cka ge s t at e
m e nt , t h e i m p o r t s ta t e m e nt mu s t c om e b e f o r e p ackag e s ta t e m e nt . ( d ) A J ava
fi l e h as a t l e as t on e c l a s s d e fi n e d .
7 . T h e o p e r at o r c r e a te s a s i n g l e i n s t an c e n am e d c l a s s an d re tu r n s a re f e r e n
c e t o t h a t o b j e c t. ( a) i n s t a n c e o f ( b ) n e w ( c ) d e l e t e ( d ) c r e a t e
8 . S t at i c m e t h o d s c a n a c c e s s o n l y . ( a) d a ta var i a b l e s ( b ) s t a ti c va r i ab l e s (
c ) fi n a l va r i ab l e s ( d ) g l ob a l var i ab l e s
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
5/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
9 . W h a t i s a n e xa m p l e o f p ol y m o r ph i s m ?
( a) M e t h o d ove rl o ad i n g ( b ) A n o ny m o u s c l as s e s ( c ) I n n e r c l as s ( d ) M e t h o d
ove rr i d i n g
1 0. W h i ch o f th e f o l l ow i n g s t a t e m e nts c o r re c t l y d e s c r i b e s a n i nt e r f ac e ? ( a)
I t s a s u p e r c l a s s ( b ) I t s a ty p e of a bs t ra c t c l a s s ( c ) Its a concrete class ( d ) I t s fi
n al c l as s
1 1. A i s u s e d t o s e p ar at e t h e h i e r a r chy o f th e c l a s s w h i l e d e c l ar i n g a n i m p o
rt s t at e m e nt . ( a) i nt e r f ac e ( b ) p a ra nt h e s i s ( c ) p a cka ge ( d ) s e m i c ol o n
1 2. W h i ch o n e d o e s n o t h ave a val u e O f ( S t r i n g) m e th o d ( a) C h a r ac t e r ( b ) L
on g ( c ) I nt e g e r ( d ) B o o l e a n
1 3. W h i ch o f th e f o l l ow i n g r e t u r n t r u e ? ( a) j oh n = = j oh n ( b ) j oh n . e q u
al s ( J o h n ) ( c ) j oh n . e q u al s (n e w B u tt o n ( j o h n ) ) ( d ) j oh n = j o h n
1 4. U n d e r w h at s i tu a t i on s d o yo u o b t ai n a d e f a u l t c o n s t ru c t o r ? ( a) W h e n yo
u d e fi n e s t at i c c l a s s ( b ) W h e n th e c l a s s h as n o ot h e r c on s t r u c t o rs ( c ) W h e n yo
u d e fi n e at l e as t on e c o n s t ru c to r ( d ) W h e n yo u d e fi n e any c l as s
1 5. W h a t i s t h e r e s u l t o f e x e c u ti n g t h e f ol l ow i n g f r a gm e nt o f c o d e : b o o l e an
fl ag = f a l s e ; i f (fl a g = t ru e ) S y s t e m . o u t. p r i nt l n ( t r u e ) ; - e l s e S y s t e m . o u
t. p r i nt l n ( f a l s e ) ; - ( a) o th i n g h a p p e n s ( b ) A n e xc e p t i on i s r ai s e d ( c ) t r u e
i s p r i nt e d to s ta n d a rd ou t ( d ) f a l s e i s p r i nt e d t o s t an d a r d o u t
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
6/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 6. W h i ch o f th e f o l l ow i n g r e p r e s e nt s an o c ta l nu mb e r ? ( a) ( o c t al ) 2 ( b ) 0 x1 2
( c ) 3 2O ( d ) 0 32
1 7. G i ve n t h e f o l l ow i n g c l a s s d e fi n i t i on : c l as s A { p r ot e c te d i nt i ; A ( i nt i ) { t h
i s . i = i ; } } W h i ch o f th e f o l l ow i n g wo u l d b e a va l i d i n n e r c l as s f o r t h i s c l as s ? (
a) c l a s s B { c l a s s A { } } ( b ) c l a s s B { } ( c ) c l a s s A { } ( d ) c l a s s B e xt e n d s A
1 8. W h i ch a r e ke y wor d s i n J ava ? ( a) f r i e n d ( b ) s i z e of ( c ) e x t e n d s ( d ) U L L
1 9. W h i ch o f th e f o l l ow i n g w i l l ou t p u t 4. 0 ( a) S y s t e m . o u t. p r i nt l n (M at h . fl o
or ( 4 . 7) ) ; ( b ) S y s t e m . o u t. p r i nt l n (M at h . M i n ( 4 . 7 )) ; ( c ) S y s t e m . o u t. p r i nt
l n (M at h . c e i l ( 4. 7 )) ; ( d ) S y s t e m . o u t. p r i nt l n (M at h . r ou n d ( 4 . 7 )) ;
2 0. G i ve n t h e f o l l ow i n g c o d e w h at w i l l b e ou t p u t ? p u b l i c c l as s Pa s s { s t a ti c i
nt j = 20 ; p u b l i c s t at i c vo i d m a i n (S t r i n g ar g v [ ] ) { i nt i = 10 ; Pa s s p = n e w Pas s ()
; p . a m e t h o d ( i ) ; S y s t e m . o u t. p r i nt l n (i ) ; S y s t e m . o u t. p r i nt l n (j ); } p u b l i c
vo i d a m e t h o d ( i nt x ) { x =x * 2; j = j * 2; } }
( a) 2 0 an d 40 ( b ) 1 0, an d 20 ( c ) E r r or : a m e t h o d p a ra m e t e r d o e s n ot m at ch var i a
b l e ( d ) 1 0 an d 40
Set3
1 . E x t e n s i o n o f a file created by compiling a sour c e fi l e i s . (
a) b a t ( b ) e x e ( c ) d a t ( d ) c l a s s
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
7/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
2 . H ow a re t h e var i a b l e s d e c l ar e d ?
( a) a ny w h e r e i n th e m e t h o d d e fi n i t i o n . ( b ) b e g i n n i n g of m e t h o d d e fi n i t i o n
a n d s h o u l d b e i n i t i al i z e d ( c ) b e g i n n i n g of m e t h o d d e fi n i t i o n ( d ) a ny w h e r
e i n th e m e t h o d d e fi n i t i o n a nd s h o u l d b e i n i t i al i z e d
.
3 . W h i ch o f th e f o l l ow i n g d e c l ar e a n a r r ay o f s tr i n g o b j e c ts ?
( a) S t r i n g[ s ] : ( b ) C h a r [ ] s ; ( c ) C h a r [ s ] ; ( d ) S t r i n g[ ] s ;
4 . j ava i s l a n gu a ge .
( a) O b j e c t or i e nt e d ( b ) E ve nt d r i ve n ( c ) L ow l e ve l ( d ) P l a t f or m de p e n d e nt
5 . T h e i n i t i al val u e o f an i n s t a nc e va ri a b l e of ty p e S t ri n g t h at i s n ot e x p l i c i t l y
i n i t i a l iz e d i n t h e p r og r am i s . S e l e c t t h e o n e c or r e c t a n s we r .
( a) U L L ( b ) nu l l ( c ) 0 ( d )
6 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a re t r u e . S e l e c t th e o n e c o r r e c t a n s we r
( a) A r r ay e l e m e nt s ar e i n d e x e d f ro m 1 t o s i z e o f a r ray. ( b ) I t i s n o t p o s s i b l e to
a s s i g n o n e a r r ay t o a n ot h e r . I n d i v i d u a l e l e m e nt s of ar r ay c an h owe ve r b e a s
s i g n e d . ( c ) A r r ay s i n J ava ar e e s s e nt i al l y ob j e c t s . ( d ) I f a m e t h o d t ri e s t o a c
c e s s a n a rr ay e l e m e nt b e yo n d i t s r a n ge , a c o m p i l e wa r n i n g i s g e n e r at e d .
7 . W h i ch o f th e f o l l ow i n g f e at u r e s a r e c om m o n t o b o th J ava & C ++ ?
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
8/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
( a) T h e u s e of p oi nt e r s ( b ) T h e u s e of mu l t i p l e i n h e r i t an c e ( c ) T h e u s e of i nt e
r f a c e s ( d ) T h e access modifiers
8 . W h i ch o f th e f o l l ow i n g o p e r a to r s a r e u s e d i n c on j u n c t i o n w i t h th e t h i s a
n d s u p e r r e f e r e n c e s ? ( a) T h e n e w o p e r a t or ( b ) T h e d ot o p e r a t or ( c ) T h e s u
p e r op e r a t or ( d ) T h e i n s t an c e of op e r at o r
9 . W h a t ar e ac c e s s modifiers ? ( a) s t a ti c ( b ) fi n a l ( c ) a b s t ra c t ( d ) default
1 0. D e c l a r at i o n of m e t h o d s a s fi n al re s u l ts i n e xe c u ti o n o f th e p r og r am ? ( a) n
o e ff e c t ( b ) s l owe r ( c ) m o d e r at e ( d ) f a s t e r
1 1. I f yo u d o n ot i m p l e m e nt al l t h e m e t h o d s o f an i nt e r f a c e w h i l e i m p l e m e nt i
n g , w h a t s p e c i fi e r s h o u l d yo u u s e f o r th e c l a s s ?
( a) s t a ti c ( b ) fi n a l ( c ) p u b l i c ( d ) a b s t ra c t
1 2. W h i ch o n e d o e s n o t e x t e n d j ava . l an g . u mb e r
( a) I nt e g e r ( b ) L on g ( c ) S h o rt ( d ) B o o l e a n
1 3. W h i ch o f th e f o l l ow i n g i s i l l e g al :
( a) F l o at f =4 5. 0 ; ( b ) fl o at f = 45 . 0 ; ( c ) d o u b l e d = 4 5 . 0; ( d ) i nt i = 3 2;
1 4. W h a t i s t h e r e s u l t o f c o m p i l i n g a n d r u n n i n g th e f o l l ow i n g c o d e : p u b l i
c c l as s Te s t { s t a ti c i nt t ot a l = 1 0; p u b l i c s t at i c vo i d m a i n ( S t ri n g a r gs [ ] ) { n e
w Te s t () ; - p u b l i c Te s t ( ) S y s t e m . o u t. p r i nt l n ( I n te s t ) ; S y s t e m . o u t. p r i
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
9/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
nt l n (t h i s ) ; i nt t e m p = t h i s . t o ta l ; i f (t e m p > 5 ) { S y s t e m . o u t. p r i nt l n (t e m p ) ;
} } }
( a) T h e c o m pi l e r r e p o rt s an e r ro r a t l i n e 9 ( b ) T h e c l a s s w i l l n ot c om p i l e ( c )
T h e c o m pi l e r r e p o rt s an d e r ro r a t l i n e 2 ( d ) T h e va l u e 1 0 i s o n e of t h e e l e m e nt
s p r i nt e d t o t h e s t an d a r d o u t pu t
1 5. C o n s i d e r t h e f ol l ow i n g e x a m pl e : c l a s s F i rs t { p u b l i c F i rs t ( S tr i n g s ) { S y
s t e m . o u t. p r i nt l n (s ); } } p u b l i c c l as s S e c on d e xt e n d s F i r s t { p u b l i c s t at i c vo i
d m a i n (S t r i n g ar g s [ ] ) { n e w S e c o n d () ; } } W h a t i s t h e r e s u l t o f c o m p i l i n g a n
d r u n n i n g th e S e c o n d c l a s s ?
( a) o th i n g h a p p e n s ( b ) A n i n s ta n c e of t h e c l a s s S e c o n d i s c r e a te d ( c ) A n i n
s ta n c e of t h e c l a s s F i r s t i s ge n e ra t e d ( d ) T h e c l a s s s e c o n d w i l l n o t c o m p i l e a
s th e re i s n o nu l l p ar a m e t e r c o n s t r u c t or i n th e c l a s s F i rs t
1 6. W h a t i s t h e r e s u l t o f c o m p i l i n g a n d e x e c u t i n g t h e f o l l ow i n g J ava c l as s :
p u b l i c c l as s T h r e a d Te s t e x t e n d s T h r e ad { p u b l i c vo i d r u n ( ) { S y s t e m . o u t.
p r i nt l n ( I n ru n ) ; s u s p e n d ( ); r e s u m e ( ) ; S y s t e m . o u t. p r i nt l n ( L e av i n g r
u n ) ; - p u b l i c s t at i c vo i d m a i n (S t r i n g ar g s [ ] ) { ( n e w T h r e ad Te s t ( ) ). s ta r t ()
; } }
a) C o m p i l at i o n w i l l f ai l i n t h e m e th o d m ai n . ( b ) T h e s t r i n g I n r un w i l l b e p
r i nt e d to s ta n d a rd ou t . ( c ) A wa r n i n g w i l l b e g e n e r at e d f or m e t h o d r u n. ( d ) C
o m p i l at i o n w i l l f ai l i n t h e m e th o d ru n .
1 7. C o n s i d e r t h e f ol l ow i n g c o d e , p u b l i c c l as s Te s t { p u b l i c s t at i c vo i d m a i n
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
10/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
(S t r i n g ar g s * + ) S t r i n gB u ff e r a = n e w S t ri n g B u ff e r( On e ) ; S t r i n gB u ff e r b
= n e w S t r i n gB u ff e r ( T wo ); Te s t . s wa p (a , b ) ; S y s t e m . o u t. p r i nt l n ( a i s a
\ nb i s b ); } s t a ti c voi d s wap (S t r i n g B u ff e r a, S tr i n g B u ff e r b ) { a . ap p e n d
( m o r e ) ; b = a; - - W h a t w i l l b e t h e o u t p u t ?
( a) a i s On e b i s T wo ( b ) a i s On e m or e b i s T wo ( c ) a i s On e m or e b i s O n e m o re ( d ) a
i s On e b i s O n e
1 8. W h i ch c or r e c t l y c r e a t e a two d i m e n s i o n al ar r ay o f i nt e g e r s ?
( a) i nt [ ] a [ ] = n e w i nt [ 1 0 ] [ 10 ] ; ( b ) i nt a [ ] [ ] = n e w i nt [ 1 0, 1 0] ( c ) i nt a [ 10 ] [ 10 ]
= n e w i nt [ ] [ ] ; ( d ) i nt a [ i , j ] = n e w i nt [ 10 ] [ 1 0] ;
1 9. W h a t w i l l h a p p e n w h e n you c o m p i l e a n d r u n t h e f ol l ow i n g c o d e ? p u b l i c
c l as s M y C l a s s { s t a ti c i nt i ; p u b l i c s ta t i c vo i d m a i n (S t r i n g ar g v [ ] ) { S y s t e m
. ou t . p r i nt l n (i ) ; } } (
a) E r r or Va ri a b l e i m ay n o t h ave b e e n i n i ti a l i z e d ( b ) nu l l ( c ) 0 ( d ) 1
2 0. W h a t w i l l b e t h e r e s u l t w h e n yo u a tt e m p t t o c o m p i l e th i s p r og r am ? p u b
l i c c l as s R an d { p u b l i c s ta t i c vo i d m a i n (S t r i n g ar g v [ ] ) { i nt i R an d ; i R an d = M
at h . r an d o m ( ) ; S y s t e m . ou t . p r i nt l n (i R a n d ); } }
( a) A c om p i l e t i me e r r or ab o u t r an d o m b e i n g an u n re c og n i s e d m e t h o d ( b ) C o
m p i l e t i m e e r ro r r e f e rr i n g t o a c a s t p r ob l e m ( c ) A r a n d om nu mb e r b e twe e n 0
a n d 1 ( d ) A r a n d om nu mb e r b e twe e n 1 a n d 1 0
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
11/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
Set4
1 . W h a t i s t h e ar g u m e nt ty p e o f p r og r am s m a i n ( ) m e t h o d ?
( a) C h a r ac t e r ( b ) S t r i n g ( c ) S t r i n g a r r ay ( d ) C h a r ac t e r a r r ay
2 . H ow a re t h e var i a b l e s d e c l ar e d ? ( a) b e g i n n i n g of m e t h o d d e fi n i t i o n ( b ) a
ny w h e r e i n th e m e t h o d d e fi n i t i o n . ( c ) a ny w h e r e i n th e m e t h o d d e fi n i t i o n
a nd s h o u l d b e i n i t i al i z e d . ( d ) b e g i n n i n g of m e t h o d d e fi n i t i o n a n d s h o u l d
b e i n i t i al i z e d
3 . W h a t i s t h e d e f a u l t va l u e o f l on g p r i m i t i ve ty p e ? ( a) 0 ( b ) 1 ( c ) 0 1 ( d ) nu
4 . W h a t h a p p e n s w h e n t h e f ol l ow i n g p r o gr a m i s c o m p i l e d an d e x e c u t e d w i
t h t h e a r gu m e nt s j ava te s t. S e l e c t t h e on e c o r re c t an s we r . c l a s s te s t { p u b l i c
s t at i c vo i d m a i n (S t r i n g ar g s [ ] ) { i f ( a rg s . l e n g t h > 0 ) S y s t e m . o u t. p r i nt l n (a
r gs . l e n gt h ) ; } } ( a) T h e p r og ra m c om p i l e s a n d r u n s a n d p r i nt s 0 ( b ) T h e p r og
ra m c om p i l e s a n d r u n s b u t d o e s n o t p ri nt a ny th i n g . ( c ) D o e s n o t c o m p i l e ( d )
T h e p r og ra m c om p i l e s a n d r u n s a n d p r i nt s 1
5 . W h a t wou l d h ap p e n w h e n t he f o l l ow i n g i s c o m p i l e d a n d e x e c ut e d . S e l e c t t
h e on e c o rr e c t an s we r. c l a s s e x am p l e { i nt x ; i nt y ; S t r i n g n am e ; p u b l i c s t at i c
vo i d m a i n (S t r i n g ar g s [ ] ) { e x a m p l e p nt = n e w e x am p l e ( ) ; S y s t e m . o u t. p r i nt
l n ( p nt i s p nt . n a m e p nt. x p nt . y ) ; - - ( a) T h e p r og ra m d o e s n o t c o
mp i l e b e c au s e x , y a n d n a m e a r e n o t i n i t i al i z e d . ( b ) T h e p r og ra m t h r ow s a r u
nti m e e x c e p t i o n a s x , y, a n d n a m e a re u s e d b e f o r e i n i t i a l i z at i o n . ( c ) T h e p r
og ra m p r i nt s p nt i s nu l l 0 0 . ( d ) T h e p r og ra m p r i nt s p nt i s 0 0.
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
12/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
6 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a re c o r re c t . S e l e c t t h e on e c o rr e c t an s
we r . ( a) I f a J ava fi l e h as b o th i m p or t an d p a cka ge s t at e m e nt , t h e i m p o r t s ta t e
m e nt mu s t c om e b e f o r e p ackag e s ta t e m e nt . ( b ) E a ch J ava fi l e mu s t h ave e x a c t l
y on e p a cka ge s t at e m e nt t o s p e c i f y w h e re t h e c l as s i s s t or e d . ( c ) I f a J ava fi l e h
a s a p a cka ge s t a te m e nt , i t mu s t b e t h e fi r s t s ta t e m e nt ( e x c e p t c o m m e nt s ) . ( d )
A J ava fi l e h as a t l e as t on e c l a s s d e fi n e d
.
7 . W h a t i s a c on s t r u c t or ? ( a) c o n s t r u c t or i s a s p e c i al ki n d of m e t h o d t h at d e
t e rm i n e s h ow a n o b j e c t i s i n i t i a l i z e d w h e n d e s tr oye d . ( b ) A c on s t r u c t o r i s
a s p e c i a l k i n d o f m e t h o d t h a t d e t e r m i n e s h ow an ob j e c t i s i n i t i al i z e d . ( c ) A
c on s t r u c t o r i s a s p e c i a l k i n d o f m e t h o d t h a t d e t e r m i n e s h ow an ob j e c t i s i n
i t i al i z e d w h e n c r e at e d . ( d ) A c on s t r u c t o r i s a s p e c i a l k i n d o f m e t h o d t h a t
d e t e r m i n e s h ow an ob j e c t i s i n i t i al i z e d w h e n c al l e d .
8 . W h i ch o f th e f o l l ow i n g s t a t e m e nts c a n b e u s e d t o d e s c r i b e a p u b l i c m e t h o
d ? ( a) T h e on l y way t o ga i n a c c e s s t o t h i s m e th o d i s by c a l l i n g on e o f t h e c l as s m
e t h o d s ( b ) I t r e p r e s e nts t h e p u b l i c i nte rf ac e of i t s c l as s ( c ) . I t i s a c c e s s i b l e o
n l y t o s u b c l a s s e s o f i t s p ar e nt c l a s s ( d ) T h e on l y way t o ga i n a c c e s s t o t h i s m e
th o d i s by c a l l i n g on e o f t h e p u b l i c c l a s s m e t h o d s
9 . W h a t ar e ac c e s s m o d i fi e rs ?
( a) a b s t ra c t ( b ) s t a ti c ( c ) d e f a u l t ( d ) fi n a l
1 0. W h i ch c l as s d o e s b e g i n J ava c l as s h i e r a r chy ? ( a) AW T ( b ) S t r i n g ( c ) L an
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
13/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
g ( d ) O b j e c t
1 1. T h e d e f a u l t p ackag e i m p or t e d by a l l j ava p r o gr a m s i s
( a) j ava . s w i n g ( b ) j ava . ap p l e t ( c ) j ava . l an g ( d ) j ava . aw t
1 2. W h i ch m e th o d s c an b e l e ga l l y a p p l i e d t o a s t r i n g ob j e c t ?
( a) r ou n d ( ) ( b ) t r i m () ( c ) e q u a l (S t r i n g) ( d ) e q u l ( Ob j e c t )
1 3. W h i ch o f th e f o l l ow i n g i s i l l e g al :
( a) F l o at f =4 5. 0 ; ( b ) fl o at f = 45 . 0 ; ( c ) d o u b l e d = 4 5 . 0; ( d ) i nt i = 3 2; o n (b u t n o t
a R u nti m e E x c e p t i on ) w h a t i s t h e c o r re c t way f or a me th o d to i n d i c a t e t h a t
i t d o e s n ot h a n d l e th a t e x c e p t i o n : ( a) t h r ow E x c e p t i on ( b ) n e E x c e p t i on
( c ) D on t n e e d t o s p e c i f y a nyt h i n g ( d ) t h r ow s E x c e p t i on
1 5. W h a t class must an inner c l a s s e xt e n d : ( a) A ny c l a s s or i nt e r f a c e ( b ) T h e t op
le ve l c l a s s ( c ) I t mu s t e x te n d an i nte rf ac e ( d ) T h e Ob j e c t c l as s
1 6. W h a t i s t h e r e s u l t o f c o m p i l i n g a n d e x e c u t i n g t h e f o l l ow i n g J ava c l as s :
p u b l i c c l as s T h r e a d Te s t e x t e n d s T h r e ad { p u b l i c vo i d r u n ( ) { S y s t e m . o u t.
p r i nt l n ( I n ru n ) ; s u s p e n d ( ); r e s u m e ( ) ; S y s t e m . o u t. p r i nt l n ( L e av i n g r
u n ) ; - p u b l i c s t at i c vo i d m a i n (S t r i n g ar g s [ ] ) { ( n e w T h r e ad Te s t ( ) ). s ta r t () ;
} } ( a) A wa r n i n g w i l l b e g e n e r at e d f or m e t h o d r u n. ( b ) C o m p i l at i o n w i l l f ai l i
n t h e m e th o d ru n . ( c ) T h e s t r i n g I n r un w i l l b e p r i nt e d to s ta n d a rd ou t
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
14/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
. ( d ) C o m p i l at i o n w i l l f ai l i n t h e m e th o d m ai n .
1 7. C o n s i d e r t h e f ol l ow i n g c o d e , p u b l i c c l as s Te s t { p u b l i c s t at i c vo i d m a i n
(S t r i n g ar g s * + ) S t r i n gB u ff e r a = n e w S t ri n g B u ff e r( On e ) ; S t r i n gB u ff e r b
= n e w S t r i n gB u ff e r ( T wo ); Te s t . s wa p (a , b ) ; S y s t e m . o u t. p r i nt l n ( a i s a
\ nb i s b ); - s t a ti c voi d s wap (S t r i n g B u ff e r a, St r i n g B u ff e r b ) a . ap p e n d
( m o r e ) ; b = a; - - W h a t w i l l b e t h e o u t p u t ? ( a) a i s On e m or e b i s O n e m o re ( b )
a i s On e b i s T wo ( c ) a i s On e m or e b i s T wo ( d ) a i s On e b i s O n e
1 8. W h i ch c or r e c t l y c r e a t e a n a r ray of fi ve e m p ty S t r i n gs ? ( a) S t r i n g a [ ] = n e
w S tr i n g * 5 + ; f o r ( i nt i = 0 ; i < 5 ; a * i + = ) ; ( b ) S t r i n g a * 5+ ; ( c ) S t r i n g * + a = n
e w S tr i n g [ 5 ] ; f o r ( i nt i = 0 ; i < 5 ; a [ i ++ ] = nu l l ) ; ( d ) S t r i n g [ 5] a ;
o m m an d l i n e ? j ava myp r o g go o d m o r n i n g p u b l i c c l as s my p ro g { p u b l i c s ta t i c
vo i d m a i n (S t r i n g ar g v [ ] ) { S y s t e m . ou t . p r i nt l n (a r gv [ 2 ] ) } } ( a) m o rn i n g ( b )
E x c e p t i o n r ai s e d : j ava. l a n g. A r r ay I n d e x O u t Of B ou n d s E x c e p t i on : 2 ( c
) g o o d ( d ) my p ro g
2 0. G i ve n t h e f o l low i n g d e c l a r at i o n s S t r i ng s 1= n e w S tr i n g ( H e l l o ) S t r i ng
s 2= n e w S tr i n g ( t h e r e ); S t r i ng s 3= n e w S tr i n g ( ); W h i ch o f t h e f o l l ow i n g a re
l e g al op e r at i on s ? ( a) s 3 =s 1 && s 2 ( b ) s 3 =s 1 s 2; ( c ) s 3 =s 1 & s 2 ( d ) s 3 =s 1 + s 2;
Set5
1 . Which characters are as first characters of an identifier?
(a) / (b ) ? (c ) $ (d)*
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
15/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
2. How to invoke constructor method? (a) By calling explicitly using it s method
name (b) By calling explicitly using its class name (c ) By calling explicitly using
Static (d) By creating object.
3. Which of the following are primitive data types
(a) Integer (b) String (c) byte (d) Float
4 . What is the default value of byte primitive type? (a) ull (b) 1 (c) 0 (d) 1
5 . The signed right shift operator in Java is .
Select the one correct answer. (a) >> (b) >>>; (c)
-
8/7/2019 OOPSbyDevilsDuke.com
16/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
p r ot e c te d . ( d ) W h e n c l as s i s d e c l a r e d p r i va t e .
1 0. W h i ch o f th e f o l l ow i n g s t a t e m e nts c o r re c t l y d e s c r i b e s a n i nt e r f ac e ? ( a)
I t s a ty p e of a bs t ra c t c l a s s ( b ) I t s a c on c re te c l a s s ( c ) I t s a s u p e r c l a s s ( d ) I
t s fi n al c l as s
1 1. T h e ty p e of a va r i ab l e i n a n i nt e r f a c e ? ( a) i m p l i c i t l y fi n a l a n d s t a ti c . ( b )
a ny th i n g ( c ) i m p l i c i t l y fi n a l o n l y b u t n ot s t at i c ( d ) i m p l i c i t l y s t a ti c o n l y b
u t n ot fi n al
1 2. W h i ch o f th e f o l l ow i n g w r a p p e r c l a s s e s c a n n o t t a ke a S t r i n g i n c on s tr
u c t o r ( a) L on g ( b ) B o o l e a n ( c ) C h a r ac t e r ( d ) I nt e g e r
1 3. W h a t i s t h e p ar a m e t e r s p e c i fi c a ti o n f o r t h e p u b l i c s t a ti c voi d m ai n me th
o d ? ( a) S t r i n gs ar g s [ ] ( b ) S t r i n g [ ] ar g s ( c ) s t r i n g ar g s [ ] ( d ) S t r i n g ar gs
1 4. W h i ch o f th e f o l l ow i n g i s c o rr e c t: ( a) S t r i n g te m p * + = n e w S t ri n g j a
z - ; ( b ) S t r i n g te m p * + = a , b , c - ( c ) S t r i n g te m p = a , b , c - ( d )
S t r i n g te m p * + = j b c -
1 5. C o n s i d e r t h e f ol l ow i n g c l a s s e s : p u b l i c c l as s Te s t { p u b l i c s t at i c vo i d t e s
t ( ) { t h i s . p r i nt( ) ; } p u b l i c s t at i c vo i d p r i nt( ) { S y s t e m . o u t. p r i nt l n ( Te s t ) ;
} p u b l i c s t at i c vo i d m a i n (S t r i n g ar g s [ ] ) { t e s t ( ) ; } } W h a t i s t h e r e s u l t o f c o
m p i l i n g a n d r u n n i n g th i s c l a s s ? ( a) T h e c l a s s f ai l s t o c om p i l e s t at i n g t h at th
e va r i ab l e t h i s i s u n d e fi n e d . ( b ) o th i n g i s p r i nte d t o th e s t a n d ar d o u t p u t. ( c
) A n e xc e p t i on i s r ai s e d s t a t i n g th a t t h e var i a b l e t h i s c a n on l y b e u s e d w i t h i n
a n i n s ta n c e . ( d ) A n e xc e p t i on i s r ai s e d s t a t i n g th a t t h e m e th o d te s t c a n n ot b e
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
17/36
-
8/7/2019 OOPSbyDevilsDuke.com
18/36
-
8/7/2019 OOPSbyDevilsDuke.com
19/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 1. I f yo u d o n ot i m p l e m e nt al l t h e m e t h o d s o f an i nt e r f a c e w h i l e i m p l e m e nt
i n g , w h a t s p e c i fi e r s h o u l d yo u u s e f o r th e c l a s s ? ( a) p u b l i c ( b ) fi n a l ( c ) s t a ti
c ( d ) a b s t ra c t
1 2. W h i ch m e th o d s c an b e l e ga l l y a p p l i e d t o a s t r i n g ob j e c t ? ( a) e q u a l (S t r i
n g) ( b ) t r i m () ( c ) r ou n d ( ) ( d ) e q u l ( Ob j e c t )
1 3. W h a t d o e s t h e z e r ot h e l e m e nt o f t h e s t ri n g a r r ay p a s s e d to t h e p u b l i c s ta
t i c voi d m ai n m e t h o d c o nt a i n ? ( a) T h e nu mb e r of a rg u m e nt s ( b ) T h e n am e of t h
e c l as s ( c ) T h e n am e of t h e p r o gr a m ( d ) T h e fi r s t a rg u m e nt i f on e i s p r e s e nt
1 4. A s s u mi n g a m e t h o d c ont ai n s c o d e w h i ch m ay r a i s e a n E x c e p t i o n (b u t n o t
a R u nti m e E x c e p t i on ) w h a t i s t h e c o r re c t way f or a me th o d to i n d i c a t e t h a t i t
d o e s n ot h a n d l e th a t e x c e p t i o n : ( a) D on t n e e d t o s p e c i f y a nyt h i n g ( b ) t h r
ow E x c e p t i on ( c ) t h r ow s E x c e p t i on ( d ) n e w E x c e p t i on
1 5. W h e r e i n a c o n s t ru c to r , c a n yo u p l ac e a c a l l t o a c o n s t r u c t or d e fi ne d i n t h
e s u p e r c l as s ? ( a) T h e l as t s t at e m e nt i n t h e c o n s t r u c t or ( b ) T h e fi r s t s t a te me
nt i n t h e c on s t r u c t or ( c ) A ny w h e r e ( d ) Yo u c an t c al l s u p e r i n a c on s tr u c t o r
1 6. W h a t i s t h e r e s u l t o f c o m p i l i n g a n d e x e c u t i n g t h e f ol l ow i n g J ava c l as s :
p u b l i c c l as s T h r e a d Te s t e x t e n d s T h r e ad { p u b l i c vo i d r u n ( ) { S y s t e m . o u t.
p r i nt l n ( I n ru n ) ; s u s p e n d ( ); r e s u m e ( ) ; S y s t e m . o u t. p r i nt l n ( L e av i n g r
u n ) ; - p u b l i c s t at i c vo i d m a i n (S t r i n g ar g s [ ] ) { ( n e w T h r e ad Te s t ( ) ). s ta r t () ;
} } ( a) A wa r n i n g w i l l b e g e n e r at e d f or m e t h o d r u n. ( b ) C o m p i l at i o n w i l l f ai l i
n t h e m e th o d ru n . ( c ) C o m p i l at i o n w i l l f ai l i n t h e m e th o d m ai n . ( d ) T h e s t r i n
g I n r un w i l l b e p r i nt e d to s ta n d a rd ou t .
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
20/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 7. C o n s i d e r t h e f ol l ow i n g c o d e , p u b l i c c l as s Te s t { p u b l i c s ta t i c vo i d m a i n
(S t r i n g ar g s * + ) S t r i ng B u ff e r a = n e w S tr i n g B u ff e r( On e ) ; S t r i ng B u ff e r
b = n e w S t r i n gB u ff e r ( T wo ) ; Te s t . s wa p (a , b ) ; S y s t e m . ou t . p r i nt l n ( a i s
a \ nb i s b ) ; - s t a ti c voi d s wap (S t r i n g B u ff e r a , S t r i n g B u ff e r b ) a . ap p e n
d ( m o r e ) ; b = a; - - W h a t w i l l b e t h e o u t p u t? ( a) a i s On e m or e b i s O n e m o re ( b
) a i s On e b i s T wo ( c ) a i s On e m or e b i s T wo ( d ) a i s On e b i s O n e
1 8. W h i ch a r e ke y wor d s i n J ava ? ( a) f r i e n d ( b ) s i z e of ( c ) e x t e n d s ( d ) U L L
1 9. W h a t w i l l b e p r i nte d o u t i f t h i s c o d e i s r u n w i t h t h e f ol l ow i n g c o m m an d l
i n e ? j ava myp r o g go o d m o r n i n g p u b l i c c l as s my p ro g { p u b l i c s ta t i c vo i d m a i
n (S t r i n g ar g v [ ] ) { S y s t e m . ou t . p r i nt l n (a r gv [ 2 ] ) } } ( a) my p ro g ( b ) E x c e p t i o
n r ai s e d : j ava. l a n g. A r r ay I n d e x O u t Of B ou n d s E x c e p t i on : 2 ( c ) m o rn i n g (
d ) g o o d
2 0. G i ve n t h e f o l low i n g d e c l a r at i o n s S t r i ng s 1= n e w S tr i n g ( H e l l o ) S t r i
ng s 2= n e w S tr i n g ( t h e r e ); S t r i ng s 3= n e w S tr i n g ( ); W h i ch o f t h e f o l l ow i n g
a re l e g al op e r at i on s ? ( a) s 3 =s 1 && s 2 ( b ) s 3 =s 1 + s 2; ( c ) s 3 =s 1 & s 2 ( d ) s 3 =s 1s 2;
Set7
1 . Extension o f a fi l e c r e a te d by c o m p i l i n g a s ou r c e fi l e is .
( a) e x e ( b ) d a t ( c ) b a t ( d ) c l a s s
2 . W h a t ar e va ri a b l e s ?
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
21/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
( a) Va r i ab l e s a r e l o c a ti o n s i n m e m o ry th a t c a n h o l d val u e s .
( b ) Va r i ab l e s a r e p o i nte rs t o m e m o ry t h a t c a n h o l d va l u e s
. ( c ) Va r i ab l e s a r e l o c a ti o n s i n m e m o ry th a t c a n h o l d t h e ad d r e s s e s
( d ) Va r i ab l e s a r e p o i nte rs t o m e m o ry t h a t c a n h o l d t h e a d d r e s s e s
3 . W h i ch o f th e f o l l ow i n g d e c l ar e a n a r r ay o f s tr i n g o b j e c ts ?
( a) S t r i n g[ s ] : ( b ) C h a r [ s ] ; ( c ) S t r i n g[ ] s ; ( d ) C h a r [ ] s ;
4 . W h a t i s t h e d i ff e r e n c e b e twe e n b r e a k a n d c o nti nu e ?
( a) b r e a k h al t s th e e x e c u t i o n o f t h e c u rr e nt l o o p a n d f o rc e s c ont r ol o u
t o f t h e l o o p . c o nti nu e i s s i mi l a r t o b r e ak , e x c e p t th a t i n s t e a d o f h a l t i n g th e
e x e c u t i o n o f t h e l o o p , i t s ta r t s t h e n e x t i t e r at i on .
( b ) b o t h w i l l e xi t th e l o op
( c ) b r e a k s t ar t s t h e n e x t i te ra t i on of t he c u r r e nt l o op . c o nti nu e i s s i m i l
a r t o b re ak , s ta r ts h a l ti n g t h e e xe c u t i on o f t h e l o o p .
( d ) b o t h w i l l c ont i nu e t h e lo o p
5 . W h a t i s t h e l e g al r a n ge o f val u e s f o r a va r i ab l e d e c l a re d a s a by t e . S e l e c t th
e o n e c o r re c t a n s we r .
( a) 0 t o 25 6 ( b ) 1 2 8 to 1 27 ( c ) 0 t o 25 5 ( d ) 1 2 8 to 1 28
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
22/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
6 . W h i ch e xp r e s s i on c an b e u s e d t o a c c e s s t h e l a s t e l e m e nt o f a n a rr ay. S e l e c
t t he o n e c o r r e c t a n s we r .
( a) a rr ay[ a r ray. l e n g t h ] ( b ) a rr ay[ a r ray. l e n g t h 1] ( c ) a rr ay[ a r ray. l e
n g t h () 1 ] ( d ) a rr ay[ a r ray. l e n g t h () ]
7 . W h i ch c as t mu s t b e u s e d t o c a s t a n o b j e c t t o an o t h e r c l a s s ? ( a) Ty p e c as t (
b ) I m p l i c t c as t ( c ) E x p l i c i t c as t . ( d ) s p e c i fi c c as t
8 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a c c u r at e l y d e s c r i b e th e u s e of a c c e s s
m o d i fi e r s w i t h i n a c l as s d e fi n i t i o n ?
( a) T h e y mu s t b e a p p l i e d to d a t a va ri a b l e s fi r s t a n d t h e n t o m e t h o d s
( b ) T h e y c an f ol l ow a c l as s s d a t a va ri a b l e s or m e th o d s (
c ) T h e y mu s t b e a p p l i e d to m e t h o d s fi rs t an d t h e n t o d at a var i a b l e s
( d ) T h e y c an ap p e ar i n any o r d e r
9 . I d e nt i f y t h e t ru e s t at e m e nt s ab ou t fi n a l i z a ti o n . i ) A c l as s m ay h ave o n l y o n
e fi n a l i z e m e th o d i i ) F i n a l i z e r s ar e m o s t l y u s e d w i t h s i m pl e c l a s s e s i i i ) F i n
a l i z e r ove r l o ad i n g i s n o t al l owe d
( a) i i & i i i ( b ) i & i i i ( c ) i & i i ( d ) i & i i & i i i
1 0. F i n a l va r i ab l e s s h o u l d b e d e c l a r e d i n th e
. ( a) i n s i d e c o n s t r u c t or s ( b ) o u ts i d e t h e m e th o d s ( c ) i n s i d e m e t h o d s ( d ) i n
s i d e c l a s s e s
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
23/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 1. I f yo u d o n ot i m p l e m e nt al l t h e m e t h o d s o f an i nt e r f a c e w h i l e i m p l e m e nt
i n g , w h a t s p e c i fi e r s h o u l d yo u u s e f o r th e c l a s s ?
( a) fi n a l ( b ) a b s t ra c t ( c ) p u b l i c ( d ) s t a ti c
1 2. c o l ou r i s u s e d t o i n d i c at e i n s t an c e m e t h o d s i n t h e s t a n d ar d j ava d o c f
or m a t d o c u m e nta t i on
( a) o ra n g e ( b ) b l u e ( c ) r e d ( d ) p u r p l e
1 3. W h a t d o e s t h e z e r ot h e l e m e nt o f t h e s t ri n g a r r ay p a s s e d to t h e p u b l i c s ta
t i c voi d m ai n m e t h o d c o nt a i n ?
( a) T h e nu mb e r of a rg u m e nt s
( b ) T h e n am e of t h e p r o gr a m
( c ) T h e n am e of t h e c l as s
( d ) T h e fi r s t a rg u m e nt i f on e i s p r e s e nt
1 4. A s s um i n g a m e t h o d c ont ai n s c o d e w h i ch m ay r a i s e a n E x c e p t i o n (b u t n o t
a R u nti m e E x c e p t i on ) w h a t i s t h e c o r re c t way f or a m e th o d to i n d i c a t e t h a t i t
d o e s n ot h a n d l e th a t e x c e p t i o n :
( a) n e w E x c e p t i on
( b ) D on t n e e d t o s p e c i f y a nyt h i n g
( c ) t h r ow E x c e p t i on
( d ) t h r ow s E x c e p t i on
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
24/36
-
8/7/2019 OOPSbyDevilsDuke.com
25/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 8. W h i ch a r e ke y wor d s i n J ava ?
( a) f r i e n d ( b ) U L L ( c ) s i z e of ( d ) e x t e n d s
1 9. W h i ch o f th e f o l l ow i n g l i n e s w i l l c om p i l e w i t h ou t wa r n i n g or e rr o r
. ( a) by te b = 25 7; ( b ) i nt i = 10 ; ( c ) b o o l e an b =nu l l ; ( d ) ch a r c = a ;
2 0. W h a t w i l l h a p p e n i f you at t e m p t t o c o m p i l e a n d r u n t h e f o ll ow i n g c o d e ?
I nt e g e r t e n = ne w I nt e g e r ( 10 ) ; L on g n i n e =n e w L on g ( 9 ); S y s t e m . o u t. p r i nt l
n (t e n + n i n e ) ; i nt i = 1; S y s t e m . o u t. p r i nt l n (i + t e n ) ; ( a) 1 0 f ol l o e d by 1 ( b ) 1 9
f ol l owe d by 2 0( c ) E r r or : C an t c o nve rt j ava l a n g I nt e g e r
( d ) 1 9 f ol l owe d by 1 1
Set8
1 . T h e J ava i nt e r p r e t e r i s u s e d f or t h e o f t h e s ou r c e c o d e . ( a) d e b u g gi n g ( b ) e
x e c u t i o n ( c ) c o m p i l i n g ( d ) c r e a t i on
2 . W h a t ar e va ri a b l e s ? ( a) Va r i ab l e s a r e p o i nte rs t o m e m o ry t h a t c a n h o l d t h
e a d d r e s s e s ( b ) Va r i ab l e s a r e p o i nte rs t o m e m o ry t h a t c a n h o l d va l u e s . ( c )
Va r i ab l e s a r e l o c a ti o n s i n m e m o ry th a t c a n h o l d val u e s . ( d ) Va r i ab l e s a r e l o
c a ti o n s i n m e m o ry th a t c a n h o l d t h e ad d r e s s e s
3 . W h i ch o f th e f o l l ow i n g d e c la r e a n a r r ay o f s tr i n g o b j e c ts ? ( a) S t r i n g[ ] s ; (
b ) C h a r [ s ] ; ( c ) S t r i n g[ s ] : ( d ) C h a r [ ] s ;
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
26/36
-
8/7/2019 OOPSbyDevilsDuke.com
27/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
10. F i n a l va r i ab l e s s h o u l d b e d e c l a r e d i n th e . ( a) i n s i d e c l a s s e s ( b ) i n s i d
e m e t h o d s ( c ) i n s i d e c o n s t r u c t or s ( d ) o u ts i d e t h e m e th o d s
11. A l l t h e c l a s s e s i n a p a cka ge c a n b e s i mu l ta n e o u s l y i m p o r t e d u s i n g . ( a) d
o t ( b ) s e m i c ol o n ( c ) c o m m a ( d ) s t a r
12.W h i ch o n e d o e s n o t e x t e n d j ava . l an g . u mb e r ( a) I nt e g e r ( b ) B o o l e a n ( c )
S h o rt ( d ) L on g
13.W h i ch o f th e f o l l ow i n g i s i l l e g al : ( a) d o u b l e d = 4 5 . 0; ( b ) fl o at f = 45 . 0 ; ( c ) F
l o at f =4 5. 0 ; ( d ) i nt i = 3 2;
14. A s s um i n g a m e t h o d c ont ai n s c o d e w h i ch m ay r a i s e a n E x c e p t i o n (b u t n o t
a R u nti m e E x c e p t i on ) w h a t i s t h e c o r re c t way f or a m e th o d to i n d i c a t e t h a t i t
d o e s n ot h a n d l e th a t e x c e p t i o n : ( a) t h r ow s E x c e p t i on ( b ) t h r ow E x c e p t i on
( c ) n e w E x c e p t i on ( d ) D on t n e e d t o s p e c i f y a nyt h i n g
15. W h e r e i n a c o n s t ru c to r , c a n yo u p l ac e a c a l l t o a c o n s t r u c t or d e fi ne d i n t h
e s u p e r c l as s ? ( a) A ny w h e r e ( b ) T h e l as t s t at e m e nt i n t h e c o n s t r u c t or ( c ) Yo
u c an t c al l s u p e r i n a c on s tr u c t o r ( d ) T h e fi r s t s t a te me nt i n t h e c on s t r u c t or
16. W h a t i s t h e r e s u l t o f c o m p i l i n g a n d e x e c u t i n g t h e f o l l ow i n g J ava c l as s :
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
28/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
p u b l i c c l as s T h r e a d Te s t e x t e n d s T h r e ad { p u b l i c vo i d r u n ( ) { S y s t e m . o u t.
p r i nt l n ( I n ru n ) ; s u s p e n d ( ); r e s u m e ( ) ; S y s t e m . o u t. p r i nt l n ( L e av i n g r
u n ) ; - p u b l i c s t at i c vo i d m a i n (S t r i n g ar g s * + ) ( n e w T h r e ad Te s t ( ) ). s ta r t ()
; } }
( a) A wa r n i n g w i l l b e g e n e r at e d f or m e t h o d r u n. ( b ) C o m p i l at i o n w i l l f ai l i n
t h e m e th o d ru n . ( c ) T h e s t r i n g I n ru n w i l l b e p r i nt e d to s ta n d a rd ou t . ( d ) C
o m p i l at i o n w i l l f ai l i n t h e m e th o d m ai n .
17. A f t e r t h e s e two l i n e s o f c o d e : S t r i n g s = D ol l y ; S t r i n g t = s . c o n c at ( H e
l l o, ) ; W h a t ch ar a c t e r s w i l l t h e o b j e c t r e f e r e n c e t c o nta i n ?
( a) H e l l o, ( b ) Do l l y H e l l o , ( c ) Do l l y ( d ) H e l l o, D ol l y
1 8. W h i ch s ta t e m e nt i s tr u e ab ou t a n o n s t a t i c i n n e r c l as s ? ( a) I t c an ac c e s s p
ri vat e i n s t an c e va r i ab l e s i n t h e e n c l o s i n g o b j e c t . ( b ) I t i s a c c e s s i b l e f r o m a
ny ot h e r c l as s . ( c ) I t c an on l y b e i n s t a nt i a t e d i n th e e n c l o s i n g c l a s s . ( d ) I t mu
s t i m p l e m e nt an i nte rf ac e .
19. W h i ch o f th e f o l l ow i n g a r e l e g al i d e nt i fi e r s ( a) # my va r ( b ) 2 va ri a b l e ( c ) 1
23 4 ( d ) 3
2 0. W h a t w i l l h a p p e n i f you at t e m p t t o c o m p i l e a n d r u n t h e f o ll ow i n g c o d e ?
I nt e g e r t e n = ne w I nt e g e r ( 10 ) ; L on g n i n e =n e w L on g ( 9 ); S y s t e m . o u t. p r i nt l
n (t e n + n i n e ) ; i nt i = 1; S y s t e m . o u t. p r i nt l n (i + t e n ) ;
( a) 1 9 f ol l owe d by 20 ( b ) E r r or : C an t c o nve rt j ava l a n g I nt e g e r ( c ) 1 0 f ol l owe d
by 1 ( d ) 1 9 f ol l owe d by 1 1
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
29/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
Set9
1.W h a t i s t h e ar g u m e nt ty p e o f p r og r am s m a i n ( ) m e t h o d ? ( a) S t r i n g ( b ) C h
a r ac t e r a r r ay ( c ) C h a r ac t e r ( d ) S t r i n g a r r ay
2 . H ow a re t h e var i a b l e s d e c l ar e d ? ( a) b e g i n n i n g of m e t h o d d e fi n i t i o n a n d s
h o u l d b e i n i t i al i z e d ( b ) a ny w h e r e i n th e m e t h o d d e fi n i t i o n a nd s h o u l d b e i
n i t i al i z e d . ( c ) b e g i n n i n g of m e t h o d d e fi n i t i o n ( d ) a ny w h e r e i n th e m e t h o d
d e fi n i t i o n .
3 . W h i ch o p e r a to r i s t o c r e at e an d c on c at e n a t e s t r i n g? ( a) + ( b ) & ( c ) & & ( d )
+ +
4 . W h a t i s t h e d e f a u l t va l u e o f by t e p r i m i t i ve ty p e ? ( a) 1 ( b ) nu l l ( c ) 1 ( d ) 0
5 . W h a t wou l d h ap p e n w h e n t he f o l l ow i n g i s c o m p i l e d a n d e x e c ut e d . S e l e c t
t h e on e c o rr e c t an s we r. c l a s s e x am p l e { i nt x ; i nt y ; S t r i n g n am e ; p u b l i c s t at i c
vo i d m a i n (S t r i n g ar g s [ ] ) { e x a m p l e p nt = n e w e x am p l e ( ) ; S y s t e m . o u t. p r i nt
l n ( p nt i s p nt . n a m e p nt. x p nt . y ) ; - - ( a) T h e p r og ra m p r i nt s p nt i
s nu l l 0 0 . ( b ) T h e p r og ra m t h r ow s a r u nti m e e x c e p t i o n a s x , y, a n d n a m e a re u s
e d b e f o r e i n i t i a l i z at i o n . ( c ) T h e p r og ra m d o e s n o t c o mp i l e b e c au s e x , y a n d
n a m e a r e n o t i n i t i al i z e d . ( d ) T h e p r og ra m p r i nt s p nt i s 0 0.
6 . W h i ch e xp r e s s i on c an b e u s e d t o a c c e s s t h e l a s t e l e m e nt o f a n a rr ay. S e l e c
t t he o n e c o r r e c t a n s we r . ( a) a rr ay[ a r ray. l e n g t h () ] ( b ) a rr ay[ a r ray. l e n g t h 1]
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
30/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
( c ) a rr ay[ a r ray. l e n g t h ] ( d ) a rr ay[ a r ray. l e n g t h () 1 ]
7 . H ow c a n c l a s s b e i mp or t e d t o a p r og r am ? ( a) i m p o r t c l as s n am e ; ( b ) i m p o r t
c l as s n a me *; ( c ) i m p o r t c l as s n am e : ( d ) i m p o r t c l as s n a me . *;
8 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a c c u r at e l y d e s c r i b e th e u s e of a c c e s s m
o d i fi e r s w i t h i n a c l as s d e fi n i t i o n ? ( a) T h e y c an f ol l ow a c l as s s d a t a va ri a b l
e s or m e th o d s ( b ) T h e y mu s t b e a p p l i e d to m e t h o d s fi rs t an d t h e n t o d at a var i a
b l e s ( c ) T h e y mu s t b e a p p l i e d to d a t a va ri a b l e s fi r s t a n d t h e n t o m e t h o d s ( d )
T h e y c an ap p e ar i n any o r d e r
9 . I d e nt i f y t h e t ru e s t at e m e nt s ab ou t fi n a l i z a ti o n . i ) A c l as s m ay h ave o n l y o n
e fi n a l i z e m e th o d i i ) F i n a l i z e r s ar e m o s t l y u s e d w i t h s i m pl e c l a s s e s i i i ) F i n
a l i z e r ove r l o ad i n g i s n o t al l owe d ( a) i & i i ( b ) i & i i & i i i ( c ) i & i i i ( d ) i i & i i i
1 0. W h i ch m e th o d s i n t h e O b j e c t c l a s s ar e d e c l a re d a s fi n a l ? ( a) g e t C l as s ( ) (
b ) n o ti f yM e ( ) ( c ) g e t M e t h o d () ( d ) g e t ()
1 1. A l l t h e c l a s s e s i n a p a cka ge c a n b e s i mu l t an e o u s l y i m p o r t e d u s i n g . ( a) c
o m m a ( b ) d o t ( c ) s t a r ( d ) s e m i c ol o n
1 2. W h i ch o n e d o e s n o t h ave a val u e O f ( S t r i n g) m e th o d
( a) I nt e g e r ( b ) L on g ( c ) B o o l e a n ( d ) C h a r ac t e r
1 3. W h i ch o f th e f o l l ow i n g i s i l l e g al :
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
31/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
( a) d o u b l e d = 4 5 . 0; ( b ) fl o at f = 45 . 0 ; ( c ) F l o at f =4 5. 0 ; ( d ) i nt i = 3 2;
1 4. W h i ch o f th e f o l l ow i n g a r e s o c al l e d s h o r t c i r c u i t l og i c a l o p e r a to r s ? (
a) | ( b ) & ( c ) & & ( d ) !
1 5. W h e r e i n a c o n s t ru c to r , c a n yo u p l ac e a c a l l t o a c o n s t r u c t or d e fi ne d i n t h
e s u p e r c l as s ? ( a) T h e fi r s t s t a te me nt i n t h e c on s t r u c t or ( b ) A ny w h e r e ( c ) Yo
u c an t c al l s u p e r i n a c on s tr u c t o r ( d ) T h e l as t s t at e m e nt i n t h e c o n s t r u c t or
1 6. W h i ch o p e r a to r s a r e ove rl o a d e d f o r S t r i n g ob j e c t s ? ( a) & ( b ) >> ( c ) ( d
) + =
1 7. T h e && o p e r a to r wo r ks w i t h w h i ch d at a typ e s ? ( a) b o o l e an ( b ) d o u b l e ( c )
i nt ( d ) l o n g
1 8. W h i ch i s t h e a d va nta g e o f e n c ap s u la t i on ? ( a) M a k i n g th e c l a s s fin a l c au s e
s n o c o n s e q u e nt i al ch an g e s t o ot h e r c o d e . ( b ) o e x c e p t i o n s n e e d t o b e th r ow
n f r o m a ny m e th o d . ( c ) O n l y p u b l i c m e t h o d s ar e n e e d e d . ( d ) I t ch a n ge s t h e i
m p l e m e nt a ti o n w i t h o u t ch an g i n g t he i nte rf ac e an d c au s e s n o c o n s e q u e nt i al
ch an g e s t o o th e r c o d e .
1 9. W h a t w i l l h a p p e n i f you t ry to c o m p i l e an d ru n th e f o l l ow i n g c o d e ? p u b l i
c c l as s Q { p u b l i c s t at i c vo i d m a i n (S t r i n g ar g v [ ] ) { i nt a n ar [ ] =n e w i nt [ 5] ; S y s
t e m . o u t. p r i nt l n (a n a r[ 0 ] ) ; } } ( a) E r r or : a n a r i s r e f e re n c e d b e f or e i t i s i n i ti
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
32/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
a l i z e d ( b ) nu l l ( c ) 5 ( d ) 0
2 0. G i ve n t h e f o l l ow i n g c o d e w h at w i l l b e ou t p u t ? p u b l i c c l as s Pa s s { s t a ti c i
nt j = 20 ; p u b l i c s t at i c vo i d m a i n (S t r i n g ar g v [ ] ) { i nt i = 10 ; Pa s s p = n e w Pas s () ;
p . a m e t h o d ( i ) ; S y s t e m . o u t. p r i nt l n (i ) ; S y s t e m . o u t. p r i nt l n (j ); } p u b l i c vo i
d a m e t h o d ( i nt x ) { x =x * 2; j = j * 2; } } ( a) 1 0, an d 20 ( b ) 1 0 an d 40 ( c ) E r r or : a m e t h
o d p a ra m e t e r d o e s n ot m at ch var i a b l e ( d ) 2 0 an d 40
Set10
1 . E x t e n s i o n o f a fi l e c r e a te d by c o m p i l i n g a s ou r c e fi l e i s . ( a) b a t ( b ) e x e ( c )
d a t ( d ) c l a s s
2 . H ow c a n you d e fi n e a mu l t i l i n e c o m m e nt ? ( a) ( b ) / * */ ( c ) / ** * / ( d ) / /
3 . W h a t i s t h e d e f a u l t va l u e o f cha r p r i m i t i ve typ e ? ( a) 1 ( b ) 0 ( c ) 1 ( d ) nu l
l
4 . T h e ot h e r n a m e f or c on d i t i o n al op e ra t or i s ( a) t e r n ar y ( b ) i d e nt i c al l y e q u
al to ( c ) t e r t i ar y ( d ) e q u a l t o
5 . T h e i n i t i al val u e o f an i n s t a nc e va ri a b l e of ty p e S t ri n g t h at i s n ot e x p l i c i t l y
i n i t i a l iz e d i n t h e p r og r am i s . S e l e c t t h e o n e c or r e c t a n s we r . ( a) ( b ) U L
L ( c ) nu l l ( d ) 0
6 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a re c o r re c t . S e l e c t t h e on e c o r re c t an s
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
33/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
we r . ( a) E a ch J ava fi l e mu s t h ave e x a c t l y on e p a cka ge s t at e m e nt t o s p e c i f y w h e
re t h e c l as s i s s t or e d . ( b ) A J ava fi l e h as a t l e as t on e c l a s s d e fi n e d . ( c ) I f a J ava fi
l e h a s a p a cka ge s t a te m e nt , i t mu s t b e t h e fi r s t s ta t e m e nt ( e x c e p t c o m m e nt s
) . ( d ) I f a J ava fi l e h as b o th i m p or t an d p a cka ge s t at e m e nt , t h e i m p o r t s ta t e m e
nt mu s t c om e b e f o r e p ackag e s ta t e m e nt .
7 . W h i ch i s u s e d t o ge t t h e va l u e o f th e i n s t an c e var i a b l e s ? ( a) . ( D ot ) ( b ) < ( d ) > >
8 . W h i ch o f th e f o l l ow i n g s t a t e m e nts a c c u r at e l y d e s c r i b e th e u s e of a c c e s s
m o d i fi e r s w i t h i n a c l as s d e fi n i t i o n ? ( a) T h e y mu s t b e a p p l i e d to m e t h o d s fi
rs t an d t h e n t o d at a var i a b l e s ( b ) T h e y c an ap p e ar i n any o r d e r ( c ) T h e y c an f ol
l ow a c l as s s d a t a va ri a b l e s or m e th o d s ( d ) T h e y mu s t b e a p p l i e d to d a t a va ri
a b l e s fi r s t a n d t h e n t o m e t h o d s
9 . I d e nt i f y t h e t ru e s t at e m e nt s ab ou t fi n a l i z a ti o n . i ) A c l as s m ay h ave o n l y o n
e fi n a l i z e m e th o d i i ) F i n a l i z e r s ar e m o s t l y u s e d w i t h s i m pl e c l a s s e s i i i ) F i n
a l i z e r ove r l o ad i n g i s n o t al l owe d ( a) i & i i i ( b ) i & i i & i i i ( c ) i & i i ( d ) i i & i i i
1 0. W h i ch o f th e f o l l ow i n g s t a t e m e nts c o r re c t l y d e s c r i b e s a n i nt e r f ac e ? ( a)
I t s fi n al c l as s ( b ) I t s a s u p e r c l a s s ( c ) I t s a c on c re te c l a s s ( d ) I t s a ty p e ofa
b s t ra c t c l a s s
1 1. T h e d e f a u l t p ackag e i m p or t e d by a l l j ava p r o gr a m s i s ( a) j ava . ap p l e t ( b )
j ava . aw t ( c ) j ava . l an g ( d ) j ava . s w i n g
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
34/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
1 2. I nt e r f a c e s ar e u s e d t o a ch i e ve . ( a) H i e r a rch i c al i n h e ri t a n c e ( b ) M u l t i
l e ve l i n h e r i t a n c e ( c ) M u l t i p l e i n h e ri t a n c e ( d ) H y b r i d i n h e r i t an c e
1 3. W h i ch o f th e f o l l ow i n g a r e J ava ke ywo r d s ( a s o p p o s e d to r e s e rve d or d s ) ?
( a) FA L S E ( b ) g ot o ( c ) e x t e n d s ( d ) m a l l o c
1 4. W h i ch o f th e f o l l ow i n g i s c o rr e c t: ( a) S t r i n g te m p * + = n e w S t ri n g j a
z - ; ( b ) S t r i n g te m p = a , b , c - ( c ) S t r i n g te m p * + = a , b , c - (
d ) S t r i n g te m p * + = j b c -
1 5. W h a t c l a s s mu s t an i n ne r c l a s s e xt e n d : ( a) A ny c l a s s or i nt e r f a c e ( b ) T h e t
op l e ve l c l a s s ( c ) I t mu s t e x te n d an i nte rf ac e ( d ) T h e Ob j e c t c l as s
1 6. W h i ch o p e r a to r s a r e ove rl o a d e d f o r S t r i n g ob j e c t s ? ( a) ( b ) + = ( c ) & ( d )
> >
1 7. A f t e r t h e s e two l i n e s o f c o d e : S t r i n g s = D ol l y ; S t r i n g t = s . c o n c at ( H e
l l o, ) ; W h a t ch ar a c t e r s w i l l t h e o b j e c t r e f e r e n c e t c o nta i n ? ( a) Do l l y ( b )
H e l l o, D ol l y ( c ) H e l l o, ( d ) Do l l y H e l l o ,
1 8. W h i ch a r e ke y wor d s i n J ava ? ( a) f r i e n d ( b ) U L L ( c ) e x t e n d s ( d ) s i z e of
1 9. W h i ch o f th e f o l l ow i n g l i n e s i l l c om p i l e w i t h ou t wa r n i n g or e rr o r . ( a) b o
o l e an b =nu l l ; ( b ) by te b = 25 7; ( c ) i nt i = 10 ; ( d ) ch a r c = a ;
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
35/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
2 0. G i ve n t h e f o l l ow i n g c o d e w h at w i l l b e ou t p u t ? p u b l i c c l as s Pa s s { s t a ti c i
nt j = 20 ; p u b l i c s t at i c vo i d m a i n (S t r i n g ar g v [ ] ) { i nt i = 10 ; Pa s s p = n e w Pas s () ;
p . a m e t h o d ( i ) ; S y s t e m . o u t. p r i nt l n (i ) ; S y s t e m . o u t. p r i nt l n (j ); } p u b l i c vo i
d a m e t h o d ( i nt x ) { x =x * 2; j = j * 2; } } ( a) 1 0 an d 40 ( b ) 1 0, an d 20 ( c ) E r r or : a m e t h
o d p a ra m e t e r d o e s n ot m at ch var i a b l e ( d ) 2 0 an d 40
Answers:
Set 1 set2 set3 set4 set6 set5 set7 set8 set9 set10
1:b 1.b 1.D 1.c 1.c 1. C 1. d 1 B 1.D 1)
2a 2.c 2.A 2.b 2.d 2. D 2. a 2 C 2.D 2)
3d 3.c 3.D 3.c 3.b 3. C 3. c 3.A 3.A 3)
4c 4.d 4.A 4.b 4.a 4. C 4. a 4.A 4.D 4)
5a 5.c 5.B 5.c 5.c 5. A 5. b 5 B 5.A 5)
6d 6.b 6.C 6.c 6.c 6. C 6. b 6 B 6.B 6)
7a 7.b 7.D 7.c 7.a 7. D 7. d 7 D 7.A 7)
8a 8.b 8.B 8.b 8.c 8. A 8. d 8 B 8.D 8)
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/ -
8/7/2019 OOPSbyDevilsDuke.com
36/36
For latest Technology news, Social Media news, JNTU Stuff, Project Ideas and Seminar Topics visit us at
http://www.devilsduke.comand our discussions forumhttp://www.web.devilsduke.com
9c 9.a 9.D 9.c 9.c 9. B 9. b 9 D 9.C 9)
10a 10.b 10.D 10.d 10.a 10. A 10. d 10.A 10.A 10)
11c 11.c 11.D 11.c 11.d 11. A 11. b 11 D 11.C 11)
12c 12.a 12.D 12.b 12.b 12. C 12. c 12 B 12.D 12)
13c 13.a 13.B 13.b 13.d 13. B 13. d 13 B 13.B 13)
14d 14.b 14.D 14.d 14.c 14. B 14. d 14 A 14.C 14)
15d 15.c 15.D 15.a 15.b 15. A 15. a 15 D 15.A 15)
16d 16.d 16.B 16.c 16.d 16. C 16. d 16 C 16.D 16)
17c 17.b 17.B 17.c 17.c 17. D 17. c 17 B 17.A 17)
18d 18.c 18.A 18.a 18.c 18. C 18. d 18 A 18.D 18)
19a 19.c 19.C 19.b 19.b 19. C 19. b 19 D 19.D 19)
20c 20.d 20.B 20.b 20.c 20.C 20. c 20 B 20.B 20)
http://www.devilsduke.com/http://www.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.web.devilsduke.com/http://www.devilsduke.com/