Sunteți pe pagina 1din 3

1 . Which characters are as first characters of an identifier?

(a) / (b ) ? (c ) $ (d)*

2. How to invoke constructor method? (a) By calling explicitly using it ’ s


method
name (b) By calling explicitly using it’s 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) Null (b) 1 (c) 0
(d) - 1

5 . The signed right shift operator in Java is .


Select the one correct answer. (a) >> (b) >>>; (c) <<; (d) <<<

6 . Which of the
following are true . Select the one correct answers . (a) ∼ operator is the bit
- wise XOR operator . (b) | operator is used to perform bitwise OR and also
short- circuited logical OR . (c) && operator is used for short - circuited
logical AND . (d) The unsigned
right shift operator in Java is >> .

7. Which method is used to d e t e r m i ne t h e c l as s o f a n o b j e c t? (


a) g e t B a s e C l a s s ( ) ( b ) g e t Par e nt () ( c ) s u p e r( ) ( d ) g e t C
l as s ( )

8 . T h e t h i s r e f e r e n c e i s u s e d i n c o n j u n c t i on w i t h m e t
h o d s . ( a) n o n - s t a ti c ( b ) s t a ti c ( c ) fi n a l ( d ) a b s r ac t

9 . W h e n mu s t t h e m a i n c l a s s an d th e fi l e n a m e c oi n c i d e
? ( a) W h e n c l as s i s d e c l a r e d s t a ti c . ( b ) W h e n c l as s i s d
e c l a r e d p u b l i c . ( c ) W h e n c l as s i s d e c l a r e d 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 ) N 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 f o u n d .

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. W h i ch e xp r e s s i on s a re i l l e g al ? ( a) ( t ru e & t ru e ) ( b ) (
i nt myI nt = 0 < > 3 ) ( c ) b o o l e an b = ( b o ol e an ) 9 9; ( d ) ( i nt
myI nt = 0 > 3 )

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 )
extends (d) NULL

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) nu l l ( b ) 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 a l i z e d ( c ) 0 ( d ) 5

2 0. W h a t i s t h e r e s u l t o f t h e f ol l ow i n g op e r at i o n ? S y s t
e m . o u t. p r i nt l n (4 | 3 ); ( a) 6 ( b ) 0 ( c ) 7 ( d ) 1

ANSWERS:
1. C
2. D
3. C
4. C
5. A
6. C
7. D
8. A
9. B
10. A
11. A
12. C
13. B
14. B
15. A
16. C
17. D
18. C
19. C
20. C

S-ar putea să vă placă și