Cs3391-Question Bank
Cs3391-Question Bank
Cs3391-Question Bank
PROGRAMMING UNIT I
INTRODUCTION TO OOP AND JAVA
PART – A (2 marks)
1 Express what is meant by Object Oriented Programming.
2 Compare class and object.
3 List the core OOP’s concepts.
4 Tabulate the difference between C++ and Java
5 Discuss what is meant by abstraction
6 Describe about Encapsulation, Inheritance and Polymorphism
7 Point out the justification of the statement “Java is platform independent”.( Express a
Java programming structure to display “Hello World”.
8 List the various access specifiers supported by OOPS.
9 Illustrate constructors in Java.
10 Express a simple Java Program to find the given number is Prime or
not. 11 Write down the characteristics of objects.
12 Illustrate with example what is meant by parameter passing constructor
13 Quote the purpose of finalize methods
14 List out the type of Arrays.
15 Illustrate the working of Java Virtual Machine
(JVM). 16 Define static variable and static method.
17 Explain what is meant by Java package.
18 Illustrate how to import a single
package.
19 Summarize any four Java doc comments List any four common browsers.
30.1. Discuss in detail the four principles of Object-Oriented Programming (OOP) and provide Java
code examples for each.
30.2. Write a detailed explanation of how to define and use classes and objects in Java,
including constructors, methods, and access specifiers. Provide a complete Java code
example.
30.3. Explain the concept of polymorphism with a detailed example that demonstrates both
method overloading and method overriding.
30.4. Provide an in-depth explanation of encapsulation and its benefits. Illustrate with a Java program
that uses private data members and public getter/setter methods.
30.5. Discuss Java data types and variables, including primitive types, wrapper classes, and
type conversions. Provide code examples to demonstrate their use.
30.6. Explain the different control statements available in Java (if-else, switch, while, for, do-while) with
examples and discuss their usage scenarios
30.7. Explain a Java program to find a smallest number in the given array by creating one dimensional
array and two dimensional array using new operator.
30.8. Explain class hierarchy and explain its types with suitable examples.
30.9. Illustrate the use of arrays in Java, including single-dimensional and multi-dimensional arrays.
Write a complete program that demonstrates array manipulation and operations.
30.10.Illustrate a Java application to generate Electricity bill. Create a class with the following
members: Consumer no., consumer name, previous month reading, current month reading, and type
of EB connection (i.e. domestic or commercial). Compute the bill amount using the following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
30.10.1.First 100 units - Rs. 1 per unit
30.10.2.101-200 units - Rs. 2.50 per unit
30.10.3.201 -500 units - Rs. 4 per unit
30.10.4.> 501 units - Rs. 6 per unit
UNIT II
INHERITANCE, PACKAGES AND
INTERFACES
PART – A (2 marks)
1. Illustrate a program to perform string operations using Array List. Write functions for the
following Append - add at end
Insert – add at particular index Search
List all string starts with given letter
“a”.
2. Assess and write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle
and Square. Use Quadrilateral as the super class of the hierarchy. Specify the instance variable and
methods for each class. The private instance variables of Quadrilateral should be the x-y coordinate pairs
for the four end points of the quadrilateral.
3. Write a program that instances objects of your classes and outputs each objects area (except Quadrilateral)
4. Consider a class student .Inherit this class in UG Student and PG Student. Also inherit students into
local and non-local students. Define five Local UG Students with a constructor assuming all classes
have a constructor.
5. Express a Java Program to create an abstract class named Shape that contains two integers and an empty
method named print Area (). Provide three classes named Rectangle, Triangle and Circle such that each
one of the classes extends the class Shape. Each one of the classes contains only the method print Area
() that prints the area of the given shape.
6. Discuss abstract classes and methods in Java. Provide an example showing how abstract classes are
used and how they differ from concrete classes.
7. Explain the role of the super keyword in inheritance and method overriding. Provide examples
demonstrating its use.
8. Discuss the final keyword with respect to classes, methods, and variables. Provide examples showing how
final affects inheritance and method overriding.
9. Illustrate with examples how dynamic method dispatch works in Java. Explain how it enables
runtime method resolution.
10. Explain the use of packages in Java. Describe how packages provide access control and organize code.
Include examples of package creation and usage.
11. Discuss interfaces in Java. Explain how they are defined, implemented, and used. Provide examples
of implementing multiple interfaces.
12. Describe the differences between static and non-static inner classes with examples. Discuss their
use cases and implications on memory and access.
UNIT –III
EXCEPTION HANDLING AND
MULTITHREADING
PART - A (2 marks)
1. Interpret what is an Exception. What is its use? .
2. Predict what function does terminate and unexpected handlers call. .
3. What is re-throwing an expression? .
4. Define uncaught exception. .
5. Summarize the task performed by exception handling. .
6. Differentiate exception and error. .
7. Classify the exception types with example. .
8. Draw the exception hierarchy. .
9. What are the two methods available in stack trace elements? .
10. Express the advantages of using exception handling. .
11. What are three types of I/O streams? .
12. Show what is the purpose of the finally clause of a try-
catch- finally statement? .
13. Explain how to create custom exception. .
14. List the any five byte stream class. .
15. Illustrate any four character stream class. .
16. Point out the syntax of buffered reader to connect to the keyboard. .
17. What are streams? What are their advantages? .
18. Write a Java program to demonstrate the use of read line method. .
19.Illustrate a Java application using a print writer class to handle console output. .
20. Define: Thread.
21. What does the wait method do in inter-thread communication?
22. What is the role of the notify method in thread communication?
23. How do you resume a suspended thread?
24. Explain the concept of thread-safe collections.
25.What is a custom exception and how is it different from built-in exceptions?
PART – C 15 marks)
1. Express multithreading for an sample sequence of strings with a delay of 1000 millisecond for displaying
it using Java threads.
2. Deduce a Java program to perform the following tasks using three different threads. Each thread will be
responsible for its own task only. Among these three threads one will find the average number of the
input numbers, one will be responsible for finding the Maximum number from the input array of
numbers, and one will be responsible for finding the Minimum number from the input array of numbers.
3. Express a simple generic class example with two type parameters. so that we can define two types
of parameters called U & V, separated by ",".
4. Assess an example program in Java on how to implement bounded types (extend super class) with generics.
5. Explain how to manage and manipulate text data in Java using String, String Builder, and String Buffer. Discuss
their performance characteristics with examples.
6. Discuss the concept of bounded type parameters in generics. Provide examples demonstrating their use
and explain their importance in type safety.
7. Provide a detailed explanation of how Java handles file I/O, including examples of reading and writing files,
and handling I/O exceptions effectively.
8. Explain type erasure in Java generics and how it affects generic type operations at runtime. Discuss with
examples and its implications for generic programming.
9. Discuss the usage and implementation of generic classes and methods in Java collections. Provide examples of
how generics are used in standard Java collections like List, Map, and Set.
10. Illustrate how to handle and format string data in Java, using String, String Builder, and String Buffer.
Provide examples of common operations and their performance impacts.
UNIT – V
JAVAFX EVENT HANDLING, CONTROLS AND COMPONENTS
PART – A (2 marks)
1. List out some system colors available in Java and their purpose. .
2. Give the role of layout manager. Which layout is default in Java? Define Border Layout. .
3. Give the steps needed to show a Frame. .
4. Analyse the function of .
i. Set Layout
ii. Flow Layout
5. List the features of Swing. .
6. Name any four event of a button component. .
7. List the various mouse events supported by Java. .
8. Recommend what method can be used for changing case of characters. .
9. Illustrate the swing components. .
10. Differentiate between Swing and AWT.
11. Express what is an event and what are the models available for event handling. .
12. List the difference between scrollbar and scroll pane. .
13. Differentiate between a Choice and a List. .
14. Quote how can you create your own GUI components? .
15. Analyse what is the purpose of the enable Events () method? .
16. Write a program to print the names of all fonts on your system. .
17. Show the methods of frame class. .
18. Show the structure of AWT Event Hierarchy. .
19. Give what is J Radio Button and its constructor. .
20. Show what method can be used for changing font of characters? .
PART -B(13 marks)
1 .i. Describe in detail about working with 2D shapes in Java.
ii.Identify a Java program to illustrate Mouse Events.
2.i..Describe in detail about swing
Components. ii.Describe the types of layout
management.
3. Summarize in detail about graphics programming.
4.I. Explain how an application can respond to events in Java? Write the steps and the example.
ii. Explain the adapter class using example.
5. What is meant by event handling? Analyze and write a simple calculator using mouse events that
restrict only addition, subtraction, multiplication and division.
6. Tabulate the controller design pattern and components of swing briefly.
7.i. Illustrate what is layout management? State the various types of layout supported by Java? Which layout
is default one?
ii. Examine the basic of event handling.
8. Explain with an example program and discuss in detail about Mouse listener and Mouse Motion Listener.
14. Explain how to create and use Toggle Group with Radio Button controls. Provide examples of
managing exclusive selections.
15. Discuss the use of Flow Pane for arranging nodes in a flow layout. Provide examples showing how
to manage the wrapping of nodes.
16. Describe how to manage and handle user interactions with Combo Box and Choice Box. Provide
examples of handling user selection changes.
17. Illustrate how to use Stack Pane for overlaying nodes and managing their alignment. Provide examples.
18. Explain the creation and management of Menu Bar and its associated menus in a Java FX
application. Provide code examples.
19. Discuss the different event types in Java FX, such as mouse events, key events, and action events.
Provide examples of handling these events.
20. Describe how to use Scroll Pane to handle large content areas. Provide examples of integrating Scroll
Pane with other controls.
PART – C (15 marks)
4. Recommend a Java swing with one button and adding it on the J Frame object inside the main() method.
5. Explain how to create and use menus in Java FX applications. Discuss the structure of Menu, Menu
Bar, and Menu Item, and provide examples of creating a menu-driven application.
6. Discuss the use of Scroll Pane in Java FX for managing scrollable content. Provide examples of
integrating Scroll Pane with various controls and handling scroll events.
7. Illustrate how to manage multiple events on a single control. Provide examples of handling various
event types such as mouse clicks, key presses, and action events on the same control.
8. Describe how to use Grid Pane for creating a flexible grid layout. Include examples of adding controls
to specific grid positions and managing row and column constraints.
9. Explain how Border Pane can be used to create a typical application layout. Provide examples of
arranging controls in the top, bottom, left, right, and center regions.
10. Discuss the concept of Toggle Group in Java FX and its use with Radio Button controls.
Provide examples of managing mutually exclusive options and handling user selections.