November / December 2023
JAVA PROGRAMMING
Anna University
1 question papers available. Select an examination session to view its question paper.
JAVA PROGRAMMING
Based on available extracted papers. Question groups and frequency are provisional, not official syllabus weightage or examination predictions.
IdentifyIdentify thethe errorserrors inin thethe followingfollowing code:code: 2 COl L2 publicpublic intint searchAccount(searchAccount( int[2S]int[2S] number)number) {{ numbernumber == newint[15];newint[15]; forfor (int(int ii == 0;0; ii << number.length;number.length; i++)i++) {{ number[i]number[i] == number[i-l]number[i-l] ++ number[i+l];number[i+l]; }} returnreturn number;number; }}
0 eligible source papersFindFind outout whatwhat isis wrongwrong inin thethe followingfollowing code?code? 2 C01,C02 L I publicpublic classclass TestTest {{ privateprivate intint id;id; publicpublic voidvoid ml()ml() {{ this.idthis.id == 45;45; }} publicpublic voidvoid m2()m2() {{ Test.idTest.id == 45;45; }} }}
0 eligible source papersDifferentiate between overriding and overloading. 2 C01,C02 L2
0 eligible source papersWhat is the need for the layout managers? What is the 2 C01,C02 LS defaultJayout manager for a frame? How can the component * added to a frame?
0 eligible source papersUsing the try-catch block, write a code fragment that opens 2 C01,C02 L4 a file "default.dat".
0 eligible source papersWhat are the different ways of implementing multithreading 2 C04, L2 in a Java program? V
0 eligible source papersWhat is the role of Drivers in JDBC? 2 C02 L I
0 eligible source papersWhat is the advantage of implementing Comparator 2 C02 L2 interface in a class?
0 eligible source papersWrite about the lifecycle of JSP. 2 COS L I
0 eligible source papersList the types of Java Web services. 2 COS L I
0 eligible source papersA teacher has five students who have taken four tests and COl L2, the test scores are stored in 2D array. The following LS grading scale is assigned to a student based on average of his/her four tests. Test Score Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-S9 F Write a program to print each student's average test score and grade.
0 eligible source papersDefine a class called Salesperson whose data members C01,C02 L2, are: age(integer), name(String), number of sales(integer), LS salary(double). The member functions are: constructor with three arguments to initialise member variables age, name and salary and number of sales is initialised always initialised to zero, addSale(double saleAmount) - method to increment the number of sales for the amount of sale made, int getSales() - to return the sales made by the Salesperson, displayO - to display the details of the Salesperson, double getBonus() - to return the bonus of Salesperson based on the following table: Sales range Bonus amount 10-20 1000 20-40 2000 > 40 SOOO Write a driver program to create object of Salesperson and test all methods. IS Design a class named Ticket with fields for holding C01,C02 L2,L3 category(char) - that takes value A, B and C, ticketPriceA (double), ticketPriceB (double) and ticketPrice_C (double). The methods are constructor with arguments to initialise data fields and toString() to display the details of Ticket. Create a class named Concert, which extends the Ticket class. The Concert class should have a field for a totalScats(int) and the seat distribution for each category is given by catA_seat(int), catB_seat(int) and catC_seat(int).T]ie metliods are: • Constructor with arguments • void sell(char,int) - that decrements the total number of seats and respective category seat • void cancel(char,int) that increments the total number of seats and respective category seat • double calculateO - that returns the revenue generated by sales of Ticket. • toStringO - display the details of Concert. Write a Test program to create objects of the classes and invoke the methods of the classes.
0 eligible source papersCreate a Conference Registration System as GUI C 0 2 L2,L3 application that calculates the registration fees for a conference. The general conference registration is Rs.895 per person and student registration is Rs. 495. There is an optional keynote speech for Rs.300 per person. The Workshop Fee(Rupees) Network Security 295 Advanced Java 395 Programming Spring Framework 495 The application should allow the user to select the registration type, the optional keynote speech and as many preconference workshop. The total cost should be displayed.
0 eligible source papersImplement FileHandler class that contains write and read C03,C05 L2,L3 methods to read and write objects of Salesperson defined in question 12.Write a main program that will print the Salesperson who made maximum number of sales.
0 eligible source papersWrite a Java program to display the message " Welcome to C 0 2 L2,L3 Java Exam" using multiple threads with sleep interval of 100 ms'
0 eligible source papersDevelop a Java program to create a Bank Account database C 0 4 L2,L3 named BankDB. The BankDB database will have a table named AcountHolder, with the following columns: Column Name Data Type Name Char (50) Balance Double Address Char(lOO) Primary key Account number Double The table will contain 5 rows with various account bolder details. Write a program that connects to the BankDB database, and allows the user to perform the following operations: i. Sort the list of AccountHolder by balance, in ascending order. ii. Get the total amount in bank.
0 eligible source papersCreate a class called PhoneBook that has fields 8 C02 L2,L3 name(String) and phone number(int). Define constructor amd toStringO methods. Implement a driver program that creates alteast five PhoneBook objects and stores in an arraylist, the duplicate names(if any) in the arraylist should be deleted and PhoneBook objects must be displayed.
0 eligible source papersWrite a simple client/server application using socket 8 C05 L2,L3 programming. The client will send the amount and years of the Fixed deposit to a server. The server receives the data and produces the result. The result is sent to client and the client displays it in console.
0 eligible source papersWrite an applet that receives a name through a parameter 8 C02 L2,L3 and displays it with a "Hello" message.
0 eligible source papersCreate an Interface Tax with method calculateTax and 8 C05 L2,L3 static variable tax initialised with value 0.15. Implement this interface in class Salesperson defined in Q.no.l2. Write a main program to print the SalesPerson who has paid highest tax by implementing Comparator Interface.
0 eligible source papersList out the steps involved in creating a RMl application 8 COS L2,L3 with an example. Part - Cr2 X 8 = 16 Marks) SI No. Questions Marks CO B L
0 eligible source papersWrite a simple generic version of method isEqualTo that compares its 6 C03 L2,L2 two arguments with the equals method and returns true if they're equal and false otherwise. Use this generic method in a program that calls isEqualTo with a variety of built-in types, such as Object or Integer
0 eligible source papersWith respect to Q.no 13, write an exception class that can be 10 COl L2,L3 instantiated and thrown whenever a negative or zero is initialised as C02 Ticket's each category price. Wi;ite another exception class that can be instantiated and thiown to validate the method seli() that the number of seats sold doesnot exceed totalSeats. Demonstrate the exception classes in a Java program. (L1 - Remembering, L2 - Understanding, L3 - Applying, L4 - Analysing, L5 - Evaluating, L6 - Creating)
0 eligible source papersHistorical analysis based on extracted question papers. Topic classifications, marks and planning estimates are provisional.