You are on page 1of 9

[30] Which of the following statement is correct about the code snippet given below?

public class Main { public static void main ( String[ ] args { double d ! "#0$0 % 0$0 & if ( d !! 'ouble$()*+,-.)/-(0-(-,1 S2stem$out$println ( d & 3 3 4hoice a 4hoice b 4hoice c 4hoice d ,he code reports an error$ The code causes an exception ,he code gives an output as 0$ ,he code gives an output as "-nfinit2

[56] Which of the following declarations are legal? -$ char c ! 07#538 & --$ char c ! 9u#538 & ---$ char c ! :9u#538: & 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 Only III ;nl2 - and ---< -- and ---

[5=] What will be the output of the code snippet given below? public class Main { public static void main ( String[ ] args { double pi< r< a & r ! #0$= & pi ! 3$#8#> & a ! pi ? r ? r & S2stem$out$println ( a & 3 3 4hoice a 4hoice b 4hoice c 366.436224 3>>$88 3>>$83

4hoice d

3>>$830000

[5@] What will be the output of the code snippet given below? public class Main { public static void main ( String[ ] args { double a ! 3$0< b ! 8$0 & double c ! Math$sArt ( a ? a B b ? b & S2stem$out$println ( c & 3 3 Choice a 4hoice b 4hoice c 4hoice d 5.00 C C$0 C$000000

What will be the output of the code snippet given below? public class Main { public static void main ( String[ ] args [5>] { char ch ! 56> & S2stem$out$println ( ( int ch B D D B ch & 3 3 4hoice a 4hoice b 4hoice c 4hoice d 80 character corresponding to it 296 character corresponding to 12 56> character corresponding to it 80 character corresponding to 5CC

[5C] Which of the following statement is correct about the code snippet given below? public class Main { public static void main ( String[ ] args { int bar ! # & { int bar ! 5 &

S2stem$out$println ( bar & 3 3 3 4hoice a 4hoice b 4hoice c 4hoice d ,he code reports an error$ ,he code causes an e7ception ,he code gives an output as #$ The code gi!es an output as 2.

[58] What will be the output of the code snippet given below? public class Main { public static void main ( String[ ] args { boolean b & b ! false & b ! true & if ( b S2stem$out$println ( D,his is e7ecuted$D & b ! false & if ( b S2stem$out$println ( D,his is not e7ecuted$D & S2stem$out$println ( #0 E 6 & 3 3 4hoice a 4hoice b 4hoice c 4hoice d ,his is not e7ecuted$ false ,his is e7ecuted$ # This is executed. true ,his is not e7ecuted$ 0

[53] What will be the output of the code snippet given below? public class Main { public static void main ( String[ ] args { char F ! :+: B CC & S2stem$out$print ( F & 3

3 4hoice a 4hoice b 4hoice c 4hoice d 4hoice a 4hoice b 4hoice c 4hoice d W x 2 F Only I and II ;nl2 - and --;nl2 -- and ---< -- and ---

[55] Which of the following selection statements are supported b2 Gava? -$ if --$ switch ---$ Macro

[5#] Which of the following statements are correct? -$ (ested if else statements are not allowed in Hava$ --$ if statements are e7ecuted from top to down$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ Only II is correct$ Ioth - and -- are correct$ Ioth - and -- are incorrect$

[50] 4hoice a 4hoice b 4hoice c 4hoice d

Which of the following statements are correct? -$ ,o perform a left shift on a b2te or short implies that we must not discard the high"order b2tes of the int result$ --$ -f a b2te value is left"shifted that value will first be promoted to int and then shifted$ Only I is correct. ;nl2 -- is correct$ Ioth - and -- are correct$ Ioth - and -- are incorrect$

[#6] Which of the following statements are correct? -$ -n Gava< the else clause is optional$ --$ if condition is an2 e7pression that returns an2 character value$ 4hoice a 4hoice b Only I is correct. ;nl2 -is

correct$ 4hoice c Ioth and -are correct$ Ioth and -are incorrect$

4hoice d

[#=] Which of the following statements are correct? -$ +rithmetic operators can be used on char t2pes$ --$ ,he minus operator has a unar2 form which negates its single operand$ 4hoice a 4hoice b 4hoice c ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

4hoice d

[#@] Which of the following statements are correct? -$ if statement is GavaJs conditional branch statement$ --$ if statement is used to route program e7ecution through two different paths$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -are incorrect$

[#>] Which of the following statements are correct? -$ When the division operator is applied to an integer t2pe< there will be a fractional component attached to the result$ --$ -n Gava< modulus operator cannot be applied to floating"point t2pes$

4hoice a 4hoice b 4hoice c 4hoice d

;nl2 - is correct$ ;nl2 -- is correct$ Ioth - and -- are correct$ "oth I and II are incorrect.

[#C] Which of the following statements are correct? -$ -n Gava< an integer literal cannot be assigned to a long variable$ --$ ,o specif2 a long literal< user needs to e7plicitl2 tell the compiler that the literal value is of t2pe long b2 appending an upper or lowercase K to the literal$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ Ioth - and -- are correct$ "oth I and II are incorrect.

[#8] Which of the following statements are correct? -$ We can operate on chars as if the2 are integers$ --$ Gava has a simple data t2pe boolean for logical values$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[#3] Which of the following statements are correct? -$ ,he t2pe float specifies a single"precision value that uses >8 bits of storage$ --$ Gava uses Lnicode to represent characters$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[#5] Which of the following statements are correct? -$ -n Gava an int is alwa2s 35 bits regardless of the particular platform$ --$ Gava supports unsigned< positive"onl2 integers$

4hoice a 4hoice b 4hoice c 4hoice d

;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[##] Which of the following statements are correct? -$ ,he Gava compiler checMs all e7pressions and parameters to ensure that the t2pes are compatible$ --$ -n Gava< we can assign a floating"point value to an integer$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[#0] Which of the following statements are correct? -$ -n Gava< char is ="bit t2pe$ --$ We have negative chars in Gava$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ Ioth - and -- are correct$ "oth I and II are incorrect.

[6] Which of the following statements are correct? -$ boolean data t2pe is returned b2 all relational operators$ --$ When a boolean value is output b2 println( < # or 0 gets displa2ed$ 4hoice a 4hoice b 4hoice c 4hoice d Only I is correct. ;nl2 -- is correct$ Ioth - and -- are correct$ Ioth - and -- are incorrect$

[=] Which of the following statements are correct? -$ -n Gava< variables of t2pe int are commonl2 emplo2ed to control loops and to inde7 arra2s$ --$ +n2 time we have an integer e7pression involving b2tes< shorts< ints and literal numbers< the entire e7pression is promoted to int before the calculation is done$ 4hoice a 4hoice b Only I is correct. ;nl2 -- is correct$

4hoice c 4hoice d

Ioth - and -- are correct$ Ioth - and -- are incorrect$

[@] Which of the following statements are correct? -$ ,he simple data t2pes are defined to have an e7plicit range and mathematical behavior$ --$ -n Gava all data t2pes have a strictl2 defined range$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[>] Which of the following statements are correct? -$ ,he long data t2pe is the most versatile and efficient t2pe$ --$ 'ata t2pe determines behavior and not siFe$ 4hoice a 4hoice b 4hoice c 4hoice d Only I is correct. ;nl2 -- is correct$ Ioth - and -- are correct$ Ioth - and -- are incorrect$

[C] Which of the following statements are correct? -$ 0loating"point numbers are used when evaluating e7pressions that reAuire fractional precision$ --$ Gava implements the standard set of floating"point t2pes and operators$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[8] Which of the following statements are correct? -$ Gava manages the meaning of the high"order bit b2 adding an unsigned right shift operator$ --$ ,he Gava run"time environment is free to use whatever siFe it wants< as long as the t2pes behave as user declared them$ 4hoice a ;nl2 - is correct$

4hoice b 4hoice c 4hoice d

Only II is correct. Ioth - and -- are correct$ Ioth - and -- are incorrect$

[3] Which of the following statements are correct? -$ -n Gava octal values are denoted b2 a leading Fero$ --$ -n Gava< the value 06 produces an error$ 4hoice a 4hoice b 4hoice c 4hoice d Only I is correct. ;nl2 -- is correct Ioth - and -- are correct$ Ioth - and -- are incorrect$

[5]

Which of the following statements are correct? -$ -nteger literals create an int value$ --$ -n Gava< when a literal value is assigned to a b2te or short variable< an error is generated even if the literal value is within the range of the target t2pe$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ ;nl2 -- is correct$ "oth I and II are correct. Ioth - and -- are incorrect$

[#]

Which of the following statements are correct? -$ -n Gava< a b2te is a signed ="bit t2pe entit2$ --$ ,he smallest integer data t2pe is short$ 4hoice a 4hoice b 4hoice c 4hoice d ;nl2 - is correct$ Only II is correct. Ioth - and -- are correct$ Ioth - and -- are incorrect$

You might also like