*X60755*
Reg. No. :
Question Paper Code : X 60755
B.E./B.Tech. Degree Examinations, November/December 2020
Fifth Semester
Information Technology
IT 2301/IT 51/10144 IT 501 – Java programming
(Regulations 2008/2010)
Time : Three Hours Maximum : 100 Marks
Answer all questions
Part – A (10×2=20 Marks)
1. Demonstrate Java overloaded constructor.
2. State the difference between static and non static class members.
3. Differentiate a vector and an array in Java.
4. Is there any error in the given Java statement ? Analyze :
char[ ] string = “abcdef ”;
5. How to define an interface ?
6. What is a stream and which class allows you to read objects directly from a stream ?
7. Write syntax to handle two mouse events.
8. Name the class which should be used to create User defined Exception.
9. What are the advantages of Generie Programming ?
10. When a thread is created and started, what is its initial state ?
Part – B (5×16=80 Marks)
11. a) i) Write a Java program that mimics a calculator. Input two real numbers and
state the type of arithmetic operation (addition, subtraction, multiplication
or division) between them through another keyboard input. (8)
ii) Define polymorphism. Show how compile-time polymorphism is achieved
in a Java program with a suitable example. (8)
(OR)
b) i) State the use of constructor and finalize( ) method in Java using a
programming example. Show how garbage collection is achieved here. (8)
ii) Can Java directly support multiple inheritance ? Illustrate your answer
with an example Java program. (8)
X 60755 *X60755*
12. a) Write a java program to maintain the books details like BookId, accession
number; book name, author, publication in books package and keep the journal
details such as journal Id; journal name; in journal package in main class
use these two packages details for staff and student classes and display the
books and journals information as requested by the user. (16)
(OR)
b) How to declare and initialize a string in java and also explain the different
string handling functions with suitable examples. (16)
13. a) i) Write program that uses method draw line to draw a square. (8)
ii) Explain character stream class in detail. (8)
(OR)
b) i) Write Java code that randomly draws characters in different font sizes
and colors. (8)
ii) Explain how object cloning is performed in Java. Mention its usage. (8)
14. a) i) Explain any five swing components with an example. (8)
ii) Explain the characteristics, advantage and the methods in MVC design
patterns. (8)
(OR)
b) i) Define Exceptions, VowelException, BlankException, ExitException. Write
another class Test which reads a character from command line. If it is a
vowel, throw VowelException, if it is blank throw BlankException and for
a character ‘X’ throw an ExitException and terminate program. For any
other character, display “Valid character”. (10)
ii) Explain in detail about Event handlers with suitable example. (6)
15. a) Write a complex program to illustrate about thread priorities. Imagine that
the first thread has just begun to run, even before it has a chance to do
anything, Now the higher priority thread that wants to run as well. Now the
higher priority thread has to do its work before the first thread starts. (16)
(OR)
b) i) Explain life cycle of a thread with help of a diagram. How do the wait and
Notify All/notify methods enable co-operation between threads ? (8)
ii) Explain in detail about generic method with a suitable example. (8)
–––––––––––––