Java - Programming MCQ Questions and Answers

Test your knowledge of Java Programming Language with these interactive multiple-choice questions.

« First 7 8 9 10 Last »
« Previous Page Next Page »

161. What is the purpose of the 'jdeprscan' tool?

  • a) To scan for deprecated API usage
  • b) To analyze JAR dependencies
  • c) To detect memory leaks
  • d) To optimize bytecode
Answer: A - Static tool that scans for use of deprecated APIs (Java 9+).

162. Which is not a valid Java class file attribute?

  • a) Code
  • b) LineNumberTable
  • c) MethodParameters
  • d) FieldValues
Answer: D - There's no FieldValues attribute (but ConstantValue exists).

163. What is the purpose of the 'jlink' tool?

  • a) To link JavaScript with Java
  • b) To create custom runtime images
  • c) To generate Javadoc links
  • d) To analyze JVM performance
Answer: B - Assembles modules into custom runtime images (Java 9+).

164. Which is not a valid Java annotation processor option?

  • a) -processor
  • b) -processorpath
  • c) -proc:only
  • d) -annotate
Answer: D - There's no -annotate option for javac.

165. What is the purpose of the 'jmod' tool?

  • a) To create Java modules
  • b) To analyze JAR files
  • c) To optimize memory usage
  • d) To generate module documentation
Answer: A - Creates JMOD files for modular Java applications (Java 9+).

166. Which is not a valid Java memory pool?

  • a) Eden Space
  • b) Survivor Space
  • c) Old Gen
  • d) Permanent Space
Answer: D - There's Permanent Generation in Java 7 but not in newer versions.

167. What is the purpose of the 'jhsdb' tool?

  • a) To debug hung JVMs
  • b) To analyze heap dumps
  • c) To monitor performance
  • d) All of the above
Answer: D - HotSpot Debugger for various diagnostic tasks (Java 9+).

168. Which is not a valid Java bytecode verification type?

  • a) Top
  • b) Integer
  • c) Float
  • d) Number
Answer: D - Number is not a verification type (but there is Double).

169. What is the purpose of the 'jconsole' tool?

  • a) To monitor JVM statistics
  • b) To analyze thread dumps
  • c) To manage JMX beans
  • d) All of the above
Answer: D - Graphical monitoring tool for JVM metrics and management.

170. Which is not a valid Java garbage collector algorithm?

  • a) Mark-Sweep-Compact
  • b) Generational
  • c) Reference Counting
  • d) Train
Answer: C - Reference counting is not used in JVM garbage collectors.

171. What is the purpose of the 'jstat' tool?

  • a) To display JVM statistics
  • b) To analyze stack traces
  • c) To optimize bytecode
  • d) To verify class files
Answer: A - Monitors JVM performance statistics in real-time.

172. Which is not a valid Java class file version?

  • a) 45.3
  • b) 52.0
  • c) 55.0
  • d) 61.0
Answer: A - Class file versions are whole numbers (major.minor).

173. What is the purpose of the 'jstack' tool?

  • a) To analyze stack frames
  • b) To print thread dumps
  • c) To monitor stack usage
  • d) To optimize method calls
Answer: B - Prints Java stack traces for all threads in a JVM.

174. Which is not a valid Java bytecode instruction category?

  • a) Load and store
  • b) Arithmetic
  • c) Type conversion
  • d) Memory allocation
Answer: D - Memory allocation is handled by specific instructions like 'new'.

175. What is the purpose of the 'jmap' tool?

  • a) To print memory maps
  • b) To generate heap dumps
  • c) To analyze object histograms
  • d) All of the above
Answer: D - Memory analysis tool for Java applications.

176. Which is not a valid Java class file access flag?

  • a) ACC_PUBLIC
  • b) ACC_FINAL
  • c) ACC_STATIC
  • d) ACC_CONSTANT
Answer: D - There's no ACC_CONSTANT flag (but ACC_SUPER exists).

177. What is the purpose of the 'jcmd' tool?

  • a) To send diagnostic commands
  • b) To compile Java code
  • c) To analyze performance
  • d) To optimize JVM settings
Answer: A - Sends diagnostic command requests to a running JVM (Java 7+).

178. Which is not a valid Java bytecode verification error?

  • a) NoSuchMethodError
  • b) VerifyError
  • c) ClassFormatError
  • d) BytecodeError
Answer: D - There's no BytecodeError in standard Java.

179. What is the purpose of the 'jstatd' tool?

  • a) To monitor remote JVMs
  • b) To analyze statistics
  • c) To optimize performance
  • d) To debug applications
Answer: A - Daemon for remote monitoring via JMX.

180. Which is not a valid Java class file constant pool tag?

  • a) CONSTANT_Class
  • b) CONSTANT_Fieldref
  • c) CONSTANT_LocalVariable
  • d) CONSTANT_NameAndType
Answer: C - There's no CONSTANT_LocalVariable tag.
« First 7 8 9 10 Last »
« Previous Page Next Page »

Learn Computer Skills with PCBooks

Master computer skills with PCBooks! Explore interactive tutorials, MCQ tests, and online exams for programming, web development, and IT fundamentals. Perfect for beginners and advanced learners.

Online MCQ Tests for Programming

Practice programming MCQ questions and improve your coding skills with our online quizzes. Whether you're learning Python, Java, or C programming, PCBooks has you covered.

Free Web Development Tutorials

Learn HTML, CSS, and JavaScript with our free web development tutorials. Test your knowledge with interactive quizzes and online exams.