You are on page 1of 5

Java Programming - Question Bank

PART-A (unit-1 to 3)

1) What is Object Oriented Programming? How it is different from Procedural concepts?


2) What is an Object? How to allocate memory for objects?
3) Can a method be overloaded based on different return type but same argument type?
4) List out the characteristics of the static method.
5) "Java does not support operator overloading" - Support this statement with appropriate reasoning.
6) What is a constructor? When does the compiler supply default constructor for a class?
7) Give an example to illustrate the use of parseInt() method?
8) What is the difference between the >> and >>> operators?
9) Illustrate type casting in java with an example.
10) What is the difference between & operator and && operator?
11) Explain difference between class and object.
12) Differentiate between runtime and compile time polymorphism.
13) Why java replaces C++ in most of the application development?
15) Java is used in internet applications. Give reasons.
16) Explain the importance of JVM in JRE.
17) What is difference between break and continue statement?
18) What are the differences between constructor and method.
19) Explain “this” keyword.
20)Explain usage of “final” keyword.
21) Explain boxing and unboxing in java.
22) “Interfaces are able to extend more than one interface, but a class cannot extend more than one
class”- why?
23) What is the difference between an interface and an abstract class?
24) Differentiate between array and vector with example?
25) “Abstract classes can be defined without any abstract methods” – support the statement with
proper reasoning.

PART-B

Unit-1
1) a) Explain briefly the following object oriented concepts.
i) Abstraction ii) Polymorphism i) Encapsulation
b) Write a Java program to find the value of n!, where n is a given integer.
2) a) Discuss on the advantages and disadvantages of Object Oriented Programming.
b) Explain how java is platform independent?
3) a) Explain features of Java.
b) Discuss the JVM architecture.

Unit-2
1) a) Explain all types of tokens in java.
b) How bitwise operators works? Explain with example.
2) a) What is expression? Explain rules for precedence and associativity rules.
b) How type conversion is implemented in java?
3) a) Explain types of constructors? Write a program for constructor overloading.
b) Explain static methods and static variables with example.
4) a) Explain how arrays are used in java?
b) Write a java program to add two matrices.

Unit-3
1) a) Explain types of inheritance in java.
b) Write a java program to explain method overriding for finding area with Rectangle as super class
and Box is subclass.
2) a) Explain super keyword with suitable example.
b) Write on abstract classes. How interfaces are different form abstract class?
3) Explain working with packages
i) creating a class with package. ii) compiling and executing the class with in a package.
iii) setting classpath. iv) importing package in other class.
4) Explain java.lang package.

PART-A
UNIT-4
a) What is the purpose of isAlive() function in Java.
b) Differentiate between sleep() and wait() in threads.
c) Discuss various methods used to create threads?
d) What is the importance of synchronization in java?
e) What is a daemon thread?
.
UNIT-5
a) "Java class can be used both as an applet as well as an application" - Support this statement with
an example.
b) What are the ways in which we can pass parameters to the applet?
c) What are the advantages of event driven programming?
d) What is an event? What methods are available to handle events in java?
e) What is source and listener in java event handling?

UNIT-6
a) What are the different types of controls available in AWT?
b) What is the role of layout manager in AWT or Swing?
c) List out the differences between AWT and Swings.
d) List the features of swings

PART-B
UNIT-4
1. a) Write a Java program that prints numbers from 1 to 10 line by line after every 5 seconds
b) What is thread synchronization? Discuss with an example.
2. a) Write a Java program for creating four threads to perform the following operations
i) Getting N numbers as input ii) Printing the even numbers
iii) Printing the odd numbers iv) Computing the average
b) Explain how communication between threads takes place with a programming example.
3. a) Explain the following with necessary code snippets
i) Creating thread ii) Stopping and Blocking a Thread
b) "Threads can be given priorities" - Support this statement with suitable example.
4. a) Write a Java program to demonstrate multithreading operation.
b) Explain various thread states and properties in detail.

UNIT-5
1. a) Differentiate repaint(), update() with paint() methods of AWT component.
b) Differentiate between init() and start() methods with examples.
2. a) Write Applets programs to accomplish the following tasks:
i) Drawing polygons ii) Drawing a line graph.
b) Can applet class have a constructor? Justify your answer with proper explanation and
example.
3. a) Describe the different stages in the life cycle of an Applet.
b) Explain in brief the event-handling mechanism in java with an example.
4. a) Write an applet program that has different shapes in it.
b) Explain action event with suitable example.

UNIT-6

1. a) Write a Java program to create a combo box which includes list of subjects. Copy the
subjects in text field on click using applet.
b) Explain with a program, how Radiobuttons are used in AWT programming?
2. a) Discuss in detail Menu bars and menus in Java with examples.
b) Write a short note on the following
i) JFrame ii) JTabbedPane
3. a) Explain about any two Layout Managers with example programs.
b) Explain the features of Swings in java.
4. a) Explain any two AWT controls in java with suitable examples.
b) Design a screen in Java which accepts text in text box. If the left mouse is clicked, convert the
text to uppercase and if the right button is clicked, convert it to lower case.
5. a) Write a Java program to illustrate the use of Flow Layout Manager.
b) Write a short note on the following
i) JList ii) JScrollPane
Questions given in April 2016 :
Part A ( 1- 3 units)
a) What is the significance of java bite code?
b) List the various ways of static keyword usage.
c) differentiate class, abstract class, and interface.
d) Compare inheritance and polymorphism.
e) Write about garbage collection.
f) Give basic keywords used in exception handling.
g) list the applications of object oriented programming.
h) Illustrate the usage of ‘this’ keyword.
i) how to create and use a package in java program.
j) differentiate between abstraction and information hiding.
k) what are the naming conventions for java identifiers.
l) what is an assertion? What is its use in programming?

Part B ( 1- 3 units)

1 a) What are the drawbacks of procedural languages? Explain the need of object oriented programming
with suitable example.
b) Discuss lexical issues of java.
2 a) Illustrate constructor overloading.
b) Explain precedence rules and associativity concept.
3 a) With suitable code segments illustrate various uses of ‘final’ keyword.
b) How to handle multiple catch blocks for a nested try block? Explain with suitable example.
4 a) Compare procedural language with object oriented languages.
b) Explain important features of java.
5 a) List various types of statements and quote suitable examples for each type.
b) With a program illustrate the use of command line arguments.
6 a) Explain multilevel inheritance with the help of abstract class in your program
b) How to define a user exception in a program? Illustrate with example.
7 a) Discuss the principles of object oriented languages in detail.
b) What is the role and responsibility of JVM in program execution?
8 a) What are the primitive data types in java? Write about type conversions.
b) What is constructor? What is its requirement in programming? Explain with program.
9 a) Write a program to implement multiple inheritances.
b) What is exception ? How are exceptions handled in java programming? Explain.
10 a) List and explain java buzz words. Which factors are making java famous language.
b) Give program structure of java.
11 a) How to create objects? Does java support object destruction? Justify your answer.
b) Write java program to find sum of the squares of the diagonal elements of a square matrix.
12 What are the benefits of inheritance? Explain various forms of inheritance with suitable code
segments.

Part A ( 4- 6 units)
a) how does java support inter thread communication?
b) What is difference between applet and application programs
c) Give overview of JButton class
d) List thread states and give state transition diagram
e) What is adapter class? Give any two examples for it.
f) Differentiate between Swing components and AWT components.
g) Write about thread suspension and resume.
h) Compare nested classes with inner classes. Give examples for each.
i) Differentiate between GridLayout and GridBagLayout Managers.
j) Define thread. How it is different from a process?
k) Give the sources of ActionEvent and ItemEvent.
l) List the features of Menu Component of AWT

Part B ( 4- 6 units)
1 a) Explain thread life cycle and thread creation in java.
b) Write a program to read user name from console and display some message for that user using
streams.
2 a) Discuss the applet structure and compare it with application structure.
b) Write a program to handle keyboard events
3 a) Construct a frame with necessary components for bus reservation system of an agent.
b) Write a note on dialog box usage in user interfaces.
4 a) Describe the need of thread synchronization. How is it achieved in java programming? Explain with a
suitable example.
b) Differentiate between FileReader and BufferedReader.
5 a) what is an Applet? Explain its life cycle.
b) Write a program to handle mouse events and mouse motion events
6 a) Write a program to create a frame for a simple arithmetic calculator using swing components and
layout managers.
b) Compare the features of Applet with JApplet.
7 a) Write a program to implement multithread programming.
b) Explain thread synchronization.
8 a) Explain delegation event model in detail.
b) Write an applet to display a smiley with greeting message to the user.
9 a) What is the significance of Layout Managers? Discuss briefly various layout managers.
b) Write a notes on split pane.
10 a) Describes java’s thread model.
b) What is a stream? What is the difference between byte streams and character streams? How they are
used to capture input from the user?
11 a) What is the role of event listeners in event handling? List the java event listeners
b) Write an applet to display the mouse cursors position in that applet widnow.
12 a) Discuss various AWT Containers with examples.
b) Construct an application to explain the use of JTabbedPane.

You might also like