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 »

181. What is the purpose of the 'jwebserver' tool (Java 18+)?

  • a) To deploy web applications
  • b) To provide a simple HTTP server
  • c) To analyze web traffic
  • d) To optimize web services
Answer: B - Minimal HTTP server for prototyping and testing.

182. Which is not a valid Java virtual thread feature (Java 19+)?

  • a) Lightweight threads
  • b) Managed by JVM
  • c) Mapped 1:1 to OS threads
  • d) High throughput
Answer: C - Virtual threads use M:N mapping to OS threads.

183. What is the purpose of the 'Vector API' incubator feature?

  • a) To handle mathematical vectors
  • b) To express vector computations
  • c) To replace java.util.Vector
  • d) To implement geometric algorithms
Answer: B - For expressing vector math computations that compile to optimal hardware instructions.

184. Which is not a valid Java pattern matching use case?

  • a) instanceof checks
  • b) switch expressions
  • c) try-catch blocks
  • d) record deconstruction
Answer: C - Pattern matching isn't used with try-catch (as of Java 19).

185. What is the purpose of the 'Foreign Function & Memory API'?

  • a) To call native code
  • b) To manage off-heap memory
  • c) To interoperate with C libraries
  • d) All of the above
Answer: D - Enables Java programs to interoperate with native code and memory.

186. Which is not a valid Java 19 language feature?

  • a) Record patterns
  • b) Virtual threads
  • c) Pattern matching for switch
  • d) Value types
Answer: D - Value types are not yet part of standard Java (as of 19).

187. What is the purpose of the 'Structured Concurrency API' incubator?

  • a) To manage thread pools
  • b) To treat multiple tasks as single unit
  • c) To implement async/await
  • d) To replace ExecutorService
Answer: B - Treats related async tasks as single unit of work.

188. Which is not a valid Java 20 preview feature?

  • a) Record patterns
  • b) Pattern matching for switch
  • c) Virtual threads
  • d) Foreign function API
Answer: C - Virtual threads were finalized in Java 21 (preview in 19).

189. What is the purpose of the 'Scoped Values' incubator feature?

  • a) To replace ThreadLocal
  • b) To provide immutable method parameters
  • c) To implement value scoping
  • d) To optimize memory usage
Answer: A - Designed to be a better alternative to ThreadLocal for virtual threads.

190. Which is not a valid Java 21 feature?

  • a) Virtual threads
  • b) Record patterns
  • c) String templates
  • d) Value types
Answer: D - Value types are not yet part of standard Java (as of 21).

191. What is the purpose of the 'String Templates' preview feature?

  • a) To simplify string formatting
  • b) To enable template engines
  • c) To optimize string concatenation
  • d) To implement heredoc strings
Answer: A - Simplifies string interpolation with embedded expressions.

192. Which is not a valid Java concurrency improvement in recent versions?

  • a) Virtual threads
  • b) Structured concurrency
  • c) Scoped values
  • d) Parallel streams
Answer: D - Parallel streams existed since Java 8 (not a recent improvement).

193. What is the purpose of the 'Unnamed Patterns and Variables' preview?

  • a) To skip unused pattern variables
  • b) To implement wildcards
  • c) To optimize pattern matching
  • d) To replace null checks
Answer: A - Allows using underscore _ for unused pattern variables.

194. Which is not a valid Java 22 preview feature?

  • a) String templates
  • b) Implicit classes
  • c) Unnamed variables
  • d) Foreign function API
Answer: B - Implicit classes are not a current Java feature.

195. What is the purpose of the 'Region Pinning for G1' feature?

  • a) To optimize GC for virtual threads
  • b) To reduce GC pause times
  • c) To implement memory regions
  • d) To replace ZGC
Answer: B - Reduces GC pauses by avoiding unnecessary region evacuations.

196. Which is not a valid Java future feature under consideration?

  • a) Value types
  • b) Universal generics
  • c) Extended enums
  • d) Operator overloading
Answer: D - Operator overloading is not currently being considered.

197. What is the purpose of the 'Leyden' project?

  • a) To optimize startup time
  • b) To create static images
  • c) To reduce memory footprint
  • d) All of the above
Answer: D - Aims to improve Java startup, performance, and footprint.

198. Which is not a valid Java enhancement proposal (JEP) in recent versions?

  • a) JEP 425: Virtual Threads
  • b) JEP 428: Structured Concurrency
  • c) JEP 420: Pattern Matching
  • d) JEP 450: Value Types
Answer: D - There is no JEP 450 for Value Types (as of Java 21).

199. What is the purpose of the 'Amber' project?

  • a) To improve Java syntax
  • b) To optimize performance
  • c) To enhance security
  • d) To implement new GC algorithms
Answer: A - Focuses on productivity-oriented language features.

200. Which is not a valid Java project (OpenJDK initiative)?

  • a) Loom
  • b) Valhalla
  • c) Panama
  • d) Sparta
Answer: D - There is no Sparta project (but there is Skara for source control).
« 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.