Java Full Question Bank
Java Full Question Bank
Question Bank
Subject Name: Object oriented programming with java Subject Code: BCS-403
Q.No UNIT-1
1. What are some key features of Java that make it popular for software development?
4. Describe the components of the Java environment necessary for Java development.
11. Explain how to declare, initialize, and manipulate arrays and strings.
13. How does the final keyword affect variables, methods, and classes?
15. Explain following: 1. Java Variables 2. Java Literals 3. Different operators in java
16. Define super class and sub class in the context of inheritance.
17. Define polymorphism and its types in Java. Provide examples demonstrating compile-time and
runtime polymorphism.
18. What is method overriding in Java? Explain the rules and conditions for method overriding.
19. Discuss the differences between method overloading and method overriding
IMS Engineering College
NH-09, Adhyatmik Nagar, Near Dasna, Distt. Ghaziabad, U.P.
Tel: (0120) 4940000
20. Is there any alternative solution for Inheritance? If so explain the advantages and disadvantages
of it.
21. What is abstraction, and why is it important in Java? Discuss how abstraction is achieved in
Java through abstract classes and interfaces.
22. What are the types of inheritances in java? Explain each of them in detail
23. Write a java program to implement various types of inheritance. i. Single ii. Multi-Level iii.
Hierarchical iv. Hybrid
24. Create an abstract class Media (id, description). Derive classes Book (pagecount) and CD
(playtime). Define parameterized constructors. Create one object of Book and CD each and
display the details.
25. What is interface? Write a program to demonstrate how interfaces can be extended.
26. Write a java program to implement the following a. Creation of simple package b. Accessing a
package
27. What is package? How do you create a package? Explain about the access protection in
packages?
28. Define package? What is the significance of CLASS PATH variable?
29. What is a JAR file, and how is it used in Java? Describe the steps involved in creating a JAR
file for a library package.
30. What is the import statement used for in Java? Explain the difference between regular import
and static import.
31. Discuss the naming conventions for packages in Java. What are some best practices to follow
when naming packages?
3. Describe the different types of exceptions in Java (checked exceptions, unchecked exceptions,
runtime exceptions).
4. Define exception? Explain about various keywords used in handling the exceptions
5. What happens when an exception occurs during program execution in Java? Describe how the
JVM reacts to exceptions and errors.
6. In Java, is exception handling implicit or explicit or both? Explain with the help of example
Java programs
7. Discuss the concept of exception handling and its significance in software development.
8.
Discuss the roles of Checked and Unchecked Exceptions with your supporting examples.
9.
Explain the purpose of the try-catch-finally blocks in Java exception handling.
IMS Engineering College
NH-09, Adhyatmik Nagar, Near Dasna, Distt. Ghaziabad, U.P.
Tel: (0120) 4940000
10. Discuss the role of the throw and throws keywords in exception handling.
11. What are in-built exceptions in Java, and how are they used?
12. How can you define custom (user-defined) exceptions in Java?
13. Explain the concept of command- line argument with suitable program.
14. What are byte streams and character streams in Java I/O? Explain the difference between byte
streams and character streams.
15. How can you read data from a file using byte streams in Java? Provide an example of reading a
text file using FileInputStream and BufferedInputStream.
16. How can you write data to a file using byte streams in Java? Provide an example of writing to a
text file using FileOutputStream and BufferedOutputStream.
17. Provide examples of reading and writing text files using FileReader, FileWriter,
BufferedReader, and BufferedWriter.
18. Explain creation of thread using run able interface with an example
19. Explain about inter –thread Communication with an example
20. Explain the life cycle of a thread and multithreading
21. Explain about thread interrupts with an example
22. Implementing Run able interface and extending Thread, which method you prefer for
multithreading and why?
23. With the help of an example, explain multithreading by extending Thread class ?
24. What are daemon threads, and how are they different from user threads?
25. Write a Java program that creates three threads. First thread displays OOPS, the second thread
displays Through and the third thread Displays JAVA by using Runnable interface
26. Write a java program which accepts withdraw amount from the user and throws an exception
In Sufficient Funds when withdraw amount more than available amount. Write a java program
to illustrate finally block.
Q.No UNIT-3
1. What Is a Functional Interface? What Are the Rules of Defining a Functional Interface?
2. Describe Some of the Functional Interfaces in the Standard Library. What Is a Lambda
Expression and What Is It Used For?
3. What is a default method? What is a static method?
6. Is is possible to define our own Functional Interface? What is @FunctionalInterface? What are
the rules to define a Functional Interface
7. When do we go for Stream API? Why do we need to use Stream API in our projects?
Q.No UNIT-4
1. Explain the hierarchy of the Collection Framework in Java.
2. What is the purpose of the Iterator interface in Java's Collection Framework?
3. Differentiate between the Collection interface and the Collections class in Java.
4. Compare and contrast ArrayList, LinkedList, and Vector in Java.
5. What is the role of the Set interface in Java, and how does it differ from other collection types?
6. Discuss the differences between HashSet, LinkedHashSet, and TreeSet in Java.
7. How does the TreeMap class differ from HashMap and LinkedHashMap in Java?
8. What is the Comparable interface, and how is it used for sorting objects in Java?
9. Discuss the properties and applications of the Properties class in Java.
10. How does the Hashtable class differ from HashMap in Java, and when would you prefer to use
each?
11. Describe the Properties class in Java and its common use cases.
12. What is the ordering of elements in a LinkedHashSet?
13. Write a Java program that demonstrates sorting an ArrayList of custom objects using the
Comparable interface.
14. Write a Java program to demonstrate basic operations (addition, removal, and iteration) on a
HashSet containing strings.
15. Implement a Java program to create a TreeSet of integers and perform operations like addition,
removal, and printing in sorted order.
UNIT-5
1. Explain the concept of dependency injection in Spring.
3. What is Inversion of Control in the context of Spring? How does Spring implement IoC?
4. Explain the different bean scopes in Spring (Singleton, Prototype, Request, Session,
Application).
5. What is autowiring in Spring. Explain different types of autowiring modes in Spring
6. List and explain some commonly used annotations in Spring. How do annotations reduce the
need for XML configuration?
7. Describe the life cycle of a Spring bean