Nội dung text OOP in JAVA Boards Qns.pdf
Prepared by Uni Bytes / www.unibytes.xyz Don't use our content without permission.
Prepared by Uni Bytes / www.unibytes.xyz Don't use our content without permission.
Prepared by Uni Bytes / www.unibytes.xyz Don't use our content without permission. Tribhuvan University Faculty of Humanities and Social Science Semester: III Subject: OOP in JAVA 2021 Batch Group B Attempt any SIX questions 2. What is java Buzzwords? Write a java program to find simple interest. Use command line argument to take input. 3. What are uses of super 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 and its taste. Inherit the same in two other class Apple and Orange and override the eat() method to represent each fruit taste. 4. What is difference between String and StringBuffer class? Write a java program to identify the input string is palindrome or not? 5. Why we need file handling in java? Write java program to read file into a variable and then write a variable's content into another file. 6. What is the purpose of valueof() method in Wrapper classes? Write a java program to generate random integer, double and bytes. 7. What is internal frames? Write a java program that display two internal frame within some parent frame. 8. What is JDBC? Write java program to connect database College and display all student information (Roll, Name, Address and Program) from Student table. Group C Attempt any TWO questions 9. What is Constructor overloading? Write a class Distance containing private variable feet of type int and inches of type int, suitable constructors and three methods addDistance, subtractDistance and display Distance for adding, subtracting and displaying objects. Write a separate class MyDistance containing main method to create, add, subtract and display distance objects. 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. 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. Don’t Forget to Follow Uni Bytes
Prepared by Uni Bytes / www.unibytes.xyz Don't use our content without permission. Tribhuvan University Faculty of Humanities and Social Science Semester: III Subject: OOP in JAVA 2020 Batch Group B Attempt any SIX questions 2. What is jagged array? Write a java program to initialize and display jagged array element with sum of each row. 3. What are uses of this keyword? Write a java program to implement method overloading concept. 4. Why inheritance is needed in java? How will you implement multiple inheritance using interface? Explain with program. 5. What is multithreading? Explain with program how you will create thread by implementing runnable interface and extending Thread class. 6. What are exception handling keyword in java? Write java program to illustrate the concept of NullPointerException and NumberFormatException. 7. What is serialization? Write a java program to write three student information (Roll, Name, Address, College) into file student.txt and display the student information whose address is Jhapa. 8. What is Wrapper class? Explain with program, how will you use iterator and comparator in collection objects? Group C Attempt any TWO questions 9. What is difference between class and interface in java? Create a java class Time with three attribute hours, minutes and seconds. Use appropriate constructors to initialize instance variable. Use methods to display time in HH:MM: SS format, add and subtract two time object. Implement the class to add, subtract and display time object. 10. How AWT is differing from Swing? Write a GUI program using components to find factorial and cube of number. Use Text Field for giving input and Label for output. The program should display factorial if user press mouse on result button and cube if user release mouse from result button. 11. What is JDBC? Write a java program to connect database Company and insert 5 employee record (EID, Ename, Salary, Department) in Employee table and display the employee record who's Department is "Sales". Don’t Forget to Follow Uni Bytes