0% found this document useful (0 votes)
14 views15 pages

JAVA Question Bank

The document outlines a comprehensive curriculum for a Java Programming course, detailing day-wise assignments across multiple units. Topics include object-oriented concepts, Java syntax, inheritance, polymorphism, exception handling, multithreading, and the collections framework. Each unit contains a series of questions aimed at assessing understanding, application, analysis, and synthesis of Java programming principles.

Uploaded by

Sireesha Marri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views15 pages

JAVA Question Bank

The document outlines a comprehensive curriculum for a Java Programming course, detailing day-wise assignments across multiple units. Topics include object-oriented concepts, Java syntax, inheritance, polymorphism, exception handling, multithreading, and the collections framework. Each unit contains a series of questions aimed at assessing understanding, application, analysis, and synthesis of Java programming principles.

Uploaded by

Sireesha Marri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

19CS405PC: JAVA PROGRAMMING

B.Tech. IV SEM

DAY-WISE ASSIGNMENTS

UNIT-I:

Topic 1: Object-Oriented Thinking and Concepts

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)

Q3. What are responsibilities in object-oriented design? Illustrate how assigning


responsibilities to objects can lead to more maintainable code.
(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)

Q7. Provide an example in which method overriding is used to implement polymorphism in


an object-oriented system.
(Apply – Application)

Q8. Discuss the benefits and potential drawbacks of object-oriented concepts


(encapsulation, abstraction, inheritance, and polymorphism) in software development.
(Evaluate – Evaluation)

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)

Q10. Critically assess how object-oriented thinking enhances modularity and


maintainability in large-scale software projects.
(Evaluate – Evaluation)

Topic 2: Java Overview and Basic Syntax

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)

Topic 3: Inheritance and Polymorphism


Q1. Define inheritance in Java. How does it facilitate code reuse and the creation of
hierarchical relationships?
(Understand – Comprehension)

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)

Q6. Differentiate between ad hoc polymorphism (overloading) and pure polymorphism


(overriding) with examples.
(Analyze – Analysis)

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)

UNIT-II: Java Packages, Interfaces, and Stream-Based I/O


Topic 1: Packages
Q1. What is a package in Java? Explain its importance in code organization and
namespace management.
(Understand – Comprehension)

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

Q6. What is an interface in Java and what purpose does it serve?


(Understand – Comprehension)

Q7. How do you implement an interface in Java? Provide a code example.


(Apply – Application)

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)

Q10. Evaluate the advantages of using interfaces for abstraction in Java.


(Evaluate – Evaluation)

Topic 3: Stream-Based I/O (java.io) and Related Concepts

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)

Q14. Explain how to perform random access file operations in Java.


(Apply – Application)

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)

UNIT-III: Exception Handling and Multithreading


Topic 1: Exception Handling

Q1. What is exception handling? Explain its importance in Java.

(Understand – Comprehension)

Q2. Describe the different types of exceptions in Java.

(Understand – Comprehension)

Q3. Compare termination and resumptive models of exception handling.

(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)

Topic 2: Implementation of Atomicity and Durability

Q6. Explain how atomicity is implemented in database transactions.

(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)

Q10. Develop a step-by-step process to implement atomicity in an online shopping


transaction system.

(Create – Synthesis)

Topic 3: Concurrent Executions and Serializability

Q11. What is concurrent execution in databases? Why is it necessary?

(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)

Q15. Develop an algorithm to check whether a given schedule is conflict-serializable.

(Create – Synthesis)

Topic 4: Recoverability in Transactions

Q16. What is recoverability in database transactions? Explain its importance.

(Understand – Comprehension)
Q17. Describe the different types of recoverable schedules.

(Understand – Comprehension)

Q18. What are cascading rollbacks? How can they be prevented?

(Analyze – Analysis)

Q19. Differentiate between strict, rigorous, and cascadeless schedules.

(Evaluate – Evaluation)

Q20. Propose a strategy to implement recoverable transactions in an airline reservation


system.

(Create – Synthesis)

Topic 5: Implementation of Isolation

Q21. What is isolation in database transactions? Why is it necessary?

(Understand – Comprehension)

Q22. Describe the different levels of isolation in SQL.

(Understand – Comprehension)

Q23. How do isolation levels impact performance and concurrency?

(Analyze – Analysis)

Q24. Compare the trade-offs between higher and lower isolation levels.

(Evaluate – Evaluation)

Q25. Design an isolation strategy for a large-scale e-commerce platform.

(Create – Synthesis)

Topic 6: Testing for Serializability

Q26. What is serializability testing? Why is it important?

(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)

Q29. Evaluate the limitations of serializability testing methods.

(Evaluate – Evaluation)

Q30. Write an algorithm to check the serializability of a given schedule using a precedence
graph.

(Create – Synthesis)

Topic 7: Lock-Based Protocols

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)

Q34. Discuss the impact of deadlocks in lock-based concurrency control.

(Evaluate – Evaluation)

Q35. Propose a lock-based protocol for handling concurrent transactions in a banking


system.

(Create – Synthesis)

Topic 8: Timestamp-Based Protocols

Q36. What are timestamp-based concurrency control protocols?

(Understand – Comprehension)
Q37. How do timestamps help maintain concurrency in database transactions?

(Analyze – Analysis)

Q38. Differentiate between optimistic concurrency control and timestamp ordering.

(Analyze – Analysis)

Q39. Discuss the challenges of timestamp-based protocols in large-scale distributed


databases.

(Evaluate – Evaluation)

Q40. Design a timestamp-based concurrency control mechanism for a ride-sharing


application.

(Create – Synthesis)

Topic 9: Validation-Based Protocols

Q41. What are validation-based concurrency control protocols? Explain their working.

(Understand – Comprehension)

Q42. How do validation techniques prevent conflicts between concurrent transactions?

(Apply – Application)

Q43. Compare validation-based protocols with lock-based protocols.

(Analyze – Analysis)

Q44. What are the benefits and limitations of validation-based concurrency control?

(Evaluate – Evaluation)

Q45. Develop an algorithm to validate transaction execution using validation-based


techniques.

(Create – Synthesis)

Topic 10: Multiple Granularity


Q46. What is multiple granularity locking? How does it improve concurrency?

(Understand – Comprehension)

Q47. Explain different types of locks (shared, exclusive, intention locks) in multiple
granularity.

(Understand – Comprehension)

Q48. How does the locking hierarchy work in multiple granularity?

(Analyze – Analysis)

Q49. Discuss the trade-offs between fine-grained and coarse-grained locking.

(Evaluate – Evaluation)

Q50. Design a multiple granularity locking mechanism for a university database system.

(Create – Synthesis)

Topic 11: Recovery and Atomicity

Q51. What is transaction recovery in database systems? Explain its need.

(Understand – Comprehension)

Q52. Discuss different types of failures that affect transactions (system crash, disk failure,
transaction abort).

(Understand – Comprehension)

Q53. How does atomicity affect transaction recovery?

(Analyze – Analysis)

Q54. Compare different recovery techniques such as log-based recovery and shadow
paging.

(Evaluate – Evaluation)

Q55. Develop a transaction recovery system for a cloud-based financial application.

(Create – Synthesis)
Topic 12: Log-Based Recovery

Q56. What is log-based recovery? Explain different types of logs.

(Understand – Comprehension)

Q57. Describe the Write-Ahead Logging (WAL) protocol and its importance.

(Understand – Comprehension)

Q58. How does log-based recovery ensure atomicity and durability?

(Apply – Application)

Q59. Evaluate the advantages and limitations of log-based recovery mechanisms.

(Evaluate – Evaluation)

Q60. Implement a simple logging mechanism to track transactions in a database system.

(Create – Synthesis)

Topic 13: Recovery with Concurrent Transactions

Q61. How does recovery work when multiple transactions execute concurrently?

(Understand – Comprehension)

Q62. Explain checkpointing in databases and its role in transaction recovery.

(Understand – Comprehension)

Q63. What are undo and redo operations in transaction recovery?

(Apply – Application)

Q64. Compare immediate and deferred update recovery techniques.

(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

1) What is the Java Collections Framework, and why is it important? (Understand –


Comprehension)
2) Describe the primary Collection interfaces in Java and their roles. (Understand –
Comprehension)
3) How do Collection interfaces promote code reusability and flexibility in Java? (Analyze
– Analysis)
4) Give an example scenario where using a Set is more appropriate than a List. (Apply –
Application)
5) Discuss the advantages of using interfaces in the Collections Framework over concrete
classes. (Evaluate – Evaluation)

Topic 2: The Collection Classes (ArrayList, LinkedList, HashSet, TreeSet,


PriorityQueue, ArrayDeque)

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)

Topic 3: Accessing a Collection via an Iterator and For-Each

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)

Topic 4: Map Interfaces and Comparators


16) What is the purpose of the Map interface in Java? How does it differ from other
Collection interfaces? (Understand – Comprehension)
17) Compare HashMap, TreeMap, and LinkedHashMap in terms of ordering and
performance. (Analyze – Analysis)
18) Explain the role of Comparators in sorting collections and maps. Provide an example
using a TreeMap. (Apply – Application)
19) Discuss how custom Comparators can be used to sort complex objects, and identify
potential pitfalls. (Evaluate – Evaluation)
20) Design a scenario where you implement a custom Comparator to sort a collection of
objects (e.g., Books) by multiple fields (e.g., author and title). (Create – Synthesis)

Topic 5: Collection Algorithms and Arrays

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)

Topic 6: Legacy Classes and Interfaces

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)

Topic 7: Utility Classes (StringTokenizer, BitSet, Date, Calendar, Random,


Formatter, Scanner)

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)

UNIT-V: GUI Programming with Swing and Applets


Topic 1: GUI Programming with Swing and Layout Managers

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)

Topic 2: Event Handling in Swing

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)

Topic 3: Swing Applications and Applets

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)

You might also like