2081 Mid-Term examination question paper set for Object Oriented Programming in Java.

Tribhuvan University
Faculty of Humanities & Social Sciences
OFFICE OF THE DEAN
2025
Bachelor in Computer Applications

Paper detail Value
Course Object Oriented Programming in Java
Code No. CACS204
Semester IIIrd
Full marks 60
Pass marks 24
Time 3 hours

Candidates are required to answer the questions in their own words as far as possible.

2. What is constructor? Explain the role of constructor in Java class by considering a suitable example and also list the type of constructor. (1+1+3)(1+1+3)(1+1+3)

3. Differentiate between abstract class and interface with suitable example. (5)(5)(5)

4. Define Encapsulation and Inheritance. Explain the use of "extends" keyword in java. (1+4)(1+4)(1+4)

5. What is multithreading? Explain with program how you will create thread by implementing runnable interface and extending Thread class. (1+2+2)(1+2+2)(1+2+2)

6. What are exception handling keywords in Java? Write Java program to illustrate the concept of NullPointerException and ArrayIndexOutOfBoundsException. (1+2+2)(1+2+2)(1+2+2)

7. a) Differentiate between Method overloading and Method overriding. (5)(5)(5) b) What is difference between String and StringBuffer class? (5)(5)(5)

8. Create a class Storage with private terabytes (int) and gigabytes (int). Implement:

9. addStorage(Storage s) to sum storage.

10. subtractStorage(Storage s) to subtract s from the current storage.

11. displayStorage() to show in "X TB Y GB" format.

12. Design a class TestStorage to test edge cases. (10)(10)(10)