JAVA Question Bank
JAVA Question Bank
B.Tech. IV SEM
DAY-WISE ASSIGNMENTS
UNIT-I:
Q1. What is object-oriented thinking? Explain how viewing the world as agents and
communities influences software design.
(Understand – Comprehension)
Q2. Define messages and methods in the context of object-oriented programming. How do
these concepts facilitate interaction between objects?
(Understand – Comprehension)
Q4. What are classes and instances? Illustrate your answer with examples that
demonstrate how a class serves as a blueprint and how instances represent concrete
objects.
(Understand – Comprehension)
Q5. Describe class hierarchies and inheritance. How does inheritance support code reuse
and model real-world relationships?
(Analyze – Analysis)
Q6. Explain method binding (static and dynamic). How does dynamic binding support
polymorphism?
(Understand – Comprehension)
Q9. Design an object-oriented model for a Library Management System that includes
agents (e.g., Book, Member, Librarian) and clearly defines their responsibilities and
interactions.
(Create – Synthesis)
Q1. Provide an overview of Java as a programming language. What are its key buzzwords
(e.g., platform independence, robust, secure, object-oriented)?
(Understand – Comprehension)
Q2. List Java’s primary data types. How do primitive types differ from reference types?
(Understand – Comprehension)
Q3. Demonstrate how variables and arrays are declared and used in Java with a simple
code snippet.
(Apply – Application)
Q4. Explain the concept of operators and expressions in Java with examples.
(Understand – Comprehension)
Q6. What is a class in Java? Describe how classes are defined and instantiated, including
the role of constructors.
(Understand – Comprehension)
Q7. Develop a simple Java class with methods that manipulate strings (e.g., a class that
provides utility methods for string reversal and concatenation).
(Apply – Application)
Q8. Differentiate between primitive data types and objects in Java, and explain why object
types are used in collections and method calls.
(Analyze – Analysis)
Q9. Assess the advantages of Java’s automatic memory management and exception
handling mechanisms in building robust applications.
(Evaluate – Evaluation)
Q10. Design a Java program that integrates variables, arrays, control statements, and
string handling to sort and display a list of names.
(Create – Synthesis)
Q2. Explain how member access modifiers (public, protected, default, private) affect
inheritance in Java.
(Apply – Application)
Q3. Demonstrate the use of constructors in a subclass and explain how the super keyword is
used to invoke superclass constructors.
(Apply – Application)
Q4. Provide a code example illustrating method overriding in a class hierarchy (e.g., a base
class Vehicle and subclasses Car and Truck with an overridden method displayInfo()).
(Apply – Application)
Q5. Discuss the use of the final keyword in inheritance and method overriding. Why might
you declare a method or class as final?
(Understand – Comprehension)
Q7. Provide a code example illustrating method overriding using a base class Vehicle and
subclasses Car and Truck.
(Apply – Application)
(Note: See Q4 above for a complete example.)
Q8. What are abstract classes in Java, and how do they differ from interfaces? Provide
examples.
(Understand – Comprehension)
Q9. Critically analyze the benefits of inheritance in terms of code reuse and
maintainability, as well as its potential costs (e.g., tight coupling, complexity).
(Evaluate – Evaluation)
Q10. Design a Java class hierarchy for a transportation system that includes multiple forms
of inheritance (e.g., specialization and extension) and demonstrates polymorphism through
method overriding. Explain your design choices.
(Create – Synthesis)
Q2. What is CLASSPATH in Java and how does it affect program execution?
(Understand – Comprehension)
Q3. How does access protection work in Java packages? Explain the roles of public,
protected, default, and private modifiers.
(Analyze – Analysis)
Q4. Describe the process of importing packages in Java. Provide examples of both regular
and static imports.
(Apply – Application)
Q5. Design a scenario where proper packaging improves code organization and
maintainability in a large project.
(Create – Synthesis)
Topic 2: Interfaces
Q8. Explain nested interfaces in Java. Provide an example scenario where a nested
interface might be used.
(Analyze – Analysis)
Q9. Discuss the concept of interface inheritance in Java. How can an interface extend
another interface?
(Apply – Application)
Q11. Differentiate between byte streams and character streams in Java I/O.
(Understand – Comprehension)
Q12. How do you read console input and write console output in Java? Provide code
examples using the Console class.
(Apply – Application)
Q13. Describe the role of the File class in Java I/O operations.
(Understand – Comprehension)
Q15. What is serialization in Java and why is it useful? Also, explain the concepts of
enumerations, auto-boxing, and generics in relation to I/O operations.
(Understand/Analyze – Comprehension/Analysis)
(Understand – Comprehension)
(Understand – Comprehension)
(Analyze – Analysis)
Q4. Explain how try-catch-finally constructs work, including multiple catch clauses and
nested try statements.
(Apply – Application)
Q5. Design a real-world banking transaction and explain how ACID properties are
maintained using exception handling.
(Create – Synthesis)
(Understand – Comprehension)
Q7. What are different methods used to ensure durability in database transactions?
(Understand – Comprehension)
Q8. How do log-based recovery techniques help in ensuring atomicity?
(Apply – Application)
Q9. Compare the advantages and disadvantages of shadow paging and write-ahead
logging.
(Evaluate – Evaluation)
(Create – Synthesis)
(Understand – Comprehension)
Q12. Explain different problems caused by concurrent transactions, such as lost updates
and dirty reads.
(Analyze – Analysis)
Q13. Define serializability and discuss its types (conflict and view serializability).
(Understand – Comprehension)
Q14. How does serializability help maintain database consistency? Explain with an
example.
(Apply – Application)
(Create – Synthesis)
(Understand – Comprehension)
Q17. Describe the different types of recoverable schedules.
(Understand – Comprehension)
(Analyze – Analysis)
(Evaluate – Evaluation)
(Create – Synthesis)
(Understand – Comprehension)
(Understand – Comprehension)
(Analyze – Analysis)
Q24. Compare the trade-offs between higher and lower isolation levels.
(Evaluate – Evaluation)
(Create – Synthesis)
(Understand – Comprehension)
Q27. Explain precedence graphs and their role in testing serializability.
(Understand – Comprehension)
Q28. How can precedence graphs be used to determine whether a schedule is serializable?
(Apply – Application)
(Evaluate – Evaluation)
Q30. Write an algorithm to check the serializability of a given schedule using a precedence
graph.
(Create – Synthesis)
Q31. What are lock-based protocols in database transactions? Explain their types.
(Understand – Comprehension)
Q32. Describe two-phase locking (2PL) and its role in concurrency control.
(Understand – Comprehension)
Q33. How does strict two-phase locking (S2PL) differ from basic 2PL?
(Analyze – Analysis)
(Evaluate – Evaluation)
(Create – Synthesis)
(Understand – Comprehension)
Q37. How do timestamps help maintain concurrency in database transactions?
(Analyze – Analysis)
(Analyze – Analysis)
(Evaluate – Evaluation)
(Create – Synthesis)
Q41. What are validation-based concurrency control protocols? Explain their working.
(Understand – Comprehension)
(Apply – Application)
(Analyze – Analysis)
Q44. What are the benefits and limitations of validation-based concurrency control?
(Evaluate – Evaluation)
(Create – Synthesis)
(Understand – Comprehension)
Q47. Explain different types of locks (shared, exclusive, intention locks) in multiple
granularity.
(Understand – Comprehension)
(Analyze – Analysis)
(Evaluate – Evaluation)
Q50. Design a multiple granularity locking mechanism for a university database system.
(Create – Synthesis)
(Understand – Comprehension)
Q52. Discuss different types of failures that affect transactions (system crash, disk failure,
transaction abort).
(Understand – Comprehension)
(Analyze – Analysis)
Q54. Compare different recovery techniques such as log-based recovery and shadow
paging.
(Evaluate – Evaluation)
(Create – Synthesis)
Topic 12: Log-Based Recovery
(Understand – Comprehension)
Q57. Describe the Write-Ahead Logging (WAL) protocol and its importance.
(Understand – Comprehension)
(Apply – Application)
(Evaluate – Evaluation)
(Create – Synthesis)
Q61. How does recovery work when multiple transactions execute concurrently?
(Understand – Comprehension)
(Understand – Comprehension)
(Apply – Application)
(Analyze – Analysis)
Q65. Develop a recovery mechanism for an online stock trading platform that supports
concurrent transactions.
(Create – Synthesis)
UNIT-IV: The Collections Framework and Utility Classes
Topic 1: Collections Overview and Collection Interfaces
6) Compare and contrast ArrayList and LinkedList in terms of performance and usage
scenarios. (Analyze – Analysis)
7) Explain how HashSet and TreeSet differ in functionality and performance. (Understand
– Comprehension)
8) Describe the differences in usage between PriorityQueue and ArrayDeque. (Analyze –
Analysis)
9) Provide a code example that demonstrates when to use each collection class (e.g.,
ArrayList for dynamic arrays, LinkedList for queue operations). (Apply – Application)
10) Discuss the advantages and disadvantages of the various collection classes and provide
real-world use cases for each. (Evaluate – Evaluation)
11) How does an Iterator work in Java? Explain its usage in traversing collections.
(Understand – Comprehension)
12) Compare using an Iterator with the for-each loop for accessing collections. What are the
pros and cons of each? (Analyze – Analysis)
13) Write a Java code snippet that demonstrates how to use an Iterator to remove elements
from a collection while iterating. (Apply – Application)
14) Discuss potential pitfalls when using iterators in concurrent modification scenarios and
propose a solution. (Evaluate – Evaluation)
15) Design a utility method that safely iterates through a collection and removes all null
elements using an Iterator. (Create – Synthesis)
21) Describe common algorithms provided by the Collections utility class (e.g., sort,
binarySearch, shuffle). (Understand – Comprehension)
22) How does the Arrays class complement the Collections Framework in Java?
(Understand – Comprehension)
23) Provide an example of using Collections.sort() with a custom Comparator on a list of
objects. (Apply – Application)
24) Discuss the performance implications of using Collections algorithms on large datasets.
(Analyze – Analysis)
25) Design a method that uses both Arrays and Collections utilities to process and sort data
from a list of objects. (Create – Synthesis)
26) What are legacy classes and interfaces in Java, and why are they considered legacy?
(Understand – Comprehension)
27) Compare Hashtable and HashMap, highlighting key differences in synchronization and
performance. (Analyze – Analysis)
28) Explain how the Properties class is used in Java applications. (Understand –
Comprehension)
29) Discuss the evolution from legacy classes such as Vector and Stack to newer collection
classes. What improvements do modern classes offer? (Evaluate – Evaluation)
30) Provide a code example that demonstrates using the Properties class to load
configuration data from a file. (Apply – Application)
31) What is the role of utility classes in java.util, and why are they important? (Understand
– Comprehension)
32) Explain how the StringTokenizer class works and compare it to the split() method of the
String class. (Analyze – Analysis)
33) Describe the functionality of the BitSet class and provide an example of its usage. (Apply
– Application)
34) Discuss the evolution of Date and Calendar classes in Java and their limitations.
(Evaluate – Evaluation)
1) What is GUI programming with Swing, and why was it introduced as an improvement
over AWT? (Understand – Comprehension)
2) Explain the Model-View-Controller (MVC) architecture as implemented in Swing.
(Understand – Comprehension)
3) Define Swing components and containers. How do they differ? (Understand –
Comprehension)
4) Describe the various layout managers available in Swing (FlowLayout, BorderLayout,
GridLayout, CardLayout, GridBagLayout) and discuss when each is most appropriate.
(Analyze – Analysis)
5) Design a simple Swing application that uses GridBagLayout to create a user registration
form with labels, text fields, and buttons. (Create – Synthesis)
6) What is the delegation event model in Swing, and how does it differ from the traditional
event handling models? (Understand – Comprehension)
7) Define the roles of event sources, event listeners, and event classes in Swing’s event
handling. (Understand – Comprehension)
8) Describe how to handle mouse and keyboard events in Swing, and provide a brief code
example using an adapter class. (Apply – Application)
9) Compare the use of inner classes and anonymous inner classes for event handling in
Swing. What are the advantages and potential drawbacks of each approach? (Analyze –
Analysis)
10) Design an example where an anonymous inner class is used to handle a button click
event in a Swing application. (Create – Synthesis)
11) Explain the difference between Swing applications and applets. (Understand –
Comprehension)
12) What security issues are associated with applets, and how do they differ from those in
standalone applications? (Analyze – Analysis)
13) How are parameters passed to applets via HTML? Provide an example snippet. (Apply –
Application)
14) Describe the process of painting in Swing, including the use of the paintComponent()
method. (Understand – Comprehension)
15) Develop a simple Swing applet that draws a custom graphic (e.g., a smiley face) and
includes a button to change its color. (Create – Synthesis)
16) Discuss common Swing controls (e.g., JLabel, JTextField, JButton, JToggleButton,
JCheckBox, JRadioButton, JTabbedPane, JScrollPane, JList, JComboBox, Swing Menus,
Dialogs) and their typical use cases. (Evaluate – Evaluation)