Tribhuvan University
Bachelor of Information Technology Management
Semester 2 · Model question
Course Title: Object Oriented Programming With Java (ITM152)
Full Marks: 60Pass Marks: 30Time: 3 Hrs
Candidates are required to give their answers in their own words as for as practicable.
Group A
- 1.
What is the purpose of this keyword in Java?
- 2.
Which interfaces and classes are used to serialize and deserialize an object?
- 3.
List the difference between StringBuffer, and StringBuilder in Java.
- 4.
List the Key Aspects of Java's Impact on the Internet.
- 5.
What is the difference between throw and throws in Java exception handling?
Group B
Problem Solving / Short Answer Questions (Answer any SIX Questions)(6 × 5 = 30)
- 6.5
Describe the architecture of JVM, JRE, and JDK.
- 7.5
Write a Java program to demonstrate type conversion and casting between different data types.
- 8.5
Explain method overloading and variable length arguments (varargs) in Java.
- 9.5
Explain the concept of Sealed classes with example
- 10.5
Write a Java program to demonstrate the use of nested try blocks.
- 11.5
What are wrapper classes in Java? Describe the concepts of autoboxing and unboxing.
- 12.5
Write a Java program using StringBuffer to demonstrate string manipulation by performing operations such as appending, inserting, and deleting characters.
Group C
- 13.
Write a Java program to demonstrate file handling by performing read and write operations on a file.
- 14.
Define polymorphism in Java and explain its types with suitable examples.
- 15.
Write a Java program that simulates a ticket booking system in which multiple threads attempt to book tickets from a limited number of available seats. The program should include a class named TicketCounter with a method for booking tickets, and the total number of tickets should be initialized as 10 tickets. Create multiple threads using the Runnable interface that try to book tickets at the same time. Apply proper synchronization to ensure that tickets are not overbooked. The program should display which thread successfully books tickets and the number of tickets remaining after each transaction. Use the Thread class to create and manage the threads.
— The End —