Core Java Quiz

Correct Answers: 0
Incorrect Answers: 0
1. What is garbage collection in Java?
2. Which of the following is a root of the garbage collection process in Java?
3. What is the purpose of the finalize() method in Java?
4. Which garbage collector is designed for low-latency applications?
5. What is a memory leak in Java?
6. Which of the following is NOT a type of garbage collector in Java?
7. What does the JVM use to track the objects that need to be garbage collected?
8. What is the primary goal of the Java memory model?
9. Which of the following keywords can be used to prevent a class from being subclassed?
10. What is the purpose of the transient keyword in Java?
11. Which method is called when an object is no longer reachable?
12. What will happen if you call `System.gc()` in Java?
13. Which of the following types of references are eligible for garbage collection?
14. What is the purpose of the Java Exception Handling mechanism?
15. What does the try-catch block do?
16. Which of the following statements is true about checked exceptions?
17. Which keyword is used to throw an exception manually?
18. Which of the following is not a primitive data type in Java?
19. What is the default value of a local variable in Java?
20. Which of these keywords is used to define an abstract class in Java?
21. Which method is used to start a thread in Java?
22. Which of the following is a marker interface in Java?
23. What is the main purpose of multithreading in Java?
24. Which class is used to create a thread in Java?
25. Which method must be overridden to define the code that a thread will execute?
26. What will happen if you call the `start()` method of a thread that is already running?
27. Which of the following is the correct way to create a thread by implementing the Runnable interface?
28. What is the purpose of the `sleep()` method in Java?
29. What is the effect of calling `join()` on a thread?
30. Which of the following methods is used to ensure mutual exclusion in multithreading?
31. What is a deadlock in Java?
32. What does the `volatile` keyword do in Java?
33. Which of the following can be used to create a thread pool in Java?
34. What is the output of the following code? `Thread t = new Thread(); t.start(); t.start();`?
35. Which method is used to stop a thread safely in Java?
36. Which interface should be implemented to create a thread that can be interrupted?
37. Which of the following is true about the `wait()` method?
38. What happens when `notify()` is called on an object?
39. Which of the following methods can be used to check if a thread is alive?
40. Which of the following can be used to synchronize a block of code?
41. Which interface is the root of the Java Collections Framework?
42. Which of the following classes implements the List interface?
43. Which collection class is synchronized?
44. What is the output of the following code? `List<String> list = new ArrayList<>(); list.add("A"); list.add("B"); System.out.println(list.get(1));`
45. Which of the following collections allows duplicate elements?
46. Which class is used to implement a hash table in Java?
47. What is the correct way to declare a HashSet in Java?
48. Which of the following methods is used to remove all elements from a collection?
49. What does the `contains()` method do in a collection?
50. Which collection interface is not part of the Java Collections Framework?
51. What is the default initial capacity of an ArrayList in Java?
52. Which collection is sorted by its natural ordering or by a comparator provided at collection creation time?
53. Which interface does the TreeMap implement?
54. Which of the following collections allows the insertion order to be maintained?
55. Which method is used to get the number of elements in a collection?
56. What is the main advantage of using a LinkedList over an ArrayList?
57. What will be the output of the following code? `Set<Integer> set = new HashSet<>(); set.add(1); set.add(2); set.add(1); System.out.println(set.size());`
58. Which of the following methods is used to retrieve and remove the head of a Queue?
59. What does the `toArray()` method return?
60. Which of these is not a keyword in Java?
61. What is the range of a byte data type in Java?
62. Which method is used to find the length of a string in Java?
63. What will be the output of 15 >>> 2 in Java?
64. Which of the following is a wrapper class in Java?
65. What is the purpose of the 'this' keyword in Java?
66. What does the 'continue' statement do in a loop?
67. Which of these classes is used to handle input and output in Java?
68. What will be the output of 10 + '20' + 30 in Java?
69. Which keyword is used to prevent inheritance in Java?
70. Which of the following statements about Java arrays is true?
71. Which of these is not a valid data type in Java?
72. Which method is used to get the runtime information about a Java application?
73. Which exception is thrown when an array is accessed with an illegal index in Java?
74. Which of the following is not a Java feature?
75. Which operator is used to allocate memory for an object in Java?
76. Which method must be implemented by a class implementing the Runnable interface?
77. Which of the following is a reserved keyword in Java?
78. What is the default access modifier for a class, method, or variable if no access modifier is specified?
79. Which method is called when an object is created in Java?
80. Which of the following is used to define a block of code that may throw an exception?
81. What is the default value of an object reference variable in Java?
82. Which of the following is not a loop structure in Java?
83. Which of the following methods is used to suspend a thread in Java?
84. Which of these statements about the 'final' keyword is true?
85. Which of the following is not a valid constructor declaration in Java?
86. Which exception is thrown when a division by zero occurs in Java?
87. Which of these is not a member of the java.lang package?
88. Which access modifier makes a variable accessible only within its own class?
89. What does the term 'method overloading' refer to in Java?
90. What is the purpose of the 'native' keyword in Java?
91. Which of the following is the base class for all exceptions in Java?
92. Which method is used to convert a string into an integer in Java?
93. Which keyword is used to invoke the superclass constructor?
94. Which of the following is an example of a checked exception in Java?
95. Which of these keywords is used to manually throw an exception?
96. Which of these methods is used to register a thread for execution in Java?
97. What does the 'transient' keyword do in Java?
98. Which of the following methods is defined in the Object class?
99. Which of these cannot be used for a variable name in Java?
100. Which of the following is used to define an abstract method in Java?
101. Which method is used to compare two strings for equality in Java?
102. Which of these is the correct way to create an array in Java?
103. Which operator in Java returns the remainder of a division?
104. Which of the following is the correct way to define a main method in Java?
105. Which of these is not a type of inheritance in Java?
106. Which of the following is not a valid access modifier in Java?
107. Which method is used to terminate a thread in Java?
108. Which of the following is not an interface in Java?
109. Which of the following is used to create a new object in Java?
110. Which method is automatically called during object creation in Java?
111. Which keyword is used to inherit a class in Java?
112. Which of these is a mutable class in Java?
113. Which of these is a correct way to create an infinite loop in Java?
114. Which of the following does not cause a thread to stop in Java?
115. Which of these statements is true about a constructor in Java?
116. Which of these keywords is used to define a constant variable in Java?
117. Which of these classes is immutable in Java?
118. Which keyword is used to handle an exception in Java?
119. Which method is used to find the length of an array in Java?
120. Which method is used to check if two objects are equal in Java?
121. Which of the following types of exceptions can be thrown by the JVM?
122. Which operator is used to concatenate two strings in Java?
123. Which of the following is used to terminate a switch statement in Java?
124. What is the default value of a boolean variable in Java?
125. Which of the following keywords is used to refer to the current object in a method?
126. Which of the following is not a reserved keyword in Java?
127. Which method is used to make a thread pause for a specific amount of time in Java?
128. Which of the following is the size of an int in Java?
129. Which keyword is used to access the superclass constructor?
130. Which method is used to terminate a program in Java?
131. Which of the following is not a feature of Java?
132. Which of the following is used to check whether a particular class implements an interface?
133. Which keyword is used to define a class in Java?
134. Which method is called when an object is destroyed in Java?
135. Which of the following is a valid long literal in Java?
136. Which of the following will execute only once in a do-while loop, even if the condition is false?
137. Which of the following is true about an abstract class in Java?
138. Which of the following methods is not present in the `Object` class?
139. Which data type is used to store a sequence of characters in Java?
140. Which of the following is used for dynamic method dispatch in Java?
141. Which of these can be used to convert a string to a double in Java?
142. Which of the following is a type of control flow statement in Java?
143. Which of the following is a synchronized collection class in Java?
144. Which method is used to read a line of text from the console in Java?
145. Which of the following is a final class in Java?
146. Which method is used to remove leading and trailing spaces from a string in Java?
147. Which of the following is not a type of loop in Java?
148. Which of the following is true about the `static` keyword in Java?
149. Which of the following collections is ordered in Java?
150. Which of the following is used to handle errors and exceptions in Java?

Featured Posts

MBBS Jargons Quiz

Correct Answers: 0 Incorrect Answers: 0 1. Which term refers to the surgical removal of a part of an orga...

Popular Posts