Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

PART A

1. Name the different object oriented programming concepts in java


2. What is mean by class and object ?
3. Define access specifiers .
4. Syntax for creating interface ?
5. What is class hierarchy? Give example.
6. What is method overloading and how it can be done in java ?
7. What are the types of inheritance supported in java.
8. What is meant by object cloning ?
9. Define exception. Name the different types of exceptions.
10. What is stack trace with reference to Exception handling in java.
11. Difference between Byte stream and Character stream ?
12. List out any four Input Stream classes ?
13. What is multithreading in java. List down the different states of a Thread.
14. Ways of creating a thread?
15. What is generic programming?
16. What is meant by bounded type parameters and when they are used ?
17. What are window adapter classes
18. Enumerate the features of AWT in java
19. Write a steps for creating a JButton ?
20. List out the different types of layout?

PART B

UNIT 1
1. Define a class named COMPLEX for representing complex numbers that contains necessary data me
mbers and member functions. A complex number has the general form a + ib, where a is the real part and
b is the imaginary part (i stands for imaginary). Include methods for all the four basic arithmetic operators

2. Create a package named ‘com’. Define subpackages;

1. ‘transact’: with class ‘Transaction’ with static methods credit() and debit()
2. ‘loan’: with class ‘LoanAccount’ with method doTransaction() which calls Transaction class
methods
Create one ‘LoanAccount’ object in main to perform operations on it by accepting command line
arguments
3. i) Write a java program to find whether the number is odd or even numbers in an array.

ii) Write a java program to check whether the given string is a palindrome.
UNIT 2
1. Define an interface “QueueOperations” which declares methods for a static queue. Define a class
“MyQueue” which contains an array and front and rear as data members and implements the above
interface. Initialize the queue using a constructor. Write the code to perform operations on a queue object.

2. Write a Java program to perform the following task.

 Take an integer array of size 20, initialize values randomly between 10 and 90, simultaneously
sum all values and calculate average. Now separate values below average and above average in
ArrayLists. Finally print both lists in 2 separate rows.
3. Write a Java program for run time polymorphism ?
UNIT 3
1. Write a java program for exception handling:

a. To create a user defined exception whenever user input the word “hello”.
b. To add two integers and raise exception when any other character except number (0 – 9) is
given as input.

2. Create a class Doctor with attributes id, name, age and department. Initialize values through
parameterized constructor. If age of Doctor is not in between 25 and 65 then generate user-defined
exception “AgeNotWithinRangeException”. If name contains numbers or special symbols raise exception
“NameNotValidException”. Define the two exception classes

3. Write a Java program for handling the following exceptions

(i) Arithmetic Exception (ii) ArrayIndexOutOfBounds Exception

(iii) NumberFormat Exception (iv) StringIndexOutOfBound Exception


UNIT 4
1. Write a Java program ‘WordCount’ that counts the words in one or more files. Start a new
thread for each file. For example, if you call
“java WordCount report.txt address.txt Homework.java “
then the program might print
address.txt: 1052
Homework.java: 445
report.txt: 2099
2. Write java programs that includes generic method to satisfy the following property.
1. To counts the number of odd integers in an integer list
2. To exchange the positions of two different elements in an array.
3. To find the maximal element in the range [begin, end] of a list.
3. Write a Java program that reads a file name from the user, displays information about whether
the file exists, whether the file is readable, or writable, the type of file and the length of the file
in bytes

UNIT 5

1, Create a new Java GUI application to convert miles to kilometers when pressing the
“Convert!” button. Note that you need to implement the ActionListener interface and override
the actionPerformed() method. Note that 1 mile is equal to 1.609 kilometers.

2. Create a new Java GUI application that moves a snowman on a panel. The position of the
snowman can be changed using the control buttons. With the four buttons, a user can move the
snowman to the left, right, up or down position.

3. Write a Java program to toggle the background color on every click of button.

You might also like