Published by: Dikshya
Published date: 03 Sep 2023
POKHARA UNIVERSITY
Level: Bachelor Semester: Spring Year: 2023
Programme: BBA/BI/TT/BCIS/BHCM/BHM Full Marks: 100
Course: Object Oriented Programming Pass Marks: 45
Time: 3 hrs.
Candidates are required to answer in their own words as far as practicable The figures in the margin indicate full marks.
Section "A"
Very Short Answer Questions
Attempt all the questions. [10×2]
1. Why is java called object oriented programming language?
2. What are primitive data types in Java?
3. What are the uses of static and new keywords in java?
4. Why is it not possible to use both the abstract and final modifiers simultaneously in Java?
5. Define multilevel inheritance in Java.
6. What are the two ways to implement threads in Java? Include the syntax for each approach.
7. Does a single catch statement handle multiple exceptions, explain?
8. What is Stream? Why do you need the BufferedInputStream class?
9. Differentiate between Byte Stream and Character Stream.
10. Provide definitions and examples of heavyweight and lightweight containers in Java.
Answers: https://onlinenotesnepal.com/very-short-answers-spring-2023-oop
Section "B”
Descriptive Answer Questions
Attempt any six questions.[6×10]
11. Explain what is type casting in Java? Write a Java program to read N numbers as an array from keyboard and display sum of prime numbers in the console. [5]
12. a) Explain the principles of object oriented programming.
b) Define constructor. List and explain different types of constructor.
13. What is the diamond problem in multiple inheritance, and how does Java handle it using interfaces? Provide an explanation with suitable examples.
14. What is an Exception? Write a Java program to design your own exception class "Negative NumberException" to handle the negative number.
15. Can you explicitly guarantee the execution order of threads based on their priorities in Java? Why or why not? Write a program to create any three threads 11,12,13 and set priority of tl as Highest, 13 as lowest and 12 as Normal.
16. Write a java program to write N data in a file called "inventory.txt" and display the details of products whose quantity is less than 10. The file contains information about each product including their ID, Name, Quantity, and Price.
17. When would you choose LinkedList over ArrayList? Write a program to demonstrate ArrayList and LinkedList operations such as adding elements, removing elements, and iterating over the collection.
Section "C"
Case Analysis
18. Read the case situation given below and answer the questions that follow [20]
Suppose you are a software developer at XYZ Company. Your job is to develop a desktop-based application to manage the information of employees. Use the package "XYZ.Record' to keep all the files. Develop the Login and Registration form as shown in the figure below. Make Two classes:Login Frame Class, and Registration Frame Class. The reset button resets all the fields. The close button displays Confirm Dialog of JoptionPane and if you press "Yes" close the respective frame. When an Employee successfully Login, the Registration form will open. When the Employee presses the Add button, you should display all the data via the JoptionPane dialog box. If you press Reset button, then reset all data of frame.