CS3391 - Question BANK
CS3391 - Question BANK
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 “HelloWorld”.
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 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.
4. Define and explain the control flow statements in Java withsuitable examples. (13)
5. What is meant by constructor? Discuss the types of constructor with example. (13)
6. i. Analyse and Develop a simple Java program to sort the (7)
given numbers in increasing order
ii.Write a Java program to reverse the given number. (6)
7. i. Classify the characteristics of Java (6)
ii.Illustrate the working principles of Java Virtual Machine. (4)
iii.Show with an example the structure of Java Program (3) .
8. i.Summarize about access specifier in Java. (7)
ii.Describe the term static fields and methods and explain its types with example.
9. i) Define Arrays. What is array sorting and explain with an example (7)
ii) Tabulate and explain documentation comments in Java. (6)
10. Illustrate what is meant by package? How its types are created and implemented in Java. (13)
11. Write the techniques to design classes in Java using JavaDoc. (13)
12. Explain with example passing objects as parameters to methods and returning objects from
methods in Java. (13) - .
13. Explain packages in Java with example. (13)
14. Interpret with an example what is method overloading and method overriding. (13)
15. What are the different operators available in Java? Explain with examples.
16. Write a Java class that demonstrates the use of constructors and methods.
17. Explain the concept of ‘abstract classes’ and ‘interfaces’ in Java with examples.
18. Discuss how to use control statements to handle multiple conditions in Java. Provide examples
using ‘if-else’ and ‘switch’.
19. Explain the concept of ‘Inheritance’ and its impact on the design of a Java application.
20. Describe how Java supports multiple inheritance through interfaces and discuss its advantages.
21. Write a program using primitive data types and using char data type in program.
ii.With an example, illustrate how the objects from sub class are inherited by the super class.
3. Examine how to control top level and member level access for the members of the class.
4. Illustrate with an example how passing objects as parameters to methods and returning objects
from methods in Java.
5. Describe in brief about object class and its methods in Javawith suitable example.
6. .i. Discuss the concept of abstract class.
ii.Give a program for abstract class with example.
7. .i. Explain briefly on final keyword.
ii.Explain the concept of abstract class with an example.
8. .i.Describe what is meant by interface.
ii.How is interface declared and implemented in Java. Giveexample.
9. i. Differentiate classes with interface with suitable examples.
ii. Express a Java program for extending interfaces.
26.Analyse with an example, how string objects are created. How it can be modified?
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 superclass 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 classescontains 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
lOMoARcPSD|17642363
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.
}
}
}
ii.The program calculates sum of two numbers inputted as command-line arguments.When will it give
an exception? Class execp
{
Public static void main( String []args)
{
try{
int n= Integer.parseInt(arg[0]); int n1=Integer.parseInt(arg[1]); int n2=n+n1; System.out.println(“Sum
is:” +n2);
}
Catch(NumberFormatException ex)
{
System.out.println(ex);
}
}
}
3. Illustrate the Java program to concatenate the two files and produce the output in the third file.
4. Deduce a Java program that reads a file name from the user,displays information about whether the
file exists, whether thefile is readable, or writable, the type of file and the length of the file in bytes.
5. Illustrate how to handle exceptions in a multithreaded application. Discuss common pitfalls and best
practices for managing exceptions across multiple threads.
6. Explain the concept of thread priorities and how they affect thread scheduling. Provide examples of
setting and getting thread priorities. Discuss the impact on thread execution.
7. Discuss the use of user-defined exceptions in Java. How do they differ from built-in exceptions?
Provide examples of creating and using custom exceptions.
8. Describe the process of autoboxing and unboxing. Explain how Java automatically converts between
primitive types and their corresponding wrapper classes with examples.
9. Illustrate how to stop, suspend, and resume threads in Java. Discuss the recommended practices and
potential issues associated with these operations.
10. Explain the concept of wrapper classes and their role in Java. Provide examples of the commonly
used wrapper classes, their methods, and how they facilitate working with primitive types.
UNIT IV
I/O, GENERICS, STRING HANDLING
PART – A (2 marks)
1. Give the properties of thread. .
2. Show the different states in thread. .
3. Why synchronization is required in thread? .
4. Select any four thread constructor. .
5. What is the need for thread? .
6. List the importance of thread constructor. .
7. Give the idea to achieve thread synchronization in Java. .
8. Define multithreading. .
9. Give the life cycle of thread. .
10. Show how virtual machine in used in generic programming. .
11. Write down the need for generic programming. .
12. Define generic class. .
13. Illustrate a simple generic class with an example. .
14. Summarize the advantages of generic programming.
15. What are the parts of synchronizers that are often needed? .
16. Give the methods used for inter thread communication. .
17. Classify what are three ways in which a thread can enter the waiting state? .
18. Illustrate what is daemon thread and which method is usedto create the daemon thread. .
19. Differentiate between yielding and sleeping.
20. Illustrate what is thread group.
lOMoARcPSD|17642363
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
lOMoARcPSD|17642363
numbers.
3. Express a simple generic class example with two typeparameters. 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 superclass) with
generics.
5. Explain how to manage and manipulate text data in Java using String, StringBuilder, and StringBuffer. 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, StringBuilder, and StringBuffer. 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 theirpurpose. .
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 ofcharacters. .
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 yoursystem. .
17. Show the methods of frame class. .
18. Show the structure of AWT Event Hierarchy. .
19. Give what is JRadioButton 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 ofswing 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.
lOMoARcPSD|17642363
8. Explain with an example program and discuss in detail about Mouse listener and Mouse Motion
Listener.
14. Explain how to create and use ToggleGroup with RadioButton controls. Provide examples of
managing exclusive selections.
15. Discuss the use of FlowPane 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 ComboBox and ChoiceBox. Provide
examples of handling user selection changes.
17. Illustrate how to use StackPane for overlaying nodes and managing their alignment. Provide
examples.
18. Explain the creation and management of MenuBar and its associated menus in a JavaFX application.
Provide code examples.
19. Discuss the different event types in JavaFX, such as mouse events, key events, and action events.
Provide examples of handling these events.
20. Describe how to use ScrollPane to handle large content areas provide examples of integrating
ScrollPane with other controls.
3. Explain a Java program for event handling using action listener interface.
4. Recommend a Java swing with one button and adding it on the JFrame object inside the main()
method.
5. Explain how to create and use menus in JavaFX applications. Discuss the structure of Menu,
MenuBar, and MenuItem, and provide examples of creating a menu-driven application.
6. Discuss the use of ScrollPane in JavaFX for managing scrollable content. Provide examples of
integrating ScrollPane 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 GridPane for creating a flexible grid layout. Include examples of adding controls
to specific grid positions and managing row and column constraints.
9. Explain how BorderPane 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 ToggleGroup in JavaFX and its use with RadioButton controls. Provide
examples of managing mutually exclusive options and handling user selections.