Java Pat2 QB

You might also like

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

PAT- 2 Question Bank for Java Programming (22412)

2 Marks Question
a) Distinguish between Java applications and Java Applet (Any 2 points)
b) Give a syntax of following thread method Notify ( ) Sleep ( ) run()
c) Give a syntax of param tag to pass parameters to an applet.
d) Define stream class and list types of stream class.
e) List the methods of File Input Stream Class.
f) Define error. List types of error.
g) Write the syntax of try-catch-finally blocks.
h) Define stream class. List its types.
i) Describe the use of following methods:
a. Drawoval ( ) b. getFont ( ) c. drawRect ( ) d. getFamily ( )
j) Write a program to count number of words from a text file using stream classes.
k) Write a program to count number of lines from a text file.
l) Explain Byte Stream Class

4 Marks Questions
A. Describe Life cycle of thread with suitable diagram.
B. Write a program to read a file (Use character stream)
C. Give the usage of following methods
a. drawPolygon () b. drawLine () c. drawArc ()
D. Write any four methods of file class with their use.
E. Mention the steps to add applet to HTML file. Give sample code.
F. Write a program to copy contents of one file to another.
G. Define an exception called 'No Match Exception' that is thrown when the password
accepted is not equal to "MSBTE'. Write the program.
H. Define thread priority? Write default priority values and the methods to set and
change them.
I. Write a program for reading and writing character to and from the
given files using character stream classes.
J. Enlist types of Byte stream class and describe input stream class
and output stream class.
K. Define exception. State built-in exceptions.
L. Explain the following classes. i)Byte stream class ii)Character Stream Class
M. Explain life cycle of Applet.
N. Write a program to create two threads one thread will print even no. between 1 to 50 and
other will print odd number between 1 to 50.
O. Write a program to perform following task
a. Create a text file and store data in it.
b. Count number of lines and words in that file.
P. Write a program to print Ascending and Descending number u s i n g two
threads with delay of 1000ms after each number.
Q.Distinguish between Input stream class and output stream class.
R. Explain how to pass parameter to an applet ? Write an applet to accept username in the form of
parameter and print “Hello<username>”.

You might also like