Java Question Paper – Set 2
1. Explain the complete architecture of Java including JDK, JRE, JVM. Describe how Java achieves
platform independence. Provide a detailed explanation of bytecode and class loading mechanism.
2. Explain Object-Oriented Programming principles in Java: Encapsulation, Abstraction,
Inheritance, and Polymorphism. For each principle, provide real-world examples and sample code
snippets to justify the explanation.
3. Discuss the Java memory model in detail. Explain heap memory, stack memory, method area,
and metaspace. Describe how garbage collection works and compare Serial GC, Parallel GC, and
G1 GC.
4. Compare ArrayList, LinkedList, HashSet, TreeSet, HashMap, and TreeMap. Explain their internal
working, time complexity for major operations, and real-world use cases.
5. Explain exception handling in Java. Discuss checked vs unchecked exceptions. Write a detailed
example demonstrating try, catch, finally, throw, and throws keywords.
6. Describe multithreading in Java. Explain thread lifecycle, synchronization, inter-thread
communication, and problems like deadlock, starvation, and race condition with proper examples.
7. Explain the concept of Streams API introduced in Java 8. Discuss lambda expressions,
functional interfaces, method references, and default/static methods in interfaces.
8. Explain JDBC architecture. Describe steps to connect to a database, execute queries, and
handle transactions with commit and rollback.
9. Compare REST and SOAP web services. Explain how Spring Boot simplifies REST API
development. Discuss dependency injection and annotations like @RestController, @Service,
@Repository.
10. Discuss Java Security concepts. Explain authentication vs authorization, role-based access
control, and basic JWT flow in modern applications.
11. Write detailed notes on Java file handling. Explain File class, FileReader, FileWriter,
BufferedReader, and BufferedWriter with examples.
12. Explain generics in Java. Why were generics introduced? Discuss type safety, bounded types,
wildcard usage, and type erasure in detail.
13. Describe the SOLID principles in the context of Java development. Provide practical examples
demonstrating each principle in a small system design.
14. Explain the difference between Comparable and Comparator interfaces with examples.
Demonstrate custom sorting of objects.
15. Design a simple banking system using Java classes demonstrating OOP principles, exception
handling, collections usage, and multithreading where applicable.