Adblocker Detected
Quizack provides Online Quiz and Practice MCQs for Free. Please disable your Ad-Blocker so we can earn from ads and keep this project alive.
1. What is the difference between HashMap and HashTable?
2. Which of the following statements is false about objects?
3. True or False: All classes that can be instantiated must implement the class Object
4. java.lang.Object is the super class of all the interfaces in java
5. A RuntimeException is...
6. what is order of preference in method overloading
7. Given a class containing the following pieces of code: public static <T> List getList() { return new ArrayList<T>(); } // ... List<?> list = new ArrayList<Integer>(); Adding which of the following lines would cause the class to not compile?
8. how java is platform independent?
9. The JVM allows programmers to manipulate the registers of the underlying system
10. which of the following is correct syntax of varargs
11. What is a LinkedHashSet?
12. which is the default package in every java program?
13. What is @Override annotation used for?
14. The data members of interface in java are:
15. ConcurrentModificationException will be thrown only when an object is concurrently modified.
16. Which one is most suitable to implement an LRU cache?
17. Do Hashtable allow null keys and null values?
18. HashMap is non-synchronized ?
19. HTML based Java Documentary help can be accessed using.. ?
20. ConcurrentModificationException extends .......
21. What is super class of all classes in Java?
22. A Guarded Block is a concurrency idiom in which:
23. What will be the output of this code? class Main { static abstract class Base { protected Base() { init(); } abstract void init(); } static class Child extends Base { private final int value; public Child() { value = 5; } @Override public void init() { System.out.println("value = " + value); } } public static void main(String[] args) { Child c = new Child(); } }
24. Given a class containing the following pieces of code: ---------------------- public static <T> List getList() { return new ArrayList<T>(); } // ... List<?> list = new ArrayList<Integer>(); ---------------------- Adding which of the following lines would cause the class to not compile?
25. Livelock describes a situation in which two or more threads block each other, because:
26. @Inject annotation belongs to
27. Which of the following is true about the Cloneable interface?
28. The TreeMap and LinkedHashMap classes:
29. You want to listen TCP connections on port 9000. How would you create the socket?
30. public class Test{ public static void main(String [] arg){ int x=10; if(x++ > 10 && x++ == 12){ ++x; } System.out.println(x); } } What is the Output of this code?
31. What is the output of the below code ? int a = 0; int b = 0; if (a++ == 1 && b++ == 1); System.out.println(a + " " + b);
32. What is the output? public static void main(String[] args) { int x=10; if(x++ > 9 && x++ == 12){ ++x; } System.out.println(x); }
33. You need to keep a list of one million objects sorted at all times having 100 random inserts and delete per second. Reads from the list are always done in sorted order. You would:
34. Which of the following are not a valid declarations?
35. True or false: Lambdas allow you to change single instance's method logic
36. Which code fragments correctly create and initialize a static array of int elements?
37. What is the output of the following program? import java.lang.reflect.Method; class TestImpl { public void method() {} public static void main(String[] args) { Method method = TestImpl.class.getMethod("method", null); System.out.println(method.getName()); } }
38. I would implement a LRU cache using only JDK classes by...
39. Which two are valid constructors for Thread? 1. Thread(Runnable r, String name) 2. Thread() 3. Thread(int priority) 4. Thread(Runnable r, ThreadGroup g) 5. Thread(Runnable r, int priority)
40. The TreeMap class is Java's implementation of which data structure?
41. A "blank" final variable (defined without an initial value):
42. The keyword that ensures a field is coherently accessed by multiple threads is:
43. which statement is True ?
44. Given the code: Integer i= new Integer("1"); if (i.toString() == i.toString()) System.out.println("Equal"); else System.out.println("Not Equal");
45. Which one of the following statements is true about threads in Java
46. Which four options describe the correct default values for array elements of the types indicated? 1. int -> 0 2. String -> "null" 3. Dog -> null 4. char -> '\u0000' 5. float -> 0.0f 6. boolean -> true
47. LinkedBlockingQueue is useful for...
48. Does Java 8 allow static methods in interfaces?
49. java.util.Collection is:
50. What's the output of following error ? class A { public Number getNumber(){ return 1; } } class B extends A { public int getNumber(){ return 2; } } public class Main{ public static void main(String []args){ A a = new B(); System.out.println(a.getNumber()); } }
51. Anonymous inner classes have access to...
52. All of the classes in the Java Collections Framework:
53. Float p = new Float(3.14f); if (p > 3) { System.out.print("p is bigger than 3. "); } else { System.out.print("p is not bigger than 3. "); } finally { System.out.println("Have a nice day."); } What is the result?
54. In your program, you need to read a zip file (myfile.zip) containing several other data files containing basic Java objects. Which of the following will allow you to construct a InputStream for the task?
55. Which statement is true?
56. To create a single instance of a class, we can go with
57. Is "Method" a part of Java Reflection API
58. What type should you use for floating point monetary calculations?
59. Does interrupt() always force all threads to terminate?
60. 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 ?
61. Which of the following statements about static inner classes is true?
62. What will be printed out if you attempt to compile and run the following code? int i=9; switch (i) { default: System.out.println("default "); case 0: System.out.println("zero "); break; case 1: System.out.println("one "); case 2: System.out.println("two "); }
63. Can the "main" method be overloaded
64. Java variables are passed into methods as:
65. What is the issue with the following code? String s = ""; for(int i = 0; i < 1000000; i++) { s += Integer.toString(i); }
66. Java source code is compiled into
67. What is the direct parent of "Error" class?
68. A class implementing a singleton pattern has...
69. Which is a valid keyword in java?
70. What is a weak reference?
71. How do you convert int[] to a ArrayList<Integer>?
72. ’blank" final variable (defined without an initial value:
73. enum Example { ONE, TWO, THREE } Which statement is true?
74. Which of the following is true about overloading vs overriding methods?
75. Output of Program: class Test {public static void main(String[] ar) {int i=0; if(i) System.out.print("hi"); else System.out.print("bye"); } }
76. Java's String class is
77. public class SomeClass { public static void main(String[] args) { System.out.println((String) null); } } What is the result of the following program?
78. Java's automatic memory management:
79. After the following code fragment, what is the value in a? String s; int a; s = "Foolish boy."; a = s.indexOf("fool");
80. Which option is true for StringBuffer and StringBuilder
81. Which of the following is used to see the details of compilation
82. enum Example { ONE, TWO, THREE } Which statement is true?
83. The List interface has which superinterfaces?
84. Which is a reserved word in the Java programming language?
85. A method without an access modifier (i.e. public, private, protected) is...
86. In addition to CORBA, Core Java also supports network services using:
87. Which one of these lists contains only Java programming language keywords?
88. Which class/classes is/are thread safe among these?
89. What is the difference between a checked and unchecked exception?
90. Java provides a class for mutable sequences of characters, called:
91. What is the correct statement for handling RuntimeException?
92. Immutable objects are always...
93. A class may extend:
94. What is the output? int[] xxx = {10, 20}; List<String> list = new ArrayList<String>(10); list.add("01"); list.add("02"); System.out.println(xxx.length + ", " +list.size());
95. Calling System.gc() when using a modern JVM :
96. Which one of the following statements is true about Java Beans?
97. Which is the correct command to run an executable JAR file named program.jar?
98. What is the name of the method used to start a thread execution?
99. Why is it important to override hashCode() when you override equals()?
100. An "overloaded" method has what in common with one (or more) methods on the same class?
Apache Flex
Google App Engine
Gamification
Git
Google Glass Programming
Google Maps-API and development
Related MCQ's