Impotarnt Topics
Unit 1
1. What is the significance of the JVM (Java Virtual Machine) in the Java environment, and how does
it enable platform independence? (Answer should include explanation of JVM's role in compiling and
running Java code)
2. Write a simple Java program that demonstrates the use of constructors and methods in a class.
(Answer should include a Java class with a constructor and at least one method, and a main method
to test it)
3. What is the difference between the "final" and "static" keywords in Java? Provide an example of
when you would use each. (Answer should include explanation of final and static keywords, and
example code)
4. Create a Java class that demonstrates encapsulation by having private instance variables and
public getter/setter methods. (Answer should include a Java class with private instance variables and
public getter/setter methods)
5. Write a Java program that uses inheritance to create a subclass that overrides a method from its
superclass. (Answer should include a Java superclass and subclass with overridden method)
6. What is the purpose of packages in Java, and how do you define and use a package in a Java
program? (Answer should include explanation of packages, and example code of defining and
importing a package)
7. Write a Java program that uses an interface to define a method that must be implemented by any
class that implements it. (Answer should include a Java interface and a class that implements it)
8. What is the difference between "overloading" and "overriding" in Java? Provide an example of
each. (Answer should include explanation of overloading and overriding, and example code)
9. Create a Java program that demonstrates the use of arrays and strings. (Answer should include
Java code that uses arrays and strings)
10. Write a Java program that uses abstraction to define an abstract class with an abstract method
that must be implemented by any subclass. (Answer should include a Java abstract class and a
subclass that implements the abstract method)
Unit2
1. What is the purpose of exception handling in Java, and how does it differ from error handling?
2. What is the difference between checked and unchecked exceptions in Java? Provide an example
of each.
3. How does the JVM react to an exception, and what is the role of the try, catch, and finally blocks
in exception handling?
4. Write a Java program that demonstrates the use of a try, catch, and finally block to handle an
exception.
5. What is the difference between a throw and a throws statement in Java? Provide an example of
when you would use each.
6. How do you create a user-defined exception in Java, and what are the benefits of doing so?
7. What is the purpose of the BufferedReader and BufferedWriter classes in Java, and how do they
improve input/output operations?
8. Write a Java program that demonstrates the use of multithreading to perform two tasks
concurrently.
9. What is the purpose of synchronization in multithreading, and how do you achieve it in Java?
10. What is the difference between the start() and run() methods in a Java thread, and when should
you use each?
Unit 3
1. What is a functional interface in Java, and how does it relate to lambda expressions?
2. Write a Java program that demonstrates the use of lambda expressions to implement a functional
interface.
3. What is the purpose of the Stream API in Java, and how does it improve data processing?
4. How do you use method references in Java, and what are the benefits of doing so?
5. What is the difference between default methods and static methods in Java interfaces?
6. How do you use the forEach method in Java, and what are the benefits of using it?
7. What is the purpose of the try-with-resources statement in Java, and how does it improve
resource management?
8. How do you use local variable type inference in Java, and what are the benefits of doing so?
9. What is the purpose of switch expressions in Java, and how do they improve code readability?
10. What is the purpose of records in Java, and how do they improve data encapsulation?
Unit 4
1. What is the difference between the Collection and Collections classes in Java?
2. How does the Iterator interface work in Java, and what are its benefits?
3. What is the difference between the List and Set interfaces in Java, and when would you use each?
4. How does the ArrayList class differ from the LinkedList class in terms of performance and usage?
5. What is the purpose of the HashMap class in Java, and how does it differ from the Hashtable
class?
6. How do you sort a collection of objects in Java using the Comparable and Comparator interfaces?
7. What is the difference between the HashSet and LinkedHashSet classes in Java, and when would
you use each?
8. How does the TreeSet class maintain a sorted order of elements, and what are its benefits?
9. What is the purpose of the Properties class in Java, and how is it used to store and retrieve
configuration data?
10. How do you iterate over a collection of objects in Java using the foreach loop and the Iterator
interface?
Unit5
1. What is the core concept of Dependency Injection in Spring, and how does it relate to Inversion of
Control?
2. How do you configure and use Aspect-Oriented Programming (AOP) in Spring to implement cross-
cutting concerns?
3. What are the different bean scopes in Spring (Singleton, Prototype, Request, Session, Application,
Web Socket), and when would you use each?
4. How does auto-wiring work in Spring, and what are the benefits of using annotations for
configuration?
5. What is the difference between the various life cycle callbacks in Spring beans (e.g.
@PostConstruct, @PreDestroy)?
6. How do you build a RESTful web service using Spring Boot, and what are the key annotations (e.g.
@RestController, @RequestMapping)?
7. What is the purpose of the @RequestBody and @PathVariable annotations in Spring Boot, and
how do you use them?
8. How do you configure and use logging in Spring Boot, and what are the benefits of using a logging
framework?
9. What is the difference between the various build systems in Spring Boot (e.g. Maven, Gradle), and
how do you configure them?
10. How do you build a web application using Spring Boot, and what are the key components (e.g.
controllers, templates, static resources)?