Skip to main content

Posts

Showing posts from April, 2017

Mock Test: CSE310

PROGRAMMING IN JAVA (CSE310) Time Allowed: 02:00 Hrs                                                                                                    Max. Marks: 50            PART B Q2 a) Write a program to create a class named find_Average which contains a static method named getAverage which accepts a two-dimensional array of size M X N and returns an array of size M containing the largest element in corresponding row of input array.                                                                                                               [10 Marks] Example: Input:   {{1, 6, 3, 8},                                                                             {6, 5, 7, 2},                                        {3, 5, 1, 5}                                   } Output: [8, 7, 5] OR b) (i) What is the difference between LocalDate and LocalDateTime class? What is the use of parse method in these classes? Write code snippet to create a LocalDate object wit

Mocke Test: Exception Handling

1. Differentiate between throw and throws keywords in java using an appropriate program.   2. What is the difference between checked and unchecked exception? What are the different ways of handling checked exceptions in Java? 3. What is the significance of using finally block in exception handling? How it is different from the catch block? Explain the importance of finally with the help of a suitable program. 4.  Write a Program in which prompt the user to enter a String. If the size of String is odd, then throw a User-defined exception InvalidStringException and display "String is Not Accepted". Re-throw the caught exception from catch block to print "Thanks for using this Program". 5. Write a program to define a class named Car with an attribute fuel, and constants mileage and max_fuel. Provide the following methods:        public int addFuel(int ltr) throws FuelTankFullException     public void travel(int km) throws NotSufficientFu