Join the discussion
Question 1/230
Which two may precede the word 'class' in a class declaration?
Correct Answer: B,C
B: A class can be declared as public or private.
C: You can declare two kinds of classes: top-level classes and inner classes.
You define an inner class within a top-level class. Depending on how it is defined, an inner
class can be one of the following four types: Anonymous, Local, Member and Nested top-level. A nested top-level class is a member classes with a static modifier. A nested top-level class is just like any other top-level class except that it is declared within another class or interface. Nested top-level classes are typically used as a convenient way to group related classes without creating a new package. The following is an example:
public class Main { static class Killer {
C: You can declare two kinds of classes: top-level classes and inner classes.
You define an inner class within a top-level class. Depending on how it is defined, an inner
class can be one of the following four types: Anonymous, Local, Member and Nested top-level. A nested top-level class is a member classes with a static modifier. A nested top-level class is just like any other top-level class except that it is declared within another class or interface. Nested top-level classes are typically used as a convenient way to group related classes without creating a new package. The following is an example:
public class Main { static class Killer {
Add Comments
- Other Question (230q)
- Q1. Which two may precede the word 'class' in a class declaration?...
- Q2. Given the fragment: (Exhibit) What is the result?...
- Q3. Given the following array: Which two code fragments, independently, print each element in ...
- Q4. Given the code fragment: (Exhibit) What is the result?...
- Q5. Given the code snippet from a compiled Java source file: (Exhibit) Which command-line argu...
- Q6. Given the code fragment: (Exhibit) What is the result?...
- Q7. Given the following classes: (Exhibit) Which two options fail to compile when placed at li...
- Q8. Given the code fragment: (Exhibit) What is the result?...
- Q9. Given the code fragments: (Exhibit) And, (Exhibit) Which statement is true?...
- Q10. Given the following main method: What is the result? (Exhibit)...
- Q11. Given the code fragment: (Exhibit) What is the result?...
- Q12. Given: (Exhibit) What is the result? (Exhibit)...
- Q13. Given the following code: (Exhibit) What is the output?...
- Q14. Given the code fragment: (Exhibit) What is the result?...
- Q15. Given the code fragment: (Exhibit) What is the result?...
- Q16. Given: (Exhibit) How many objects have been created when the line / / do complex stuff is ...
- Q17. Given: (Exhibit) Which action fixes the compiler error?...
- Q18. Given: (Exhibit) And given the commands: (Exhibit) What is the result?...
- Q19. Which two class definitions fail to compile? (Choose two.) A: (Exhibit) B: (Exhibit) C: (E...
- Q20. Given: (Exhibit) What is the result?
- Q21. Given the code fragment: (Exhibit) What is the result?...
- Q22. You are asked to develop a program for a shopping application, and you are given the follo...
- Q23. Given: (Exhibit) What is the result?
- Q24. Given: (Exhibit) What is the result? (Exhibit)...
- Q25. Given the classes: * AssertionError * ArithmeticException * ArrayIndexOutofBoundsException...
- Q26. Given the code fragments: (Exhibit) And, (Exhibit) Which statement is true?...
- Q27. Given the code fragment: (Exhibit) What is the result?...
- Q28. Given the code fragment: (Exhibit) What is the result?...
- Q29. Given the code fragment: (Exhibit) What is the result?...
- Q30. Given the code fragment: (Exhibit) What is the result?...
- Q31. Given: (Exhibit) And given the code fragment: (Exhibit) What is the result?...
- Q32. Consider following interface. (Exhibit) Which of the following will create instance of Run...
- Q33. Given: (Exhibit) What is the result?
- Q34. Given: (Exhibit) What is the result?
- Q35. Given: (Exhibit) What is the result?
- Q36. Given the code fragment: Which modification enables the code to print 54321? (Exhibit)...
- Q37. Given the code from the Greeting.Java file: (Exhibit) Which set of commands prints Hello D...
- Q38. Given the code fragment: (Exhibit) What is the result?...
- Q39. Given the code fragment: (Exhibit) Which modification enables the code to print 54321?...
- Q40. Given the code fragment: (Exhibit) What is the result? (Exhibit)...
- Q41. Given the code fragment: (Exhibit) What is the result?...
- Q42. Given the code fragment: (Exhibit) What is the result?...
- Q43. Given the content of three files: (Exhibit) Which statement is true?...
- Q44. Given: What is the result? (Exhibit)
- Q45. Which three are advantages of the Java exception mechanism?...
- Q46. What is the result? boolean log3 = ( 5.0 != 6.0) && ( 4 != 5); boolean log4 = (4 !...
- Q47. Given the code fragment: (Exhibit) What is the result?...
- Q48. Given the following classes: (Exhibit) Which two options fail to compile when placed at li...
- Q49. Given the code fragment: (Exhibit) Which code fragment, when inserted at line 3, enables t...
- Q50. Given the code fragments: (Exhibit) Which code fragment, when inserted at line ni, enables...
- Q51. Given the code fragment: (Exhibit) Which code fragment, when inserted at line 3, enables t...
- Q52. Given the code fragment: (Exhibit) Assume that the system date is June 20, 2014. What is t...
- Q53. Given the code fragment: int a = 0; a++; System.out.println(a++); System.out.println(a); W...
- Q54. Given the code fragments: (Exhibit) Which modification enables the code to compile? (Exhib...
- Q55. You are asked to develop a program for a shopping application, and you are given the follo...
- Q56. Given the code fragment: (Exhibit) Which three code fragments are valid at line n1?...
- Q57. Given: (Exhibit)
- Q58. Given: (Exhibit) What is the result?
- Q59. Given the following code: (Exhibit) What are the values of each element in intArr after th...
- Q60. Given: (Exhibit) And given the code fragment: (Exhibit) Which two modifications enable the...
- Q61. Given: (Exhibit) What is the result?
- Q62. Given the code fragment: (Exhibit) What is the result?...
- Q63. Given the code fragment: (Exhibit) What is the result?...
- Q64. Given the code fragment: (Exhibit) Which code fragment, when inserted at line n1, enables ...
- Q65. Given: (Exhibit) What is the result?
- Q66. Which two statements are true?
- Q67. Given: (Exhibit) Given the code fragment: (Exhibit) Which two sets of actions, independent...
- Q68. Which one of the following code examples uses valid Java syntax? (Exhibit)...
- Q69. Given the code fragment from three files: (Exhibit) Which code fragment, when inserted at ...
- Q70. Which two are benefits of polymorphism?
- Q71. Given: (Exhibit) What is the result?
- Q72. Given: (Exhibit) What is the result?
- Q73. Which code fragment causes a compilation error? float flt = 100F;...
- Q74. You are developing a banking module. You have developed a class named ccMask that has a ma...
- Q75. Given the code fragment: (Exhibit) What is the result?...
- Q76. Given the code fragment: (Exhibit) What is the result?...
- Q77. Given the code fragment from three files: (Exhibit) Which code fragment, when inserted at ...
- Q78. Given: (Exhibit) What is the result?
- Q79. Given this code for the classes MyException and Test: (Exhibit) What is the result?...
- Q80. Which statement is true about the main() method?...
- Q81. Given the code fragment: (Exhibit) What is the result?...
- Q82. Given: (Exhibit) What is the result?
- Q83. Given: (Exhibit) What is the result?
- Q84. You are developing a banking module. You have developed a class named ccMask that has a ma...
- Q85. Given the following main method: (Exhibit) What is the result?...
- Q86. Given: (Exhibit) What is the result?
- Q87. Which three statements describe the object-oriented features of the Java language? (Choose...
- Q88. Given: (Exhibit) What is the result?
- Q89. Given: public class SuperTest { public static void main(String[] args) { statement1 statem...
- Q90. Given: (Exhibit) What is the result?
- Q91. Given the code fragment: (Exhibit) Which two modifications, made independently, enable the...
- Q92. Given the definitions of the MyString class and the Test class: (Exhibit) What is the resu...
- Q93. Given the code fragment: (Exhibit) What is the result?...
- Q94. Given the code fragment: (Exhibit) What is the result?...
- Q95. Given the code fragment: (Exhibit) What is the result?...
- Q96. Given: (Exhibit) Which code fragment, when inserted at line 7, enables the code print true...
- Q97. Given the code fragment: (Exhibit) Which code fragment, when inserted at line 3, enables t...
- Q98. Given: (Exhibit) What is the result?
- Q99. Given the code fragment: What is the result? A: (Exhibit) B: (Exhibit) C: (Exhibit) D: (Ex...
- Q100. Given the code fragment: (Exhibit) Which two code fragments can be independently inserted ...
- Q101. Given the code fragment: (Exhibit) What is the result?...
- Q102. Given the code in a file Traveler.java: (Exhibit) And the commands: Javac Traveler.java Ja...
- Q103. Given the content of three files: (Exhibit) Which statement is true? Which statement is tr...
- Q104. Given the code fragment: (Exhibit) Which modification enables the code to print 54321?...
- Q105. Which three statements are true about the structure of a Java class? (Choose three.)...
- Q106. Given the code fragment: (Exhibit) What is the result? (Exhibit)...
- Q107. Which statement is/are true? I. Default constructor only contains "super();" call. II. We ...
- Q108. Given: (Exhibit) What is the result?
- Q109. Given the following class: (Exhibit) Which three pieces of code, when inserted independent...
- Q110. Given the code fragment: (Exhibit) What is the result?...
- Q111. Given the classes: *AssertionError *ArithmeticException *ArrayIndexOutofBoundsException *F...
- Q112. Given the code fragment: (Exhibit) Which option represents the state of the num array afte...
- Q113. Given: package p1; public interface DoInterface { void method1(int n1); // line n1 } packa...
- Q114. Given the code fragments: (Exhibit) What is the result?...
- Q115. Given the code fragment: (Exhibit) Which action enables the code to print Helping... Done?...
- Q116. Given the following class: (Exhibit) Which two changes would encapsulate this class and en...
- Q117. What is the result? public class StringReplace { public static void main(String[] args) { ...
- Q118. Given: class Test int a1; public static void doProduct(int a) { a = a * a; ) public static...
- Q119. Given: (Exhibit) What is the result?
- Q120. Given: (Exhibit) Which two code fragments can be inserted at line n1?...
- Q121. Given the code fragment: (Exhibit) And given the requirements: 1. Process all the elements...
- Q122. Given the code fragment: (Exhibit) What is the result?...
- Q123. Given the code fragment: (Exhibit) Which modification enables the code fragment to print T...
- Q124. Given the code fragments: (Exhibit) And, (Exhibit) Which statement is true?...
- Q125. Given: (Exhibit) What is the result?
- Q126. Given the code fragment: (Exhibit) What is the result?...
- Q127. Given: (Exhibit) What is the result?
- Q128. Given: (Exhibit) Given the code fragment: (Exhibit) Which two sets of actions, independent...
- Q129. Which of the following exception will be thrown due to the statement given here? int array...
- Q130. Given: (Exhibit) What is the result?
- Q131. Given the code fragment: (Exhibit) Which code fragment, when inserted at line n1, enables ...
- Q132. Given: (Exhibit) What is the result?
- Q133. Which two class definitions fail to compile? (Choose two.) (Exhibit)...
- Q134. Given the following array: (Exhibit) Which two code fragments, independently, print each e...
- Q135. Given: (Exhibit) And given the code fragment: (Exhibit) What is the result?...
- Q136. Given: (Exhibit) What is the result?
- Q137. Given the code fragment: (Exhibit) What is the result?...
- Q138. Given: (Exhibit) What is the result?
- Q139. Given the code fragment: // insert code here arr[0] = new int[3]; arr[0][0] = 1; arr[0][1]...
- Q140. Given: (Exhibit) Which code fragment should you use at line n1 to instantiate the dvd obje...
- Q141. Given the code fragment: (Exhibit) Which code fragment at line 10 prints Welcome 100? (Exh...
- Q142. Given: (Exhibit) Which code fragment can replace the if block?...
- Q143. Which three statements are true about the structure of a Java class?...
- Q144. Given: (Exhibit) What is the result?
- Q145. Given the code fragment: What is the result if the integer aVar is 9? (Exhibit)...
- Q146. Given: (Exhibit) What is the result?
- Q147. Given the code snippet from a compiled Java source file: (Exhibit) Which command-line argu...
- Q148. Given: (Exhibit) What is the result?
- Q149. Which two are valid instantiations and initializations of a multi dimensional array? (Exhi...
- Q150. Given the code fragment: (Exhibit) Which code fragment, when inserted at line 9, enables t...
- Q151. You are asked to develop a program for a shopping application, and you are given this info...
- Q152. Given the code fragment: (Exhibit) What is the result? A: (Exhibit) B: Compilation fails o...
- Q153. Given: (Exhibit) Which option enables the code to compile? (Exhibit)...
- Q154. Given the code snippet from a compiled Java source file: (Exhibit) and this output: (Exhib...
- Q155. Given the code fragment: (Exhibit) What is the result?...
- Q156. Given this array: (Exhibit) Which two code fragments, independently, print each element in...
- Q157. Given the code fragment? public class Test { public static void main(String[] args) { Test...
- Q158. Given: (Exhibit) Which option enables the code to compile? (Exhibit)...
- Q159. Given the code fragment: (Exhibit) What is the result?...
- Q160. What is the proper way to defined a method that take two int values and returns their sum ...
- Q161. Given: (Exhibit) Which two code fragments are valid? (Exhibit)...
- Q162. Given the following class: (Exhibit) And given the following main method, located in anoth...
- Q163. Given the code fragment: (Exhibit) What is the result?...
- Q164. Given the code fragment: (Exhibit) What is the result?...
- Q165. Given: (Exhibit) What is the result?
- Q166. Given the code fragments: (Exhibit) Which modification enables the code to compile? A: (Ex...
- Q167. Given the code fragment: (Exhibit) Which two modifications should you make so that the cod...
- Q168. Given: (Exhibit) What is the result?
- Q169. Given the code fragment: (Exhibit) Which two modifications enable the code to compile?...
- Q170. Given the code fragment: (Exhibit) What is the result?...
- Q171. Given the code fragment: (Exhibit) What is the result?...
- Q172. Given the code fragment: (Exhibit) What is the result?...
- Q173. Given: (Exhibit) And given the code fragment: Book book1 = new EBook(); book1.readBook(); ...
- Q174. Given the following class: (Exhibit) Which three pieces of code, when inserted independent...
- Q175. Which of the following will print current time?...
- Q176. Given: (Exhibit) And given the code fragment: (Exhibit) What is the result?...
- Q177. Give: (Exhibit) What is the result?
- Q178. Given the code from the Greeting.Java file: (Exhibit) Which set of commands prints Hello D...
- Q179. The catch clause argument is always of type__________....
- Q180. Given the code fragment: (Exhibit) What is the result?...
- Q181. Given: (Exhibit) What is the result?
- Q182. Given this class: (Exhibit) And given this main method, located in another class: (Exhibit...
- Q183. Given: (Exhibit) Which is true?
- Q184. Given: (Exhibit) And given the commands: (Exhibit) What is the result?...
- Q185. Given: (Exhibit) And given the commands: (Exhibit) What is the result?...
- Q186. Given: (Exhibit) How many MarkList instances are created in memory at runtime?...
- Q187. Given: (Exhibit) What is the result?
- Q188. Given the code fragment: (Exhibit) Which two modifications, made independently, enable the...
- Q189. Given: (Exhibit) And given the code fragment: (Exhibit) What is the result?...
- Q190. Given the code fragment: (Exhibit) What is the result?...
- Q191. Given: (Exhibit) What is the result?
- Q192. CORRECT TEXT Given: (Exhibit) Which code fragment can replace the if block?...
- Q193. Given the code fragment: float x = 22.00f % 3.00f; int y = 22 % 3; System.out.print(x + ",...
- Q194. Given the following code: (Exhibit) What are the values of each element in intArr after th...
- Q195. Given: (Exhibit) What is the result? (Exhibit)...
- Q196. Given the code fragment: (Exhibit) What is the result?...
- Q197. Given the code fragment: int[] array = {I, 2, 3, 4, 5}; And given the requirements: 1. Pro...
- Q198. Given: (Exhibit) What is the result?
- Q199. Given the code fragment: (Exhibit) What is the result?...
- Q200. Given the code fragment: (Exhibit) Which two code fragments can be independently inserted ...
- Q201. Given: Class A { } Class B { } Interface X { } Interface Y { } Which two definitions of cl...
- Q202. Given: (Exhibit) What is the output?
- Q203. Given: (Exhibit) What is the result?
- Q204. You are developing a banking module. You have developed a class named ccMask that has a ma...
- Q205. Given the code fragment: (Exhibit) What is the result?...
- Q206. Given the code fragment: (Exhibit) What is the result?...
- Q207. Given the code fragment: (Exhibit) Which two modifications, made independently, enable the...
- Q208. Given the code fragment: (Exhibit) What is the result?...
- Q209. Given the code fragment: (Exhibit) What is the result?...
- Q210. Given: (Exhibit) What is the result?
- Q211. Given the code fragments: 9. class Student { 10. int rollnumber; 11. String name; 12. List...
- Q212. The following grid shows the state of a 2D array: (Exhibit) This grid is created with the ...
- Q213. Given: class Base { // insert code here } public class Derived extends Base{ public static...
- Q214. Which three statements describe the object-oriented features of the Java language? (Choose...
- Q215. Given: (Exhibit) What is the result?
- Q216. Which of the following can fill in the blank in this code to make it compile? (Exhibit)...
- Q217. View the exhibit: (Exhibit) What is the result when this program is executed?...
- Q218. Given the code fragment: (Exhibit) What is the result?...
- Q219. Given: (Exhibit) and the code fragment: (Exhibit) What is the result?...
- Q220. Given: (Exhibit) And given the code fragment: (Exhibit) What is the result?...
- Q221. Given: What is the result? (Exhibit)
- Q222. Given the code fragment: (Exhibit) What is the result?...
- Q223. Which two are benefits of polymorphism? (Choose two.)...
- Q224. Given the code fragment: (Exhibit) What is the result?...
- Q225. Given the code fragment: (Exhibit) What is the result?...
- Q226. Given: (Exhibit) What is the result?
- Q227. Given: (Exhibit) What is the result?
- Q228. Which code fragment cause a compilation error?...
- Q229. Given the code fragment: (Exhibit) What is the result?...
- Q230. You are asked to develop a program for a shopping application, and you are given the follo...
