Java Questions
Java Questions
21819
3 Hours / 70 Marks Seat No.
Marks
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following: 12
a) Explain the concept of platform independence and portability
with respect to Java language.
b) Explain the types of constructors in Java with suitable example.
c) Explain the two ways of creating threads in Java.
d) Distinguish between Input stream class and output stream
class.
Marks
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following: 12
a) Differentiate between String and String Buffer.
b) Define a class circle having data members Pi and radius.
Initialize and display values of data members also calculate
area of circle and display it.
c) Define exception. State built-in exceptions.
d) Write a syntax and example of
(i) drawRect( )
(ii) drawoval( )
Class: Gross_Salary
TA, DA, HRA
Total_Sal ( )
22412
21222
3 Hours / 70 Marks Seat No.
15 minutes extra for each hour
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following: 12
a) Explain any four features of Java.
b) Write a Java program to copy the content of one file into
another.
c) Write the difference between vectors and arrays. (any four
points)
d) Explain exception handling mechanism. w.r.t. try, catch, throw
and finally.
Fig No. 1.
Marks
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following : 12
a) Write a program to check whether the given number is prime
or not.
b) Define a class employee with data members ‘empid’, ‘name’
and ‘salary’. Accept data for three objects and display it.
c) Describe Life cycle of thread with suitable diagram.
d) Write a program to read a file (Use character stream)
Marks
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following: 12
a) Describe type casting in java with example.
b) Differentiate between string and string buffer class
(any four points)
c) Write a program to create a user defined exception in java.
d) Write a program for reading and writing character to and from
the given files using character stream classes.
Fig. No. 1
c) Write a program to print even and odd number using two
threads with delay of 1000ms after each number.
Fig. No. 2
c) Explain constructor with its type. Give an example of
parameterized constructor.
22412
23124
3 Hours / 70 Marks Seat No.
Marks
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following : 12
a) Write a program to display ASCII value of a number 9.
b) Write a program to sort the elements of an array in ascending
order.
c) Define Thread. Draw life cycle of Thread.
d) Write a program to read a file and then count number
of words.
Fig. No. 01
22412 [3]
Marks
d) Explain Life Cycle of the applet with neat diagram.
e) Create a new test file named ''data.txt'' using the File class.
Write a program to count number of words of "data.txt" using
stream classes.
Marks
P.T.O.
22412 [2]
Marks
2. Attempt any THREE of the following : 12
a) Write a program using sqrt( ) and pow( ) to calculate the square
root and power of given number.
b) Write a program to accept four numbers from user using
command line arguments and print the smallest number.
c) Explain two ways of creating threads in java with suitable
example.
d) Give the usage of following :
i) set Color ( )
ii) get Color ( )
iii) set Foreground ( )
iv) set Background