1- import java.awt.*; class Ticker extends Component { - TopicsExpress



          

1- import java.awt.*; class Ticker extends Component { public static void main (String [] args) { Ticker t = new Ticker(); /* Missing Statements ? */ } } which two of the following statements, inserted independently, could legally be inserted into missing section of this code? boolean test = (Component instanceof t); boolean test = (t instanceof Ticker); boolean test = t.instanceof(Ticker); boolean test = (t instanceof Component); A- 1 and 4 B- 2 and 3 C- 1 and 3 D- 2 and 4 2- Which of the following are legal lines of code? int w = (int)888.8; byte x = (byte)1000L; long y = (byte)100; byte z = (byte)100L; A- 1 and 2 B- 2 and 3 C- 3 and 4 D- All statements are correct. 3- Which two statements are equivalent? 16*4 16>>2 16/2^2 16>>>2 A- 1 and 2 B- 2 and 4 C- 3 and 4 D- 1 and 3 4- Which two statements are equivalent? 3/2 3> 2 2 >> 5 A- 1 and 2 B- 2 and 4 C- 1 and 3 D- 2 and 3 7- public void foo( boolean a, boolean b) { if( a ) { System.out.println("A"); /* Line 5 */ } else if(a && b) /* Line 7 */ { System.out.println( "A && B"); } else /* Line 11 */ { if ( !b ) { System.out.println( "notB") ; } else { System.out.println( "ELSE" ) ; } } } A- If a is true and b is true then the output is "A && B" B- If a is true and b is false then the output is "notB" C- If a is false and b is true then the output is "ELSE" D- If a is false and b is false then the output is "ELSE" 8- switch(x) { default: System.out.println("Hello"); } Which two are acceptable types for x? A- 1 and 3 B- 2 and 4 C- 3 and 5 D- 4 and 6 9- public void test(int x) { int odd = 1; if(odd) /* Line 4 */ { System.out.println("odd"); } else { System.out.println("even"); } } Which statement is true? A- Compilation fails. B- "odd" will always be output. C- "even" will always be output. D- "odd" will be output for odd values of x, and "even" for even values. 10- public class While { public void loop() { int x= 0; while ( 1 ) /* Line 6 */ { System.out.print("x plus one is " + (x + 1)); /* Line 8 */ } } } Which statement is true? A- There is a syntax error on line 1. B- There are syntax errors on lines 1 and 6. C- There are syntax errors on lines 1, 6, and 8. D- There is a syntax error on line 6.
Posted on: Sat, 08 Jun 2013 23:06:55 +0000

Trending Topics



Recently Viewed Topics




© 2015