0% found this document useful (0 votes)
14 views

Java Pat2 QB

The document contains questions related to Java programming including questions on threads, applets, exceptions, stream classes, file handling and more. It has 2 mark questions from a to l and 4 mark questions from A to R covering concepts like thread life cycle, reading and writing files using streams, adding applets to HTML, exception handling and more.

Uploaded by

yuktinahar13
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Java Pat2 QB

The document contains questions related to Java programming including questions on threads, applets, exceptions, stream classes, file handling and more. It has 2 mark questions from a to l and 4 mark questions from A to R covering concepts like thread life cycle, reading and writing files using streams, adding applets to HTML, exception handling and more.

Uploaded by

yuktinahar13
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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