Object Oriented Programming in Java 2023

Tribhuwan University
Faculty of Humanities and Social Sciences
OFFICE OF THE DEAN
2023
Bachelor of Computer Applications
Course Title: Object Oriented Programming in Java
Code No: CACS204
Semester: Third Semester
Full Marks: 60
Pass Marks: 24
Time: 3 hours
Candidates are required to answers the questions in their own words as far as possible.

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

Group B

Attempt any SIX questions.

2. What are java Buzzwords? Write a java program to find simple interest. Use command line argument to take input.

5 marks view

3. What are use of duper keyword? Write a java program to create base class Fruit which has name, taste and size as its attributes and method called eat() which describe name an its taste. Inherit the same in two other class Apple and Orange and override eat() method to represent each fruit 

5 marks view

4. What is difference between String and StringBuffer class? Write a java program to identify the input string id palindrome or not?

5 marks view

5. Why we need file handling in java? Write java program to read file into variable and then write a variable's content into another file.

5 marks view

6. What is the purpose of valueOf() method in Wrapper classes? Write a java program to generate random integer , double and bytes.

5 marks view

7. What is internal frames? Write a java program that display two internal frame within some parent frame.

5 marks view

8. What is JDBC? Write java program to connect database College and display all student information(Roll, Name, Address and Program) from Student table.

5 marks view

Group C

Attempt any TWO questions.

9. What is Constructor overloading? Write a class Distance containing private variables feet of type int and inches of type int, suitable constructors, and three methods addDistance. subtractDistance and displayDistance for adding, subtracting and display distance objects. Write a separate class MyDistance containing main method to create, add,subtract and display distance objects. 

10 marks view

10. a) What is difference between checked and unchecked exception? Write a java program that will read college name from keyboard and display it on screen. The program should throw an exception when length of college name is more than 50.


b) What are methods used for inter-thread communication? Write a java program to create two threads so that one thread prints even number and other thread prints odd number between 100 and 200.

10 marks view

11. What is MVC design pattern? Write a GUI program using swing components to calculate sum and difference of two numbers. Use two text fields for input and pre-built dialog box for output. Your program should display sum if Add button and difference if subtract button is clicked.