[BS - S 2112]
B.Sc. (CBCS) DEGREE EXAMINATION.
Third Semester.
Part II - Computer Science/Information Technology (IT)
Paper III - OBJECT ORIENTED PROGRAMMING USING JAVA
(Effective from 2015-2016 admitted batch)
Time: Three hours Maximum: 75 marks
PART A — (5 x 5 = 25 marks)
Answer any FIVE of the following Eight questions.
1. What are the benefits and applications of Object Oriented Programming?
2. What are constants? Mention the constants supported by Java.
3. Explain the for statement in Java with example.
4. When do we declare a method or a class final and abstract?
5. What is inheritance and how does it help to create new classes quickly?
6. When should a program throw an exception? Explain.
7. What is meant by Applet package?
8. List out byte stream classes.
PART B - (5 x 10 = 50 marks)
Answer the following (One from each Unit)
UNIT I
9. (a) Distinguish between different data types supported by Java.
(b) List the logical and relational operators available in Java. Explain each of them.
Or
10. (a) Write the structure of simple Java program. Demonstrate with an example.
(b) What is meant by byte code? Briefly explain how Java is platform independent.
UNIT II
11. (a) Explain the while statement in Java with an example. List the differences between do. while and while statements.
(b) Write a program to find the roots of a quadratic equation.
Or
12. (a) What is constructor? Explain the difference between constructor and destructors.
(b) Explain different types of constructors with suitable examples.
UNIT III
13. (a) What is the difference between overloading and overriding?
(b) How do you design a class so that it supports cloning? Explain.
Or
14. (a) What is the use of wrapper classes? Explain.
(b) How do you design and implement an interface?
UNIT IV
15. How do we set priorities for threads? Describe the complete life cycle of a thread. Write a program to create four threads using runnable interface.
Or
16. What is an exception? How is an exception handled in Java? Discuss about the advantages of using exception handling mechanism in a program.
UNIT V
17. Explain in detail the process of defining, creating importing and accessing a package with suitable example.
Or
18. Explain about stream input/output. Write a Java program to read paragraph from a file and find out number of sentences, words and characters in that paragraph using stream Tokenizer.