1. JIT meaning a. java in time b. just in time c. join in time d. none of above CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 2. After the compilation of the java source code, which file is created by the JVM a..class b..java c..cdr d..doc 3. JAR file contains the compressed version of a..java file b..class file c..jsp file 4. What is meaning of jar a. java archived b. java array c. java architecture d. none of these 5. What do you mean by javap a. java compiler b. java Interpreter c. java Disassemble d. java debugger 6. What is jdb a. java compiler b. java Interpreter c. java Disassemble d. java debugger 7. Process of creating exact copy of the existing object is called a. cloning b. overloading c. overriding d. coping 8. Which is the predefined package a. lang package b. io package c. util package d. All of above 9. Object which can store group of other objects is called a. Collection object b. Java object c. Package d. Wrapper 10. All collection classes are available in a. java.io package b. java.lang package c. java.awt package d. java.util package
11. String is the predefined a. Method b. Class c. Variable d. Object 12. Super is the predefined a. Keyword b. Method c. Keyword and Method 13. Execution of the program is always begins with a. Main method b. class contain main method c. parent class d. default package 14. Converting a primitive type data into its corresponding wrapper class object instance is called a. boxing b. wrapping c. instantiation d. autoboxing 15. Which class cannot be a subclass in java? a. abstract class b. parent class c. Final class 16. Can we declare abstract static method? a. Yes b. No 17. In java, gc() method is available in which package a. java.lang package b. java.util package c. java.awt package d. java.io package 18. Inheritance means a. Sub class extends super class b. Sub class extends Base class c. Sub class create object of super class d. All of the above 19. Interfaces helps in which type of inheritance a. Multiple inheritance b. Multilevel inheritance c. Hierarchical inheritance 20. Which method of java is invoked by JVM to reclaim the inaccessible memory location a. reclaim() method b. final() method c. finalize() method d. both b and c 21. Applet always executed on a. Client side b. Server Side
22. Which method of the Applet class displays the result of applet code on screen a. run() method b. paint() method c. drawstring() method d. main() method 23. Which keyword represents object of the present class a. interface b. package c. this d. static 24. Which method can't be overidden a. super b. static c. final d. println 25. Main method parameter has which type of data type a. int b. char c. string d. double 26. Which one of these lists contains only Java programming language keywords? a. class, if, void, long, Int, continue b. default, native, goto, instanceof, finally, throws c. try, virtual, throw, final, volatile, transient d. strictfp, constant, super, implements, do e. byte, break, assert, switch, include 27. public interface Foo int k = 4; /* Line 3 */ Which three piece of codes are equivalent to line 3? 1. final int k = 4; 2. public int k = 4; 3. static int k = 4; 4. abstract int k = 4; 5. volatile int k = 4; 6. protected int k = 4; A. 1, 2 and 3 B. 2, 3 and 4 C. 3, 4 and 5 D. 4, 5 and 6 28. Which one of the following will declare an array and initialize it with five numbers? A. Array a = new Array(5); B. int [] a = 23,22,21,20,19; C. int a [] = new int[5]; D. int [5] array; 29. Which is the valid declarations within an interface definition? A. public double methoda(); B. public final double methoda(); C. static void methoda(double d1); D. protected void methoda(double d1);
30. Which one creates an instance of an array? A. int[ ] ia = new int[15]; B. float fa = new float[20]; C. char[ ] ca = "Some String"; D. int ia[ ] [ ] = 4, 5, 6, 1,2,3 ; 31. Which two cause a compiler error? 1. float[ ] f = new float(3); 2. float f2[ ] = new float[ ]; 3. float[ ]f1 = new float[3]; 4. float f3[ ] = new float[3]; 5. float f5[ ] = 1.0f, 2.0f, 2.0f; A.2, 4 B. 3, 5 C. 4, 5 D. 1, 2 32. Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class? A.final B. static C. private D. protected E. volatile 33. Which class does not override the equals() and hashcode() methods, inheriting them directly from class Object? A.java.lang.String B. java.lang.double C. java.lang.stringbuffer D. java.lang.character 34. /* Missing Statement? */ public class foo public static void main(string[]args)throws Exception java.io.printwriter out = new java.io.printwriter(); new java.io.outputstreamwriter(system.out,true); out.println("hello"); What line of code should replace the missing statement to make this program compile? A. No statement required. B. import java.io.*; C. include java.io.*; D. import java.io.printwriter; 35. Which of the following are Java reserved words? 1. run 2. import 3. default 4. implement A.1 and 2 B. 2 and 3 C. 3 and 4 D. 2 and 4 36. What allows the programmer to destroy an object x? A. x.delete() B. x.finalize() C. Runtime.getRuntime().gc() D. Only the garbage collection system can destroy an object.
37. class X implements Runnable public static void main(string args[]) /* Missing code? */ public void run() Which of the following line of code is suitable to start a thread? A. Thread t = new Thread(X); B. Thread t = new Thread(X); t.start(); C. X run = new X(); Thread t = new Thread(run); t.start(); D. Thread t = new Thread(); x.run(); 38. Which cannot directly cause a thread to stop executing? A. Calling the SetPriority() method on a Thread object. B. Calling the wait() method on an object. C. Calling notify() method on an object. D. Calling read() method on an InputStream object. 39. Which of the following will directly stop the execution of a Thread? A.wait() B. notify() C. notifyall() D. exits synchronized code 40. What will be the output of the program? public class Foo public static void main(string[] args) try return; finally System.out.println( "Finally" ); A. Finally B. Compilation fails. C. The code runs with no output. D. An exception is thrown at runtime. 41. What will be the output of the program? try int x = 0; int y = 5 / x; catch (Exception e) System.out.println("Exception"); catch (ArithmeticException ae) System.out.println(" Arithmetic Exception"); System.out.println("finished");
A.finished B. Exception C. Compilation fails. D. Arithmetic Exception 42. Which is a reserved word in the Java programming language? A.method B. native C. subclasses D. reference E. array 43. Which three are valid declarations of a char? 1. char c1 = 064770; 2. char c2 = 'face'; 3. char c3 = 0xbeef; 4. char c4 = \u0022; 5. char c5 = '\iface'; 6. char c6 = '\uface'; A. 1, 2, 4 B. 1, 3, 6 C. 3, 5 D. 5 only 44. What will be the output of the program? public class CommandArgs public static void main(string [] args) String s1 = args[1]; String s2 = args[2]; String s3 = args[3]; String s4 = args[4]; System.out.print(" args[2] = " + s2); and the command-line invocation is > java CommandArgs 1 2 3 4 A. args[2] = 2 B. args[2] = 3 C. args[2] = null D. An exception is thrown at runtime. 45. 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.
46. What will be the output of the program? int i = l, j = -1; switch (i) case 0, 1: j = 1; /* Line 4 */ case 2: j = 2; default: j = 0; System.out.println("j = " + j); A.j = -1 B. j = 0 C. j = 1 D. Compilation fails. 47. What will be the output of the program? int i = 1, j = 10; do if(i > j) break; j--; while (++i < 5); System.out.println("i = " + i + " and j = " + j); A.i = 6 and j = 5 B. i = 5 and j = 5 C. i = 6 and j = 4 D. i = 5 and j = 6 48. What will be the output of the program? int x = l, y = 6; while (y--) x++; System.out.println("x = " + x +" y = " + y); A.x = 6 y = 0 B. x = 7 y = 0 C. x = 6 y = -1 D. Compilation fails. 49. What will be the output of the program? for (int i = 0; i < 4; i += 2) System.out.print(i + " "); System.out.println(i); /* Line 5 */ A.0 2 4 B. 0 2 4 5 C. 0 1 2 3 4 D. Compilation fails. 50. What will be the output of the program? int I = 0; label: if (I < 2) System.out.print("I is " + I); I++; continue label; A. I is 0 B. I is 0 I is 1 C. Compilation fails. D. None of the above